diff options
| -rw-r--r-- | include/linux/sunrpc/xprt.h | 1 | ||||
| -rw-r--r-- | net/sunrpc/xprt.c | 18 | ||||
| -rw-r--r-- | net/sunrpc/xprtsock.c | 7 |
3 files changed, 19 insertions, 7 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 009a3bb4f997..d5223993fca9 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
| @@ -232,6 +232,7 @@ void xprt_reserve(struct rpc_task *); | |||
| 232 | int xprt_prepare_transmit(struct rpc_task *); | 232 | int xprt_prepare_transmit(struct rpc_task *); |
| 233 | void xprt_transmit(struct rpc_task *); | 233 | void xprt_transmit(struct rpc_task *); |
| 234 | void xprt_receive(struct rpc_task *); | 234 | void xprt_receive(struct rpc_task *); |
| 235 | void xprt_wake_pending_tasks(struct rpc_xprt *, int); | ||
| 235 | int xprt_adjust_timeout(struct rpc_rqst *req); | 236 | int xprt_adjust_timeout(struct rpc_rqst *req); |
| 236 | void xprt_release(struct rpc_task *); | 237 | void xprt_release(struct rpc_task *); |
| 237 | void xprt_connect(struct rpc_task *); | 238 | void xprt_connect(struct rpc_task *); |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 57c5e77b155e..2f9cd468b953 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
| @@ -227,6 +227,20 @@ xprt_adjust_cwnd(struct rpc_xprt *xprt, int result) | |||
| 227 | xprt->cwnd = cwnd; | 227 | xprt->cwnd = cwnd; |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | /** | ||
| 231 | * xprt_wake_pending_tasks - wake all tasks on a transport's pending queue | ||
| 232 | * @xprt: transport with waiting tasks | ||
| 233 | * @status: result code to plant in each task before waking it | ||
| 234 | * | ||
| 235 | */ | ||
| 236 | void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status) | ||
| 237 | { | ||
| 238 | if (status < 0) | ||
| 239 | rpc_wake_up_status(&xprt->pending, status); | ||
| 240 | else | ||
| 241 | rpc_wake_up(&xprt->pending); | ||
| 242 | } | ||
| 243 | |||
| 230 | static void xprt_reset_majortimeo(struct rpc_rqst *req) | 244 | static void xprt_reset_majortimeo(struct rpc_rqst *req) |
| 231 | { | 245 | { |
| 232 | struct rpc_timeout *to = &req->rq_xprt->timeout; | 246 | struct rpc_timeout *to = &req->rq_xprt->timeout; |
| @@ -300,7 +314,7 @@ void xprt_disconnect(struct rpc_xprt *xprt) | |||
| 300 | dprintk("RPC: disconnected transport %p\n", xprt); | 314 | dprintk("RPC: disconnected transport %p\n", xprt); |
| 301 | spin_lock_bh(&xprt->transport_lock); | 315 | spin_lock_bh(&xprt->transport_lock); |
| 302 | xprt_clear_connected(xprt); | 316 | xprt_clear_connected(xprt); |
| 303 | rpc_wake_up_status(&xprt->pending, -ENOTCONN); | 317 | xprt_wake_pending_tasks(xprt, -ENOTCONN); |
| 304 | spin_unlock_bh(&xprt->transport_lock); | 318 | spin_unlock_bh(&xprt->transport_lock); |
| 305 | } | 319 | } |
| 306 | 320 | ||
| @@ -803,7 +817,7 @@ static void xprt_shutdown(struct rpc_xprt *xprt) | |||
| 803 | xprt->shutdown = 1; | 817 | xprt->shutdown = 1; |
| 804 | rpc_wake_up(&xprt->sending); | 818 | rpc_wake_up(&xprt->sending); |
| 805 | rpc_wake_up(&xprt->resend); | 819 | rpc_wake_up(&xprt->resend); |
| 806 | rpc_wake_up(&xprt->pending); | 820 | xprt_wake_pending_tasks(xprt, -EIO); |
| 807 | rpc_wake_up(&xprt->backlog); | 821 | rpc_wake_up(&xprt->backlog); |
| 808 | wake_up(&xprt->cong_wait); | 822 | wake_up(&xprt->cong_wait); |
| 809 | del_timer_sync(&xprt->timer); | 823 | del_timer_sync(&xprt->timer); |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 76a33b54f436..182da2edf61c 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
| @@ -703,7 +703,7 @@ static void xs_tcp_state_change(struct sock *sk) | |||
| 703 | xprt->tcp_reclen = 0; | 703 | xprt->tcp_reclen = 0; |
| 704 | xprt->tcp_copied = 0; | 704 | xprt->tcp_copied = 0; |
| 705 | xprt->tcp_flags = XPRT_COPY_RECM | XPRT_COPY_XID; | 705 | xprt->tcp_flags = XPRT_COPY_RECM | XPRT_COPY_XID; |
| 706 | rpc_wake_up(&xprt->pending); | 706 | xprt_wake_pending_tasks(xprt, 0); |
| 707 | } | 707 | } |
| 708 | spin_unlock_bh(&xprt->transport_lock); | 708 | spin_unlock_bh(&xprt->transport_lock); |
| 709 | break; | 709 | break; |
| @@ -920,10 +920,7 @@ static void xs_connect_worker(void *args) | |||
| 920 | } | 920 | } |
| 921 | } | 921 | } |
| 922 | out: | 922 | out: |
| 923 | if (status < 0) | 923 | xprt_wake_pending_tasks(xprt, status); |
| 924 | rpc_wake_up_status(&xprt->pending, status); | ||
| 925 | else | ||
| 926 | rpc_wake_up(&xprt->pending); | ||
| 927 | out_clear: | 924 | out_clear: |
| 928 | xprt_clear_connecting(xprt); | 925 | xprt_clear_connecting(xprt); |
| 929 | } | 926 | } |
