From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarek Poplawski Subject: [PATCH] bonding: Fix lockdep warning after bond_vlan_rx_register() Date: Wed, 27 Oct 2010 19:08:22 +0200 Message-ID: <20101027170822.GA1902@del.dom.local> References: <1288175070.2709.86.camel@edumazet-laptop> <20101027120334.GA11247@ff.dom.local> <1288184416.2709.109.camel@edumazet-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Eric Dumazet , netdev , Jesse Gross , Jay Vosburgh To: David Miller Return-path: Received: from mail-ww0-f42.google.com ([74.125.82.42]:57171 "EHLO mail-ww0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752129Ab0J0RIa (ORCPT ); Wed, 27 Oct 2010 13:08:30 -0400 Received: by wwi18 with SMTP id 18so1828777wwi.1 for ; Wed, 27 Oct 2010 10:08:28 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1288184416.2709.109.camel@edumazet-laptop> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Oct 27, 2010 at 03:00:16PM +0200, Eric Dumazet wrote: > > Indeed this is the right fix, I wonder why I did not catch it before ? > > Acked-by: Eric Dumazet Thanks, Jarek P. ------------------------> 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 --- 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;