Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bdbc5f13 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller
Browse files

bonding: 3ad: use curr_slave_lock instead of bond->lock



In 3ad mode the only syncing needed by bond->lock is for the wq
and the recv handler, so change them to use curr_slave_lock.
There're no locking dependencies here as 3ad doesn't use
curr_slave_lock at all.

Signed-off-by: default avatarNikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 51752afa
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -2057,7 +2057,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
	struct port *port;
	struct port *port;
	bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER;
	bool should_notify_rtnl = BOND_SLAVE_NOTIFY_LATER;


	read_lock(&bond->lock);
	read_lock(&bond->curr_slave_lock);
	rcu_read_lock();
	rcu_read_lock();


	/* check if there are any slaves */
	/* check if there are any slaves */
@@ -2120,7 +2120,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work)
		}
		}
	}
	}
	rcu_read_unlock();
	rcu_read_unlock();
	read_unlock(&bond->lock);
	read_unlock(&bond->curr_slave_lock);


	if (should_notify_rtnl && rtnl_trylock()) {
	if (should_notify_rtnl && rtnl_trylock()) {
		bond_slave_state_notify(bond);
		bond_slave_state_notify(bond);
@@ -2395,7 +2395,6 @@ int __bond_3ad_get_active_agg_info(struct bonding *bond,
	return 0;
	return 0;
}
}


/* Wrapper used to hold bond->lock so no slave manipulation can occur */
int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info)
{
{
	int ret;
	int ret;
@@ -2487,9 +2486,9 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
	if (!lacpdu)
	if (!lacpdu)
		return ret;
		return ret;


	read_lock(&bond->lock);
	read_lock(&bond->curr_slave_lock);
	ret = bond_3ad_rx_indication(lacpdu, slave, skb->len);
	ret = bond_3ad_rx_indication(lacpdu, slave, skb->len);
	read_unlock(&bond->lock);
	read_unlock(&bond->curr_slave_lock);
	return ret;
	return ret;
}
}


+7 −5
Original line number Original line Diff line number Diff line
@@ -1687,13 +1687,15 @@ static int __bond_release_one(struct net_device *bond_dev,
	 * for this slave anymore.
	 * for this slave anymore.
	 */
	 */
	netdev_rx_handler_unregister(slave_dev);
	netdev_rx_handler_unregister(slave_dev);
	write_lock_bh(&bond->lock);


	/* Inform AD package of unbinding of slave. */
	if (BOND_MODE(bond) == BOND_MODE_8023AD) {
	if (BOND_MODE(bond) == BOND_MODE_8023AD)
		/* Sync against bond_3ad_rx_indication and
		 * bond_3ad_state_machine_handler
		 */
		write_lock_bh(&bond->curr_slave_lock);
		bond_3ad_unbind_slave(slave);
		bond_3ad_unbind_slave(slave);

		write_unlock_bh(&bond->curr_slave_lock);
	write_unlock_bh(&bond->lock);
	}


	netdev_info(bond_dev, "Releasing %s interface %s\n",
	netdev_info(bond_dev, "Releasing %s interface %s\n",
		    bond_is_active_slave(slave) ? "active" : "backup",
		    bond_is_active_slave(slave) ? "active" : "backup",