From a71fb88145a03678fef3796930993e390db68a15 Mon Sep 17 00:00:00 2001 From: Jarek Poplawski Date: Wed, 27 Oct 2010 07:08:22 +0000 Subject: [PATCH] bonding: Fix lockdep warning after bond_vlan_rx_register() Fix lockdep warning: [ 52.991402] ====================================================== [ 52.991511] [ INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected ] [ 52.991569] 2.6.36-04573-g4b60626-dirty #65 [ 52.991622] ------------------------------------------------------ [ 52.991696] ip/4842 [HC0[0]:SC0[4]:HE1:SE0] is trying to acquire: [ 52.991758] (&bond->lock){++++..}, at: [] bond_set_multicast_list+0x60/0x2c0 [bonding] [ 52.991966] [ 52.991967] and this task is already holding: [ 52.992008] (&bonding_netdev_addr_lock_key){+.....}, at: [] dev_mc_sync+0x50/0xa0 [ 52.992008] which would create a new lock dependency: [ 52.992008] (&bonding_netdev_addr_lock_key){+.....} -> (&bond->lock){++++..} [ 52.992008] [ 52.992008] but this new dependency connects a SOFTIRQ-irq-safe lock: [ 52.992008] (&(&mc->mca_lock)->rlock){+.-...} [ 52.992008] ... which became SOFTIRQ-irq-safe at: [ 52.992008] [] __lock_acquire+0x96b/0x1960 [ 52.992008] [] lock_acquire+0x7e/0xf0 [ 52.992008] [] _raw_spin_lock_bh+0x3d/0x50 [ 52.992008] [] mld_ifc_timer_expire+0xf0/0x280 [ 52.992008] [] run_timer_softirq+0x146/0x310 [ 52.992008] [] __do_softirq+0xad/0x1c0 [ 52.992008] [ 52.992008] to a SOFTIRQ-irq-unsafe lock: [ 52.992008] (&bond->lock){++++..} [ 52.992008] ... which became SOFTIRQ-irq-unsafe at: [ 52.992008] ... [] __lock_acquire+0x9bb/0x1960 [ 52.992008] [] lock_acquire+0x7e/0xf0 [ 52.992008] [] _raw_write_lock+0x38/0x50 [ 52.992008] [] bond_vlan_rx_register+0x24/0x70 [bonding] [ 52.992008] [] register_vlan_dev+0xc0/0x280 [ 52.992008] [] vlan_newlink+0xaa/0xd0 [ 52.992008] [] rtnl_newlink+0x404/0x490 [ 52.992008] [] rtnetlink_rcv_msg+0x1e5/0x220 [ 52.992008] [] netlink_rcv_skb+0x8e/0xb0 [ 52.992008] [] rtnetlink_rcv+0x1c/0x30 [ 52.992008] [] netlink_unicast+0x24b/0x290 [ 52.992008] [] netlink_sendmsg+0x1f7/0x310 [ 52.992008] [] sock_sendmsg+0xac/0xe0 [ 52.992008] [] sys_sendmsg+0x130/0x230 [ 52.992008] [] sys_socketcall+0xde/0x280 [ 52.992008] [] sysenter_do_call+0x12/0x36 [ 52.992008] [ 52.992008] other info that might help us debug this: ... [ Full info at netdev: Wed, 27 Oct 2010 12:24:30 +0200 Subject: [BUG net-2.6 vlan/bonding] lockdep splats ] Use BH variant of write_lock(&bond->lock) (as elsewhere in bond_main) to prevent this dependency. Fixes commit f35188faa0fbabefac476536994f4b6f3677380f [v2.6.36] Reported-by: Eric Dumazet Tested-by: Eric Dumazet Signed-off-by: Jarek Poplawski Acked-by: Eric Dumazet Cc: Jay Vosburgh --- drivers/net/bonding/bond_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index beb3b7c..bdb68a6 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -493,9 +493,9 @@ static void bond_vlan_rx_register(struct net_device *bond_dev, struct slave *slave; int i; - write_lock(&bond->lock); + write_lock_bh(&bond->lock); bond->vlgrp = grp; - write_unlock(&bond->lock); + write_unlock_bh(&bond->lock); bond_for_each_slave(bond, slave, i) { struct net_device *slave_dev = slave->dev; -- 2.7.4