bonding: Don't hold lock when calling rtnl_unlock

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, January 18, 2008 - 3:59 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=565566...
Commit:     5655662dab4ef044be7efd155f2f5fef2e486545
Parent:     027ea0416c955778ceca7ef82e48a1dd6b4617c9
Author:     Jay Vosburgh <fubar@us.ibm.com>
AuthorDate: Thu Jan 17 16:25:03 2008 -0800
Committer:  Jeff Garzik <jeff@garzik.org>
CommitDate: Fri Jan 18 14:38:39 2008 -0500

    bonding: Don't hold lock when calling rtnl_unlock
    
    Change bond_mii_monitor to not hold any locks when calling rtnl_unlock,
    as rtnl_unlock can sleep (when acquring another mutex in netdev_run_todo).
    
    Bug reported by Makito SHIOKAWA <mshiokawa@miraclelinux.com>, who
    included a different patch.
    
    Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
    Signed-off-by: Jeff Garzik <jeff@garzik.org>
---
 drivers/net/bonding/bond_main.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2c6da49..49a1982 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2386,7 +2386,9 @@ void bond_mii_monitor(struct work_struct *work)
 		rtnl_lock();
 		read_lock(&bond->lock);
 		__bond_mii_monitor(bond, 1);
-		rtnl_unlock();
+		read_unlock(&bond->lock);
+		rtnl_unlock();	/* might sleep, hold no other locks */
+		read_lock(&bond->lock);
 	}
 
 	delay = ((bond->params.miimon * HZ) / 1000) ? : 1;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
bonding: Don't hold lock when calling rtnl_unlock, Linux Kernel Mailing ..., (Fri Jan 18, 3:59 pm)