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: <1435836940.11970.18.camel@edumazet-glaptop2.roam.corp.google.com>
Date:	Thu, 02 Jul 2015 13:35:40 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Mazhar Rana <ranamazharp@...il.com>
Cc:	netdev@...r.kernel.org, j.vosburgh@...il.com, vfalico@...il.com,
	gospo@...ulusnetworks.com, davem@...emloft.net,
	sanket.shah@...eroam.com, mazhar.rana@...eroam.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bonding: "primary_reselect" with "failure" is not
 working properly

On Thu, 2015-07-02 at 15:43 +0530, Mazhar Rana wrote:
> When "primary_reselect" is set to "failure", primary interface should
> not become active until current active slave is up. But if we set first
> member of bond device as a "primary" interface and "primary_reselect"
> is set to "failure" then whenever primary interface's link get back(up)
> it become active slave even if current active slave is still up.
> 
> With this patch, "bond_find_best_slave" will not traverse members if
> primary interface is not candidate for failover/reselection and current
> active slave is still up.
> 
> Signed-off-by: Mazhar Rana <mazhar.rana@...eroam.com>
> Reviewed-by: Sanket Shah <sanket.shah@...eroam.com>
> ---
>  drivers/net/bonding/bond_main.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 19eb990..ac71261 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -715,7 +715,7 @@ static bool bond_should_change_active(struct bonding *bond)
>   */
>  static struct slave *bond_find_best_slave(struct bonding *bond)
>  {
> -	struct slave *slave, *bestslave = NULL, *primary;
> +	struct slave *slave, *bestslave = NULL, *primary, *curr;
>  	struct list_head *iter;
>  	int mintime = bond->params.updelay;
>  
> @@ -724,6 +724,14 @@ static struct slave *bond_find_best_slave(struct bonding *bond)
>  	    bond_should_change_active(bond))
>  		return primary;
>  
> +	/* We are here means primary interface is not candidate for
> +	 * reslection/failover. If currenet active slave is still up
> +	 * then there is no meaning to traverse  members.
> +	 */
> +	curr = rtnl_dereference(bond->curr_active_slave);

Here you carefully use rtnl_dereference(bond->curr_active_slave)

(This is good)

> +	if (curr && curr->link == BOND_LINK_UP)
> +		return bond->curr_active_slave;

But here you return bond->curr_active_slave 
instead of curr

> +
>  	bond_for_each_slave(bond, slave, iter) {
>  		if (slave->link == BOND_LINK_UP)
>  			return slave;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ