diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2019-06-19 10:33:42 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2019-07-09 10:30:25 -0400 |
commit | 675dd90ad0932f2c03912a5252458d792bd7033a (patch) | |
tree | cfd637f2913a11b2ff2c71669fcbf7bb6250a6ee /net/sunrpc/xprtsock.c | |
parent | 5828cebad1c8d535f3c194439e394e92a2273fb2 (diff) |
xprtrdma: Modernize ops->connect
Adapt and apply changes that were made to the TCP socket connect
code. See the following commits for details on the purpose of
these changes:
Commit 7196dbb02ea0 ("SUNRPC: Allow changing of the TCP timeout parameters on the fly")
Commit 3851f1cdb2b8 ("SUNRPC: Limit the reconnect backoff timer to the max RPC message timeout")
Commit 02910177aede ("SUNRPC: Fix reconnection timeouts")
Some common transport code is moved to xprt.c to satisfy the code
duplication police.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index c69951ed2ebc..b154600085d6 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -2402,25 +2402,6 @@ out: | |||
2402 | xprt_wake_pending_tasks(xprt, status); | 2402 | xprt_wake_pending_tasks(xprt, status); |
2403 | } | 2403 | } |
2404 | 2404 | ||
2405 | static unsigned long xs_reconnect_delay(const struct rpc_xprt *xprt) | ||
2406 | { | ||
2407 | unsigned long start, now = jiffies; | ||
2408 | |||
2409 | start = xprt->stat.connect_start + xprt->reestablish_timeout; | ||
2410 | if (time_after(start, now)) | ||
2411 | return start - now; | ||
2412 | return 0; | ||
2413 | } | ||
2414 | |||
2415 | static void xs_reconnect_backoff(struct rpc_xprt *xprt) | ||
2416 | { | ||
2417 | xprt->reestablish_timeout <<= 1; | ||
2418 | if (xprt->reestablish_timeout > xprt->max_reconnect_timeout) | ||
2419 | xprt->reestablish_timeout = xprt->max_reconnect_timeout; | ||
2420 | if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO) | ||
2421 | xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; | ||
2422 | } | ||
2423 | |||
2424 | /** | 2405 | /** |
2425 | * xs_connect - connect a socket to a remote endpoint | 2406 | * xs_connect - connect a socket to a remote endpoint |
2426 | * @xprt: pointer to transport structure | 2407 | * @xprt: pointer to transport structure |
@@ -2450,8 +2431,8 @@ static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task) | |||
2450 | /* Start by resetting any existing state */ | 2431 | /* Start by resetting any existing state */ |
2451 | xs_reset_transport(transport); | 2432 | xs_reset_transport(transport); |
2452 | 2433 | ||
2453 | delay = xs_reconnect_delay(xprt); | 2434 | delay = xprt_reconnect_delay(xprt); |
2454 | xs_reconnect_backoff(xprt); | 2435 | xprt_reconnect_backoff(xprt, XS_TCP_INIT_REEST_TO); |
2455 | 2436 | ||
2456 | } else | 2437 | } else |
2457 | dprintk("RPC: xs_connect scheduled xprt %p\n", xprt); | 2438 | dprintk("RPC: xs_connect scheduled xprt %p\n", xprt); |