SUNRPC: xprt_clear_locked() only needs release memory semantics
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 12 Jul 2021 16:34:34 +0000 (12:34 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 4 Oct 2021 00:49:06 +0000 (20:49 -0400)
The clearing of the XPRT_LOCKED bit has to happen after we clear
xprt->snd_task, but we don't require any extra memory barriers after
that.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
net/sunrpc/xprt.c

index d4aeee83763e658330f4e8051c7b373e1b30d706..48560188e84d5c56707563b211f321a06c630ecf 100644 (file)
@@ -246,11 +246,9 @@ EXPORT_SYMBOL_GPL(xprt_find_transport_ident);
 static void xprt_clear_locked(struct rpc_xprt *xprt)
 {
        xprt->snd_task = NULL;
-       if (!test_bit(XPRT_CLOSE_WAIT, &xprt->state)) {
-               smp_mb__before_atomic();
-               clear_bit(XPRT_LOCKED, &xprt->state);
-               smp_mb__after_atomic();
-       } else
+       if (!test_bit(XPRT_CLOSE_WAIT, &xprt->state))
+               clear_bit_unlock(XPRT_LOCKED, &xprt->state);
+       else
                queue_work(xprtiod_workqueue, &xprt->task_cleanup);
 }