提交 98b90f26 编写于 作者: V Veaceslav Falico 提交者: David S. Miller

bonding: RCUify bond_ab_arp_probe

Currently bond_ab_arp_probe() is always called under rcu_read_lock(),
however to work with curr_active_slave we're still holding the
curr_slave_lock.

To remove that curr_slave_lock - rcu_dereference the bond's
curr_active_slave and use it further - so that we're sure the slave won't
go away, and we don't care if it will change in the meanwhile.

CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: NVeaceslav Falico <vfalico@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 bb9fbe2d
...@@ -2605,25 +2605,21 @@ static void bond_ab_arp_commit(struct bonding *bond) ...@@ -2605,25 +2605,21 @@ static void bond_ab_arp_commit(struct bonding *bond)
static void bond_ab_arp_probe(struct bonding *bond) static void bond_ab_arp_probe(struct bonding *bond)
{ {
struct slave *slave, *before = NULL, *new_slave = NULL, struct slave *slave, *before = NULL, *new_slave = NULL,
*curr_arp_slave = rcu_dereference(bond->current_arp_slave); *curr_arp_slave = rcu_dereference(bond->current_arp_slave),
*curr_active_slave = rcu_dereference(bond->curr_active_slave);
struct list_head *iter; struct list_head *iter;
bool found = false; bool found = false;
read_lock(&bond->curr_slave_lock); if (curr_arp_slave && curr_active_slave)
if (curr_arp_slave && bond->curr_active_slave)
pr_info("PROBE: c_arp %s && cas %s BAD\n", pr_info("PROBE: c_arp %s && cas %s BAD\n",
curr_arp_slave->dev->name, curr_arp_slave->dev->name,
bond->curr_active_slave->dev->name); curr_active_slave->dev->name);
if (bond->curr_active_slave) { if (curr_active_slave) {
bond_arp_send_all(bond, bond->curr_active_slave); bond_arp_send_all(bond, curr_active_slave);
read_unlock(&bond->curr_slave_lock);
return; return;
} }
read_unlock(&bond->curr_slave_lock);
/* if we don't have a curr_active_slave, search for the next available /* if we don't have a curr_active_slave, search for the next available
* backup slave from the current_arp_slave and make it the candidate * backup slave from the current_arp_slave and make it the candidate
* for becoming the curr_active_slave * for becoming the curr_active_slave
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册