]> git.baikalelectronics.ru Git - kernel.git/commit
IPoIB: Make the carrier_on_task race aware
authorDoug Ledford <dledford@redhat.com>
Wed, 10 Dec 2014 16:46:59 +0000 (11:46 -0500)
committerRoland Dreier <roland@purestorage.com>
Tue, 16 Dec 2014 02:11:14 +0000 (18:11 -0800)
commit836362502f7e66de72a1dbb82c868e5059a789db
treee644552b4dbd9f601765695372566c03975a4739
parent0da33d37c83d6e06f5f8dcfd320b1cc3892a583b
IPoIB: Make the carrier_on_task race aware

We blindly assume that we can just take the rtnl lock and that will
prevent races with downing this interface.  Unfortunately, that's not
the case.  In ipoib_mcast_stop_thread() we will call flush_workqueue()
in an attempt to clear out all remaining instances of ipoib_join_task.
But, since this task is put on the same workqueue as the join task,
the flush_workqueue waits on this thread too.  But this thread is
deadlocked on the rtnl lock.  The better thing here is to use trylock
and loop on that until we either get the lock or we see that
FLAG_ADMIN_UP has been cleared, in which case we don't need to do
anything anyway and we just return.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/ulp/ipoib/ipoib_multicast.c