lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAF2d9jjDCh0n12BDuw0Arjs3gb0CG73R53QxFLpFmp-2VBjCbg@mail.gmail.com>
Date:	Thu, 12 Mar 2015 18:54:09 -0700
From:	Mahesh Bandewar <maheshb@...gle.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Jay Vosburgh <j.vosburgh@...il.com>,
	Andy Gospodarek <andy@...yhouse.net>,
	Veaceslav Falico <vfalico@...il.com>,
	Nikolay Aleksandrov <nikolay@...hat.com>,
	David Miller <davem@...emloft.net>,
	Maciej Zenczykowski <maze@...gle.com>,
	netdev <netdev@...r.kernel.org>,
	Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next 2/4] bonding: Do not ignore notifications for miimon-work-queue

On Thu, Mar 12, 2015 at 2:34 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> On Wed, 2015-03-11 at 22:54 -0700, Mahesh Bandewar wrote:
>> This patch adds code to reschedule the mii-work (aggressively)
>> just to handle the notification before resuming the regular
>> cycle.
>>
>> Signed-off-by: Mahesh Bandewar <maheshb@...gle.com>
>> ---
>>  drivers/net/bonding/bond_main.c | 24 +++++++++++++++---------
>>  1 file changed, 15 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index 19eabea2d7d9..54ecb7a22bae 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -2143,10 +2143,13 @@ static void bond_mii_monitor(struct work_struct *work)
>>       if (!bond_has_slaves(bond))
>>               goto re_arm;
>>
>> -     rcu_read_lock();
>> -
>> +     if (bond_get_notif_pending(bond, BOND_MII_NOTIF)) {
>> +             should_notify_peers = true;
>> +             goto re_arm;
>> +     }
>>       should_notify_peers = bond_should_notify_peers(bond);
>>
>> +     rcu_read_lock();
>>       if (bond_miimon_inspect(bond)) {
>>               rcu_read_unlock();
>>
>> @@ -2164,15 +2167,18 @@ static void bond_mii_monitor(struct work_struct *work)
>>               rcu_read_unlock();
>>
>>  re_arm:
>> -     if (bond->params.miimon)
>> -             queue_delayed_work(bond->wq, &bond->mii_work, delay);
>> -
>>       if (should_notify_peers) {
>> -             if (!rtnl_trylock())
>> -                     return;
>> -             call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
>> -             rtnl_unlock();
>> +             if (!rtnl_trylock()) {
>> +                     delay = 1;
>> +                     bond_set_notif_pending(bond, BOND_MII_NOTIF, 1);
>> +             } else {
>> +                     call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev);
>> +                     rtnl_unlock();
>> +                     bond_set_notif_pending(bond, BOND_MII_NOTIF, 0);
>
> You probably should clear notif bit before releasing rtnl
>
> (same remark for patches 3 & 4)
>
Since this op is atomic and does not need lock, I used it in the
current fashion. I probably won't need to clear it if I use the
test_and_clear instead of current test_bit() in get_notif_pending()

>> +             }
>>       }
>> +     if (bond->params.miimon)
>> +             queue_delayed_work(bond->wq, &bond->mii_work, delay);
>>  }
>>
>>  static bool bond_has_this_ip(struct bonding *bond, __be32 ip)
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ