diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-09-08 01:38:55 +0200 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-09-30 21:35:16 +0200 |
commit | bd79bc579ca5cd35c08ab4f660085b0744bd5cfd (patch) | |
tree | dc14d376e802acac0eb09854e2daa3c0662a9aaf /net/sunrpc/xprt.c | |
parent | SUNRPC: Cleanup: remove the unused 'task' argument from the request_send() (diff) | |
download | linux-bd79bc579ca5cd35c08ab4f660085b0744bd5cfd.tar.xz linux-bd79bc579ca5cd35c08ab4f660085b0744bd5cfd.zip |
SUNRPC: Don't take transport->lock unnecessarily when taking XPRT_LOCK
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to '')
-rw-r--r-- | net/sunrpc/xprt.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index c86a5df6c338..11133ba716b9 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -298,6 +298,8 @@ static inline int xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task) { int retval; + if (test_bit(XPRT_LOCKED, &xprt->state) && xprt->snd_task == task) + return 1; spin_lock_bh(&xprt->transport_lock); retval = xprt->ops->reserve_xprt(xprt, task); spin_unlock_bh(&xprt->transport_lock); @@ -375,6 +377,8 @@ EXPORT_SYMBOL_GPL(xprt_release_xprt_cong); static inline void xprt_release_write(struct rpc_xprt *xprt, struct rpc_task *task) { + if (xprt->snd_task != task) + return; spin_lock_bh(&xprt->transport_lock); xprt->ops->release_xprt(xprt, task); spin_unlock_bh(&xprt->transport_lock); @@ -1645,8 +1649,7 @@ void xprt_release(struct rpc_task *task) if (req == NULL) { if (task->tk_client) { xprt = task->tk_xprt; - if (xprt->snd_task == task) - xprt_release_write(xprt, task); + xprt_release_write(xprt, task); } return; } |