diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-04-16 16:41:57 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-05-14 15:09:29 -0400 |
commit | 0b9e79431377df452348e78262dd5a3dc359eeef (patch) | |
tree | 0a69324b177e2db40e88988b83e0782dd9d98990 /net | |
parent | 19445b99b6d66af661c586c052de23110731a502 (diff) |
SUNRPC: Move the test for XPRT_CONNECTING into xprt_connect()
This fixes a bug with setting xprt->stat.connect_start.
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/xprt.c | 6 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/transport.c | 28 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 15 |
3 files changed, 19 insertions, 30 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 18415cc37c01..c71d835165e2 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -712,10 +712,14 @@ void xprt_connect(struct rpc_task *task) | |||
712 | 712 | ||
713 | task->tk_timeout = xprt->connect_timeout; | 713 | task->tk_timeout = xprt->connect_timeout; |
714 | rpc_sleep_on(&xprt->pending, task, xprt_connect_status); | 714 | rpc_sleep_on(&xprt->pending, task, xprt_connect_status); |
715 | |||
716 | if (test_bit(XPRT_CLOSING, &xprt->state)) | ||
717 | return; | ||
718 | if (xprt_test_and_set_connecting(xprt)) | ||
719 | return; | ||
715 | xprt->stat.connect_start = jiffies; | 720 | xprt->stat.connect_start = jiffies; |
716 | xprt->ops->connect(task); | 721 | xprt->ops->connect(task); |
717 | } | 722 | } |
718 | return; | ||
719 | } | 723 | } |
720 | 724 | ||
721 | static void xprt_connect_status(struct rpc_task *task) | 725 | static void xprt_connect_status(struct rpc_task *task) |
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 187257b1d880..0607b9aaae91 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c | |||
@@ -449,21 +449,19 @@ xprt_rdma_connect(struct rpc_task *task) | |||
449 | struct rpc_xprt *xprt = (struct rpc_xprt *)task->tk_xprt; | 449 | struct rpc_xprt *xprt = (struct rpc_xprt *)task->tk_xprt; |
450 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); | 450 | struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); |
451 | 451 | ||
452 | if (!xprt_test_and_set_connecting(xprt)) { | 452 | if (r_xprt->rx_ep.rep_connected != 0) { |
453 | if (r_xprt->rx_ep.rep_connected != 0) { | 453 | /* Reconnect */ |
454 | /* Reconnect */ | 454 | schedule_delayed_work(&r_xprt->rdma_connect, |
455 | schedule_delayed_work(&r_xprt->rdma_connect, | 455 | xprt->reestablish_timeout); |
456 | xprt->reestablish_timeout); | 456 | xprt->reestablish_timeout <<= 1; |
457 | xprt->reestablish_timeout <<= 1; | 457 | if (xprt->reestablish_timeout > (30 * HZ)) |
458 | if (xprt->reestablish_timeout > (30 * HZ)) | 458 | xprt->reestablish_timeout = (30 * HZ); |
459 | xprt->reestablish_timeout = (30 * HZ); | 459 | else if (xprt->reestablish_timeout < (5 * HZ)) |
460 | else if (xprt->reestablish_timeout < (5 * HZ)) | 460 | xprt->reestablish_timeout = (5 * HZ); |
461 | xprt->reestablish_timeout = (5 * HZ); | 461 | } else { |
462 | } else { | 462 | schedule_delayed_work(&r_xprt->rdma_connect, 0); |
463 | schedule_delayed_work(&r_xprt->rdma_connect, 0); | 463 | if (!RPC_IS_ASYNC(task)) |
464 | if (!RPC_IS_ASYNC(task)) | 464 | flush_scheduled_work(); |
465 | flush_scheduled_work(); | ||
466 | } | ||
467 | } | 465 | } |
468 | } | 466 | } |
469 | 467 | ||
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 9847c30b5001..d138afa3bb35 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -2016,9 +2016,6 @@ static void xs_connect(struct rpc_task *task) | |||
2016 | struct rpc_xprt *xprt = task->tk_xprt; | 2016 | struct rpc_xprt *xprt = task->tk_xprt; |
2017 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); | 2017 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); |
2018 | 2018 | ||
2019 | if (xprt_test_and_set_connecting(xprt)) | ||
2020 | return; | ||
2021 | |||
2022 | if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) { | 2019 | if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) { |
2023 | dprintk("RPC: xs_connect delayed xprt %p for %lu " | 2020 | dprintk("RPC: xs_connect delayed xprt %p for %lu " |
2024 | "seconds\n", | 2021 | "seconds\n", |
@@ -2038,16 +2035,6 @@ static void xs_connect(struct rpc_task *task) | |||
2038 | } | 2035 | } |
2039 | } | 2036 | } |
2040 | 2037 | ||
2041 | static void xs_tcp_connect(struct rpc_task *task) | ||
2042 | { | ||
2043 | struct rpc_xprt *xprt = task->tk_xprt; | ||
2044 | |||
2045 | /* Exit if we need to wait for socket shutdown to complete */ | ||
2046 | if (test_bit(XPRT_CLOSING, &xprt->state)) | ||
2047 | return; | ||
2048 | xs_connect(task); | ||
2049 | } | ||
2050 | |||
2051 | /** | 2038 | /** |
2052 | * xs_udp_print_stats - display UDP socket-specifc stats | 2039 | * xs_udp_print_stats - display UDP socket-specifc stats |
2053 | * @xprt: rpc_xprt struct containing statistics | 2040 | * @xprt: rpc_xprt struct containing statistics |
@@ -2246,7 +2233,7 @@ static struct rpc_xprt_ops xs_tcp_ops = { | |||
2246 | .release_xprt = xs_tcp_release_xprt, | 2233 | .release_xprt = xs_tcp_release_xprt, |
2247 | .rpcbind = rpcb_getport_async, | 2234 | .rpcbind = rpcb_getport_async, |
2248 | .set_port = xs_set_port, | 2235 | .set_port = xs_set_port, |
2249 | .connect = xs_tcp_connect, | 2236 | .connect = xs_connect, |
2250 | .buf_alloc = rpc_malloc, | 2237 | .buf_alloc = rpc_malloc, |
2251 | .buf_free = rpc_free, | 2238 | .buf_free = rpc_free, |
2252 | .send_request = xs_tcp_send_request, | 2239 | .send_request = xs_tcp_send_request, |