From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH] bonding: avoid repeated display of same link status change Date: Mon, 17 Sep 2018 07:38:02 -0700 Message-ID: <33a66a80-22ed-d6b3-f6b2-4463357c5ffa@gmail.com> References: <20180917072059.32657-1-mk.singh@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , linux-kernel@vger.kernel.org To: mk.singh@oracle.com, netdev@vger.kernel.org Return-path: Received: from mail-pg1-f194.google.com ([209.85.215.194]:43654 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728757AbeIQUFk (ORCPT ); Mon, 17 Sep 2018 16:05:40 -0400 In-Reply-To: <20180917072059.32657-1-mk.singh@oracle.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 09/17/2018 12:20 AM, mk.singh@oracle.com wrote: > From: Manish Kumar Singh > > When link status change needs to be committed and rtnl lock couldn't be > taken, avoid redisplay of same link status change message. > > Signed-off-by: Manish Kumar Singh > --- > drivers/net/bonding/bond_main.c | 6 ++++-- > include/net/bonding.h | 1 + > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c > index 217b790d22ed..fb4e3aff1677 100644 > --- a/drivers/net/bonding/bond_main.c > +++ b/drivers/net/bonding/bond_main.c > @@ -2087,7 +2087,7 @@ static int bond_miimon_inspect(struct bonding *bond) > bond_propose_link_state(slave, BOND_LINK_FAIL); > commit++; > slave->delay = bond->params.downdelay; > - if (slave->delay) { > + if (slave->delay && !bond->rtnl_needed) { > netdev_info(bond->dev, "link status down for %sinterface %s, disabling it in %d ms\n", > (BOND_MODE(bond) == > BOND_MODE_ACTIVEBACKUP) ? > @@ -2127,7 +2127,7 @@ static int bond_miimon_inspect(struct bonding *bond) > commit++; > slave->delay = bond->params.updelay; > > - if (slave->delay) { > + if (slave->delay && !bond->rtnl_needed) { > netdev_info(bond->dev, "link status up for interface %s, enabling it in %d ms\n", > slave->dev->name, > ignore_updelay ? 0 : > @@ -2301,9 +2301,11 @@ static void bond_mii_monitor(struct work_struct *work) > if (!rtnl_trylock()) { > delay = 1; > should_notify_peers = false; > + bond->rtnl_needed = true; How can you set a shared variable with no synchronization ? A bool is particularly dangerous here, at least on some arches. > goto re_arm; > } > > + bond->rtnl_needed = false; > bond_for_each_slave(bond, slave, iter) { > bond_commit_link_state(slave, BOND_SLAVE_NOTIFY_LATER); > } > diff --git a/include/net/bonding.h b/include/net/bonding.h > index 808f1d167349..50d61cf77855 100644 > --- a/include/net/bonding.h > +++ b/include/net/bonding.h > @@ -234,6 +234,7 @@ struct bonding { > struct dentry *debug_dir; > #endif /* CONFIG_DEBUG_FS */ > struct rtnl_link_stats64 bond_stats; > + bool rtnl_needed; > }; > > #define bond_slave_get_rcu(dev) \ >