diff options
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index cb49898a5a58..7f79fb7dc6a0 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -2638,6 +2638,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, | |||
2638 | { | 2638 | { |
2639 | struct rpc_xprt_switch *xps; | 2639 | struct rpc_xprt_switch *xps; |
2640 | struct rpc_xprt *xprt; | 2640 | struct rpc_xprt *xprt; |
2641 | unsigned long reconnect_timeout; | ||
2641 | unsigned char resvport; | 2642 | unsigned char resvport; |
2642 | int ret = 0; | 2643 | int ret = 0; |
2643 | 2644 | ||
@@ -2649,6 +2650,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, | |||
2649 | return -EAGAIN; | 2650 | return -EAGAIN; |
2650 | } | 2651 | } |
2651 | resvport = xprt->resvport; | 2652 | resvport = xprt->resvport; |
2653 | reconnect_timeout = xprt->max_reconnect_timeout; | ||
2652 | rcu_read_unlock(); | 2654 | rcu_read_unlock(); |
2653 | 2655 | ||
2654 | xprt = xprt_create_transport(xprtargs); | 2656 | xprt = xprt_create_transport(xprtargs); |
@@ -2657,6 +2659,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, | |||
2657 | goto out_put_switch; | 2659 | goto out_put_switch; |
2658 | } | 2660 | } |
2659 | xprt->resvport = resvport; | 2661 | xprt->resvport = resvport; |
2662 | xprt->max_reconnect_timeout = reconnect_timeout; | ||
2660 | 2663 | ||
2661 | rpc_xprt_switch_set_roundrobin(xps); | 2664 | rpc_xprt_switch_set_roundrobin(xps); |
2662 | if (setup) { | 2665 | if (setup) { |
@@ -2673,6 +2676,27 @@ out_put_switch: | |||
2673 | } | 2676 | } |
2674 | EXPORT_SYMBOL_GPL(rpc_clnt_add_xprt); | 2677 | EXPORT_SYMBOL_GPL(rpc_clnt_add_xprt); |
2675 | 2678 | ||
2679 | static int | ||
2680 | rpc_xprt_cap_max_reconnect_timeout(struct rpc_clnt *clnt, | ||
2681 | struct rpc_xprt *xprt, | ||
2682 | void *data) | ||
2683 | { | ||
2684 | unsigned long timeout = *((unsigned long *)data); | ||
2685 | |||
2686 | if (timeout < xprt->max_reconnect_timeout) | ||
2687 | xprt->max_reconnect_timeout = timeout; | ||
2688 | return 0; | ||
2689 | } | ||
2690 | |||
2691 | void | ||
2692 | rpc_cap_max_reconnect_timeout(struct rpc_clnt *clnt, unsigned long timeo) | ||
2693 | { | ||
2694 | rpc_clnt_iterate_for_each_xprt(clnt, | ||
2695 | rpc_xprt_cap_max_reconnect_timeout, | ||
2696 | &timeo); | ||
2697 | } | ||
2698 | EXPORT_SYMBOL_GPL(rpc_cap_max_reconnect_timeout); | ||
2699 | |||
2676 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) | 2700 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
2677 | static void rpc_show_header(void) | 2701 | static void rpc_show_header(void) |
2678 | { | 2702 | { |