bonding: destroy proc directory only after all bonds are gone
Subsystems (3)
PATCH 1/1 bonding: destroy proc directory only after all bonds are gone
Currently we might arrive to bond_net_exit() with some bonds left (that were created while the module is unloading). We take care of that by destroying sysfs (the last possibility to add new bonds) and then destroying all the remaining bonds.
However, we destroy the /proc/net/bonding directory before destroying those last bonds, and get a warning that we're trying to destroy a non-empty proc directory (containing /proc/net/bonding/bondX).
Fix this by moving bond_destroy_proc_dir() after all the bonds are destroyed, so that we're sure that no bonds exist.
--- drivers/net/bonding/bond_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +2 -1
@@ -4450,7 +4450,6 @@ static void __net_exit bond_net_exit(struct net *net)LIST_HEAD (list);bond_destroy_sysfs (bn); -bond_destroy_proc_dir (bn);/* Kill off any bonds created after unregistering bond rtnl ops */ rtnl_lock ();
@@ -4458,6 +4457,8 @@ static void __net_exit bond_net_exit(struct net *net)unregister_netdevice_queue (bond->dev, &list);unregister_netdevice_many (&list);rtnl_unlock (); + +bond_destroy_proc_dir (bn); }static struct pernet_operations bond_net_ops = {
Signature · 1 line
1.8.4
From: Veaceslav Falico <[email protected]>
Date: Thu, 17 Jul 2014 12:04:08 +0200
Quoted 9 lines
Currently we might arrive to
bond_net_exit()with some bonds left (that were created while the module is unloading). We take care of that by destroying sysfs (the last possibility to add new bonds) and then destroying all the remaining bonds.However, we destroy the
/proc/net/bondingdirectory before destroying those last bonds, and get a warning that we're trying to destroy a non-empty proc directory (containing/proc/net/bonding/bondX).
Quoted 6 lines
Fix this by moving
bond_destroy_proc_dir()after all the bonds are destroyed, so that we're sure that no bonds exist.CC Jay Vosburgh <[email protected]>CC Andy Gospodarek <[email protected]>Signed-off-by Veaceslav Falico <[email protected]>
Applied, thanks.