Menu

#3 stale link state causes double dev_close

open
nobody
None
5
2003-07-18
2003-07-18
No

I recently isolated a problem we were
having with an Ethernet device driver crashing. Attached
is
the associated patch.

When ifenslave was called with the (-D) option to
detach the
slaves, the dev_close routine was being called twice
without
an intervening dev_open thus causing the device driver
to
OOPS.

I traced the reason to the “bond_restore_slave_flags()”
routine in bonding.c. It seems that the link state
information
restored from the slave’s “original_flags” was stale.
The “original_flags” value indicated a link state of IFF_UP
whereas the current state was the opposite; the
interface
was actually down from the BOND_RELEASE. By
restoring the
link state to “UP” without calling dev_open, the
subsequent
action of ifenslave was to attempt set the flags to a
down
state. This in turn caused dev_close to be erroneously
called.

By modifying the “bond_restore_slave_flags()” routine to
maintain the current link state, the problem was resolved.

---------------------
diff -urN old/bonding.c new/bonding.c
--- old/bonding.c 2003-07-07 10:12:13.000000000 -
0600
+++ new/bonding.c 2003-07-07
10:19:10.000000000 -0600
@@ -431,7 +431,10 @@

static void bond_restore_slave_flags(slave_t *slave)
{
- slave->dev->flags = slave->original_flags;
+ if (IS_UP(slave->dev))
+ slave->dev->flags = slave-
>original_flags |
IFF_UP;
+ else
+ slave->dev->flags = slave-
>original_flags
& ~IFF_UP;
}

static void bond_set_slave_inactive_flags(slave_t
*slave)

Discussion


Log in to post a comment.