From: ebiederm@xmission.com (Eric W. Biederman)
To: David Miller <davem@davemloft.net>
Cc: Dilip Daya <dilip.daya@hp.com>,
linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org, netdev@vger.kernel.org,
"Serge E. Hallyn" <serge@hallyn.com>
Subject: [PATCH 1/2] bonding: Manage /proc/net/bonding/ entries from the netdev events
Date: Mon, 09 Jul 2012 13:51:45 -0700 [thread overview]
Message-ID: <87y5ms3bfi.fsf_-_@xmission.com> (raw)
In-Reply-To: <20120706194741.GA22113@mail.hallyn.com> (Serge E. Hallyn's message of "Fri, 6 Jul 2012 19:47:41 +0000")
It was recently reported that moving a bonding device between network
namespaces causes warnings from /proc. It turns out after the move we
were trying to add and to remove the /proc/net/bonding entries from the
wrong network namespace.
Move the bonding /proc registration code into the NETDEV_REGISTER and
NETDEV_UNREGISTER events where the proc registration and unregistration
will always happen at the right time.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
drivers/net/bonding/bond_main.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2ee8cf9..50de0fe 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3226,6 +3226,12 @@ static int bond_master_netdev_event(unsigned long event,
switch (event) {
case NETDEV_CHANGENAME:
return bond_event_changename(event_bond);
+ case NETDEV_UNREGISTER:
+ bond_remove_proc_entry(event_bond);
+ break;
+ case NETDEV_REGISTER:
+ bond_create_proc_entry(event_bond);
+ break;
default:
break;
}
@@ -4410,8 +4416,6 @@ static void bond_uninit(struct net_device *bond_dev)
bond_work_cancel_all(bond);
- bond_remove_proc_entry(bond);
-
bond_debug_unregister(bond);
__hw_addr_flush(&bond->mc_list);
@@ -4813,7 +4817,6 @@ static int bond_init(struct net_device *bond_dev)
bond_set_lockdep_class(bond_dev);
- bond_create_proc_entry(bond);
list_add_tail(&bond->bond_list, &bn->dev_list);
bond_prepare_sysfs_group(bond);
--
1.7.5.4
next prev parent reply other threads:[~2012-07-09 20:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-28 16:18 Network namespace and bonding WARNING at fs/proc/generic.c remove_proc_entry Dilip Daya
2012-07-05 22:07 ` Serge E. Hallyn
2012-07-06 0:41 ` Eric W. Biederman
2012-07-06 17:05 ` Serge E. Hallyn
2012-07-06 18:01 ` Dilip Daya
2012-07-06 18:57 ` Eric W. Biederman
2012-07-06 19:47 ` Serge E. Hallyn
2012-07-09 20:51 ` Eric W. Biederman [this message]
2012-07-09 20:52 ` [PATCH 2/2] bonding: debugfs and network namespaces are incompatible Eric W. Biederman
2012-07-09 21:49 ` David Miller
2012-07-10 17:36 ` Jay Vosburgh
2012-07-09 21:49 ` [PATCH 1/2] bonding: Manage /proc/net/bonding/ entries from the netdev events David Miller
2012-07-06 18:01 ` Network namespace and bonding WARNING at fs/proc/generic.c remove_proc_entry Dilip Daya
2012-07-06 18:40 ` Eric W. Biederman
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=87y5ms3bfi.fsf_-_@xmission.com \
--to=ebiederm@xmission.com \
--cc=containers@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=dilip.daya@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=serge@hallyn.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome