diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-08-03 19:03:09 +0200 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-08-17 18:00:10 +0200 |
commit | 106f359cf4d613ebf54cb9f29721bb956fc3460e (patch) | |
tree | 74e198068416690834bd4b598c3197575e52c2d6 /net/sunrpc/svc_xprt.c | |
parent | nfs: Ensure that nfs_callback_start_svc sets the server rq_task... (diff) | |
download | linux-106f359cf4d613ebf54cb9f29721bb956fc3460e.tar.xz linux-106f359cf4d613ebf54cb9f29721bb956fc3460e.zip |
SUNRPC: Do not grab pool->sp_lock unnecessarily in svc_get_next_xprt
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/svc_xprt.c')
-rw-r--r-- | net/sunrpc/svc_xprt.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 08e48cecfdcc..08e49d1e17b3 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -651,8 +651,8 @@ static struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout) } else { if (pool->sp_task_pending) { pool->sp_task_pending = 0; - spin_unlock_bh(&pool->sp_lock); - return ERR_PTR(-EAGAIN); + xprt = ERR_PTR(-EAGAIN); + goto out; } /* No data pending. Go to sleep */ svc_thread_enqueue(pool, rqstp); @@ -672,8 +672,8 @@ static struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout) */ if (kthread_should_stop()) { set_current_state(TASK_RUNNING); - spin_unlock_bh(&pool->sp_lock); - return ERR_PTR(-EINTR); + xprt = ERR_PTR(-EINTR); + goto out; } add_wait_queue(&rqstp->rq_wait, &wait); @@ -683,8 +683,12 @@ static struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout) try_to_freeze(); - spin_lock_bh(&pool->sp_lock); remove_wait_queue(&rqstp->rq_wait, &wait); + xprt = rqstp->rq_xprt; + if (xprt != NULL) + return xprt; + + spin_lock_bh(&pool->sp_lock); if (!time_left) pool->sp_stats.threads_timedout++; @@ -699,6 +703,7 @@ static struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout) return ERR_PTR(-EAGAIN); } } +out: spin_unlock_bh(&pool->sp_lock); return xprt; } |