diff options
Diffstat (limited to 'net')
-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) | |||
651 | } else { | 651 | } else { |
652 | if (pool->sp_task_pending) { | 652 | if (pool->sp_task_pending) { |
653 | pool->sp_task_pending = 0; | 653 | pool->sp_task_pending = 0; |
654 | spin_unlock_bh(&pool->sp_lock); | 654 | xprt = ERR_PTR(-EAGAIN); |
655 | return ERR_PTR(-EAGAIN); | 655 | goto out; |
656 | } | 656 | } |
657 | /* No data pending. Go to sleep */ | 657 | /* No data pending. Go to sleep */ |
658 | svc_thread_enqueue(pool, rqstp); | 658 | svc_thread_enqueue(pool, rqstp); |
@@ -672,8 +672,8 @@ static struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout) | |||
672 | */ | 672 | */ |
673 | if (kthread_should_stop()) { | 673 | if (kthread_should_stop()) { |
674 | set_current_state(TASK_RUNNING); | 674 | set_current_state(TASK_RUNNING); |
675 | spin_unlock_bh(&pool->sp_lock); | 675 | xprt = ERR_PTR(-EINTR); |
676 | return ERR_PTR(-EINTR); | 676 | goto out; |
677 | } | 677 | } |
678 | 678 | ||
679 | add_wait_queue(&rqstp->rq_wait, &wait); | 679 | 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) | |||
683 | 683 | ||
684 | try_to_freeze(); | 684 | try_to_freeze(); |
685 | 685 | ||
686 | spin_lock_bh(&pool->sp_lock); | ||
687 | remove_wait_queue(&rqstp->rq_wait, &wait); | 686 | remove_wait_queue(&rqstp->rq_wait, &wait); |
687 | xprt = rqstp->rq_xprt; | ||
688 | if (xprt != NULL) | ||
689 | return xprt; | ||
690 | |||
691 | spin_lock_bh(&pool->sp_lock); | ||
688 | if (!time_left) | 692 | if (!time_left) |
689 | pool->sp_stats.threads_timedout++; | 693 | pool->sp_stats.threads_timedout++; |
690 | 694 | ||
@@ -699,6 +703,7 @@ static struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout) | |||
699 | return ERR_PTR(-EAGAIN); | 703 | return ERR_PTR(-EAGAIN); |
700 | } | 704 | } |
701 | } | 705 | } |
706 | out: | ||
702 | spin_unlock_bh(&pool->sp_lock); | 707 | spin_unlock_bh(&pool->sp_lock); |
703 | return xprt; | 708 | return xprt; |
704 | } | 709 | } |