]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
IB/ipoib: Make the carrier_on_task race aware
authorDoug Ledford <dledford@redhat.com>
Sun, 22 Feb 2015 00:27:02 +0000 (19:27 -0500)
committerDoug Ledford <dledford@redhat.com>
Wed, 15 Apr 2015 20:06:17 +0000 (16:06 -0400)
commit894021a752912ef4c2b63c8d2c466c00bc3cd2e6
tree1a7f18553a536407c558a61c038055a2acb3ffb4
parentc84ca6d2b1a1bfbdab2dd2bc243840e9589a5aaf
IB/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_OPER_UP has been cleared, in which case we don't need to do
anything anyway and we just return.

While investigating which flag should be used, FLAG_ADMIN_UP or
FLAG_OPER_UP, it was determined that FLAG_OPER_UP was the more
appropriate flag to use.  However, there was a mix of these two flags in
use in the existing code.  So while we check for that flag here as part
of this race fix, also cleanup the two places that had used the less
appropriate flag for their tests.

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