diff options
author | Benjamin Coddington <bcodding@redhat.com> | 2014-09-23 12:26:19 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-09-24 23:06:56 -0400 |
commit | a743419f420a64d442280845c0377a915b76644f (patch) | |
tree | 76ba4188ac3dd3476ef44648fabebcf1ca6febfe | |
parent | 8faaa6d5d48b201527e0451296d9e71d23afb362 (diff) |
SUNRPC: Don't wake tasks during connection abort
When aborting a connection to preserve source ports, don't wake the task in
xs_error_report. This allows tasks with RPC_TASK_SOFTCONN to succeed if the
connection needs to be re-established since it preserves the task's status
instead of setting it to the status of the aborting kernel_connect().
This may also avoid a potential conflict on the socket's lock.
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Cc: stable@vger.kernel.org # 3.14+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r-- | include/linux/sunrpc/xprt.h | 1 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index fcbfe8783243..cf391eef2e6d 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -357,6 +357,7 @@ int xs_swapper(struct rpc_xprt *xprt, int enable); | |||
357 | #define XPRT_CONNECTION_ABORT (7) | 357 | #define XPRT_CONNECTION_ABORT (7) |
358 | #define XPRT_CONNECTION_CLOSE (8) | 358 | #define XPRT_CONNECTION_CLOSE (8) |
359 | #define XPRT_CONGESTED (9) | 359 | #define XPRT_CONGESTED (9) |
360 | #define XPRT_CONNECTION_REUSE (10) | ||
360 | 361 | ||
361 | static inline void xprt_set_connected(struct rpc_xprt *xprt) | 362 | static inline void xprt_set_connected(struct rpc_xprt *xprt) |
362 | { | 363 | { |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 7ed47b4943da..bffba4e4bfc6 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -845,6 +845,8 @@ static void xs_error_report(struct sock *sk) | |||
845 | dprintk("RPC: xs_error_report client %p, error=%d...\n", | 845 | dprintk("RPC: xs_error_report client %p, error=%d...\n", |
846 | xprt, -err); | 846 | xprt, -err); |
847 | trace_rpc_socket_error(xprt, sk->sk_socket, err); | 847 | trace_rpc_socket_error(xprt, sk->sk_socket, err); |
848 | if (test_bit(XPRT_CONNECTION_REUSE, &xprt->state)) | ||
849 | goto out; | ||
848 | xprt_wake_pending_tasks(xprt, err); | 850 | xprt_wake_pending_tasks(xprt, err); |
849 | out: | 851 | out: |
850 | read_unlock_bh(&sk->sk_callback_lock); | 852 | read_unlock_bh(&sk->sk_callback_lock); |
@@ -2261,7 +2263,9 @@ static void xs_tcp_setup_socket(struct work_struct *work) | |||
2261 | abort_and_exit = test_and_clear_bit(XPRT_CONNECTION_ABORT, | 2263 | abort_and_exit = test_and_clear_bit(XPRT_CONNECTION_ABORT, |
2262 | &xprt->state); | 2264 | &xprt->state); |
2263 | /* "close" the socket, preserving the local port */ | 2265 | /* "close" the socket, preserving the local port */ |
2266 | set_bit(XPRT_CONNECTION_REUSE, &xprt->state); | ||
2264 | xs_tcp_reuse_connection(transport); | 2267 | xs_tcp_reuse_connection(transport); |
2268 | clear_bit(XPRT_CONNECTION_REUSE, &xprt->state); | ||
2265 | 2269 | ||
2266 | if (abort_and_exit) | 2270 | if (abort_and_exit) |
2267 | goto out_eagain; | 2271 | goto out_eagain; |