From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jay Vosburgh Subject: [PATCH 6/6] Acquire correct locks in alb for promisc change Date: Wed, 17 Oct 2007 17:37:51 -0700 Message-ID: <11926678792546-git-send-email-fubar@us.ibm.com> References: <1192667871139-git-send-email-fubar@us.ibm.com> <1192667875793-git-send-email-fubar@us.ibm.com> <11926678763205-git-send-email-fubar@us.ibm.com> <11926678762641-git-send-email-fubar@us.ibm.com> <11926678773102-git-send-email-fubar@us.ibm.com> <11926678781487-git-send-email-fubar@us.ibm.com> <11926678783362-git-send-email-fubar@us.ibm.com> Cc: andy@greyhouse.net, Jay Vosburgh To: netdev@vger.kernel.org, jgarzik@pobox.com Return-path: Received: from e33.co.us.ibm.com ([32.97.110.151]:59164 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762365AbXJRAiB (ORCPT ); Wed, 17 Oct 2007 20:38:01 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e33.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id l9I0c0Ok006164 for ; Wed, 17 Oct 2007 20:38:00 -0400 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v8.5) with ESMTP id l9I0c05L261384 for ; Wed, 17 Oct 2007 18:38:00 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l9I0c0O2021458 for ; Wed, 17 Oct 2007 18:38:00 -0600 In-Reply-To: <11926678783362-git-send-email-fubar@us.ibm.com> Sender: netdev-owner@vger.kernel.org List-Id: netdev.vger.kernel.org Update ALB mode monitor to hold correct locks (RTNL and nothing else) when calling dev_set_promiscuity. Signed-off-by: Andy Gospodarek Signed-off-by: Jay Vosburgh --- drivers/net/bonding/bond_alb.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 6db5d76..25b8dbf 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -1455,16 +1455,16 @@ void bond_alb_monitor(struct work_struct *work) /* handle rlb stuff */ if (bond_info->rlb_enabled) { - /* the following code changes the promiscuity of the - * the curr_active_slave. It needs to be locked with a - * write lock to protect from other code that also - * sets the promiscuity. - */ - write_lock_bh(&bond->curr_slave_lock); - if (bond_info->primary_is_promisc && (++bond_info->rlb_promisc_timeout_counter >= RLB_PROMISC_TIMEOUT)) { + /* + * dev_set_promiscuity requires rtnl and + * nothing else. + */ + read_unlock(&bond->lock); + rtnl_lock(); + bond_info->rlb_promisc_timeout_counter = 0; /* If the primary was set to promiscuous mode @@ -1473,9 +1473,10 @@ void bond_alb_monitor(struct work_struct *work) */ dev_set_promiscuity(bond->curr_active_slave->dev, -1); bond_info->primary_is_promisc = 0; - } - write_unlock_bh(&bond->curr_slave_lock); + rtnl_unlock(); + read_lock(&bond->lock); + } if (bond_info->rlb_rebalance) { bond_info->rlb_rebalance = 0; -- 1.5.3.4.206.g58ba4-dirty