From: Jay Vosburgh <jay.vosburgh@canonical.com>
To: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Cc: netdev@vger.kernel.org,
Andy Gospodarek <gospo@cumulusnetworks.com>,
vfalico@gmail.com, David Miller <davem@davemloft.net>
Subject: Re: [PATCH net] bonding: fix bond dev flags after convert to arphrd_ether
Date: Thu, 27 Aug 2015 20:39:25 -0700 [thread overview]
Message-ID: <21906.1440733165@nyx> (raw)
In-Reply-To: <92603003-58ED-46B1-B789-5D4765256FAC@cumulusnetworks.com>
Nikolay Aleksandrov <nikolay@cumulusnetworks.com> wrote:
[...]
>Restarting this thread because there’s actually a bug here, what you described with
>the bonding destruction is true when the slaves are all destroyed but it isn’t true if they’re
>just released, if you take a look at bond_slave_netdev_event() the bond destruction happens
>only on NETDEV_UNREGISTER and I just hit this bug by enslaving a non-ARPHRD_ETHER
>device, releasing it and enslaving a ARPHRD_ETHER device so ether_setup() path in bond_enslave
>is hit and IFF_MASTER gets dropped:
>17: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
> link/fddi 9a:33:c5:30:ff:a6 brd ff:ff:ff:ff:ff:ff
>(release non-ARPHRD_ETHER slave)
>(enslave ARPHRD_ETHER device)
>17: bond0: <BROADCAST,MULTICAST,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
> link/ether 08:00:27:3c:13:57 brd ff:ff:ff:ff:ff:ff
>
>Notice the master flag is gone and of course on unload we get:
>[57981.545547] ------------[ cut here ]------------
>[57981.545567] WARNING: CPU: 0 PID: 13792 at fs/proc/generic.c:575 remove_proc_entry+0x17e/0x190()
>[57981.545572] remove_proc_entry: removing non-empty directory 'net/bonding', leaking at least 'bond0'
[...]
>We need to convert it back to ARPHRD_ETHER if releasing the last slave, because
>we can’t destroy it (in some paths bond->dev is used after bond_release()).
>Basically we should make the case that if the bonding doesn’t have any slaves then it’s
>always an ARPHRD_ETHER device.
>
>Thoughts ?
I agree that it would be cleaner for bond_dev->type to switch
back on release of last slave. The options code (caller of
bond_option_slaves_set) and bond_uninit() both reference the bond or dev
after calling bond_release(), and would need changing if any release
could destroy the bond itself.
However, for the type change, there's the potentially tricky
case of a nested non-ARPHRD_ETHER bond, e.g., bond0 -> bond1 -> ib0.
This isn't a typical use case that I'm aware of, but I believe it's
supported by the code.
If ib0, the last slave, is released, bond1 will want to change
to ARPHRD_ETHER, but bond0 is ARPHRD_INFINIBAND. I suspect bonding will
have to notice the NETDEV_PRE_TYPE_CHANGE and _POST_ notifiers and take
appropriate action (i.e., cascade the type change upwards).
There might be similar issues with other devices stacked on top
of the IB -> Ether type-changing bond; I'm not sure how many of those
there may be, though, since many things won't stack over IB devices (or
an IB-flavor bond).
If the type change works, then I don't think we would still need
the "release and destroy" logic.
-J
---
-Jay Vosburgh, jay.vosburgh@canonical.com
next prev parent reply other threads:[~2015-08-28 3:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 20:09 [PATCH net] bonding: fix bond dev flags after convert to arphrd_ether Nikolay Aleksandrov
2015-07-15 20:32 ` Jay Vosburgh
2015-07-15 20:34 ` Nikolay Aleksandrov
2015-08-28 2:07 ` Nikolay Aleksandrov
2015-08-28 3:39 ` Jay Vosburgh [this message]
2015-08-28 17:38 ` Nikolay Aleksandrov
2015-07-15 20:55 ` Nikolay Aleksandrov
2015-07-20 20:01 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21906.1440733165@nyx \
--to=jay.vosburgh@canonical.com \
--cc=davem@davemloft.net \
--cc=gospo@cumulusnetworks.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=vfalico@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.