bonding: avoid repeated display of same link status change

Message ID 4d0ff757-ea60-2dae-cc66-45d3fe2dcca0@oracle.com
State Changes Requested
Delegated to: David Miller
Headers show
Series
  • bonding: avoid repeated display of same link status change
Related show

Commit Message

rama nichanamatlu Aug. 9, 2018, 9:12 p.m.
From 9927a1c2a632d9479a80c63b7d9fda59ea8374bc Mon Sep 17 00:00:00 2001
From: Rama Nichanamatlu <rama.nichanamatlu@oracle.com>
Date: Tue, 31 Jul 2018 07:09:52 -0700
Subject: [PATCH] bonding: avoid repeated display of same link status change

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: Rama Nichanamatlu <rama.nichanamatlu@oracle.com>
---
  drivers/net/bonding/bond_main.c |    6 ++++--
  include/net/bonding.h           |    1 +
  2 files changed, 5 insertions(+), 2 deletions(-)

Comments

David Miller Aug. 11, 2018, 4:41 p.m. | #1
From: rama nichanamatlu <rama.nichanamatlu@oracle.com>
Date: Thu, 9 Aug 2018 14:12:57 -0700

> From 9927a1c2a632d9479a80c63b7d9fda59ea8374bc Mon Sep 17 00:00:00 2001
> From: Rama Nichanamatlu <rama.nichanamatlu@oracle.com>
> Date: Tue, 31 Jul 2018 07:09:52 -0700
> Subject: [PATCH] bonding: avoid repeated display of same link status
> change
> 
> 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: Rama Nichanamatlu <rama.nichanamatlu@oracle.com>

Your email client has mis-formatted your patch.

Also, for a boolean set of values you should use 'bool' not 'u8'.

Patch

diff --git a/drivers/net/bonding/bond_main.c 
b/drivers/net/bonding/bond_main.c
index 63e3844..3dd1091 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2086,7 +2086,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) ?
@@ -2126,7 +2126,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 :
@@ -2300,9 +2300,11 @@  static void bond_mii_monitor(struct work_struct 
*work)
                 if (!rtnl_trylock()) {
                         delay = 1;
                         should_notify_peers = false;
+                       bond->rtnl_needed = true;
                         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 808f1d1..4e76e5d 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;
+       u8 rtnl_needed;
  };

  #define bond_slave_get_rcu(dev) \