diff options
author | Sean Hefty <sean.hefty@intel.com> | 2007-03-19 18:31:36 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-03-22 17:32:09 -0400 |
commit | e07832b66285124038a96b25a2056e91a55d8b1e (patch) | |
tree | ff6a8d6cd476a830610a83a558861d05b4026fff | |
parent | 60a596dab7c82bdfa5ee7abcee8e0ce385d4ef21 (diff) |
IPoIB: Fix race in detaching from mcast group before attaching
There's a race between ipoib_mcast_leave() and ipoib_mcast_join_finish()
where we can try to detach from a multicast group before we've
attached to it. Fix this by reordering the code in ipoib_mcast_leave
to free the multicast group first, which waits for the multicast
callback thread (which calls ipoib_mcast_join_finish()) to complete
before detaching from the group.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 56c87a81bb67..54fbead4de01 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -644,6 +644,9 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) | |||
644 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 644 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
645 | int ret = 0; | 645 | int ret = 0; |
646 | 646 | ||
647 | if (test_and_clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags)) | ||
648 | ib_sa_free_multicast(mcast->mc); | ||
649 | |||
647 | if (test_and_clear_bit(IPOIB_MCAST_FLAG_ATTACHED, &mcast->flags)) { | 650 | if (test_and_clear_bit(IPOIB_MCAST_FLAG_ATTACHED, &mcast->flags)) { |
648 | ipoib_dbg_mcast(priv, "leaving MGID " IPOIB_GID_FMT "\n", | 651 | ipoib_dbg_mcast(priv, "leaving MGID " IPOIB_GID_FMT "\n", |
649 | IPOIB_GID_ARG(mcast->mcmember.mgid)); | 652 | IPOIB_GID_ARG(mcast->mcmember.mgid)); |
@@ -655,9 +658,6 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) | |||
655 | ipoib_warn(priv, "ipoib_mcast_detach failed (result = %d)\n", ret); | 658 | ipoib_warn(priv, "ipoib_mcast_detach failed (result = %d)\n", ret); |
656 | } | 659 | } |
657 | 660 | ||
658 | if (test_and_clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags)) | ||
659 | ib_sa_free_multicast(mcast->mc); | ||
660 | |||
661 | return 0; | 661 | return 0; |
662 | } | 662 | } |
663 | 663 | ||