diff options
-rw-r--r-- | include/linux/sunrpc/clnt.h | 4 | ||||
-rw-r--r-- | include/linux/sunrpc/xprt.h | 3 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 12 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 11 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/transport.c | 2 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 11 |
6 files changed, 22 insertions, 21 deletions
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 4fc268ab6f3e..51a338189a23 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -46,6 +46,7 @@ struct rpc_clnt { | |||
46 | cl_autobind : 1;/* use getport() */ | 46 | cl_autobind : 1;/* use getport() */ |
47 | 47 | ||
48 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ | 48 | struct rpc_rtt * cl_rtt; /* RTO estimator data */ |
49 | const struct rpc_timeout *cl_timeout; /* Timeout strategy */ | ||
49 | 50 | ||
50 | int cl_nodelen; /* nodename length */ | 51 | int cl_nodelen; /* nodename length */ |
51 | char cl_nodename[UNX_MAXNODENAME]; | 52 | char cl_nodename[UNX_MAXNODENAME]; |
@@ -54,6 +55,7 @@ struct rpc_clnt { | |||
54 | struct dentry * cl_dentry; /* inode */ | 55 | struct dentry * cl_dentry; /* inode */ |
55 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ | 56 | struct rpc_clnt * cl_parent; /* Points to parent of clones */ |
56 | struct rpc_rtt cl_rtt_default; | 57 | struct rpc_rtt cl_rtt_default; |
58 | struct rpc_timeout cl_timeout_default; | ||
57 | struct rpc_program * cl_program; | 59 | struct rpc_program * cl_program; |
58 | char cl_inline_name[32]; | 60 | char cl_inline_name[32]; |
59 | }; | 61 | }; |
@@ -99,7 +101,7 @@ struct rpc_create_args { | |||
99 | struct sockaddr *address; | 101 | struct sockaddr *address; |
100 | size_t addrsize; | 102 | size_t addrsize; |
101 | struct sockaddr *saddress; | 103 | struct sockaddr *saddress; |
102 | struct rpc_timeout *timeout; | 104 | const struct rpc_timeout *timeout; |
103 | char *servername; | 105 | char *servername; |
104 | struct rpc_program *program; | 106 | struct rpc_program *program; |
105 | u32 version; | 107 | u32 version; |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index a00d4a4ba6ee..c3364d88d83e 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -120,7 +120,7 @@ struct rpc_xprt { | |||
120 | struct kref kref; /* Reference count */ | 120 | struct kref kref; /* Reference count */ |
121 | struct rpc_xprt_ops * ops; /* transport methods */ | 121 | struct rpc_xprt_ops * ops; /* transport methods */ |
122 | 122 | ||
123 | struct rpc_timeout timeout; /* timeout parms */ | 123 | const struct rpc_timeout *timeout; /* timeout parms */ |
124 | struct sockaddr_storage addr; /* server address */ | 124 | struct sockaddr_storage addr; /* server address */ |
125 | size_t addrlen; /* size of server address */ | 125 | size_t addrlen; /* size of server address */ |
126 | int prot; /* IP protocol */ | 126 | int prot; /* IP protocol */ |
@@ -191,7 +191,6 @@ struct xprt_create { | |||
191 | struct sockaddr * srcaddr; /* optional local address */ | 191 | struct sockaddr * srcaddr; /* optional local address */ |
192 | struct sockaddr * dstaddr; /* remote peer address */ | 192 | struct sockaddr * dstaddr; /* remote peer address */ |
193 | size_t addrlen; | 193 | size_t addrlen; |
194 | struct rpc_timeout * timeout; /* optional timeout parameters */ | ||
195 | }; | 194 | }; |
196 | 195 | ||
197 | struct xprt_class { | 196 | struct xprt_class { |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 6a6b96e8dcb2..a3c00da9ce21 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -188,8 +188,15 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
188 | if (!xprt_bound(clnt->cl_xprt)) | 188 | if (!xprt_bound(clnt->cl_xprt)) |
189 | clnt->cl_autobind = 1; | 189 | clnt->cl_autobind = 1; |
190 | 190 | ||
191 | clnt->cl_timeout = xprt->timeout; | ||
192 | if (args->timeout != NULL) { | ||
193 | memcpy(&clnt->cl_timeout_default, args->timeout, | ||
194 | sizeof(clnt->cl_timeout_default)); | ||
195 | clnt->cl_timeout = &clnt->cl_timeout_default; | ||
196 | } | ||
197 | |||
191 | clnt->cl_rtt = &clnt->cl_rtt_default; | 198 | clnt->cl_rtt = &clnt->cl_rtt_default; |
192 | rpc_init_rtt(&clnt->cl_rtt_default, xprt->timeout.to_initval); | 199 | rpc_init_rtt(&clnt->cl_rtt_default, clnt->cl_timeout->to_initval); |
193 | 200 | ||
194 | kref_init(&clnt->cl_kref); | 201 | kref_init(&clnt->cl_kref); |
195 | 202 | ||
@@ -251,7 +258,6 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
251 | .srcaddr = args->saddress, | 258 | .srcaddr = args->saddress, |
252 | .dstaddr = args->address, | 259 | .dstaddr = args->address, |
253 | .addrlen = args->addrsize, | 260 | .addrlen = args->addrsize, |
254 | .timeout = args->timeout | ||
255 | }; | 261 | }; |
256 | char servername[48]; | 262 | char servername[48]; |
257 | 263 | ||
@@ -348,7 +354,7 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
348 | new->cl_autobind = 0; | 354 | new->cl_autobind = 0; |
349 | INIT_LIST_HEAD(&new->cl_tasks); | 355 | INIT_LIST_HEAD(&new->cl_tasks); |
350 | spin_lock_init(&new->cl_lock); | 356 | spin_lock_init(&new->cl_lock); |
351 | rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); | 357 | rpc_init_rtt(&new->cl_rtt_default, clnt->cl_timeout->to_initval); |
352 | new->cl_metrics = rpc_alloc_iostats(clnt); | 358 | new->cl_metrics = rpc_alloc_iostats(clnt); |
353 | if (new->cl_metrics == NULL) | 359 | if (new->cl_metrics == NULL) |
354 | goto out_no_stats; | 360 | goto out_no_stats; |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 2bc99569c586..cfcade906a56 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -501,9 +501,10 @@ EXPORT_SYMBOL_GPL(xprt_set_retrans_timeout_def); | |||
501 | void xprt_set_retrans_timeout_rtt(struct rpc_task *task) | 501 | void xprt_set_retrans_timeout_rtt(struct rpc_task *task) |
502 | { | 502 | { |
503 | int timer = task->tk_msg.rpc_proc->p_timer; | 503 | int timer = task->tk_msg.rpc_proc->p_timer; |
504 | struct rpc_rtt *rtt = task->tk_client->cl_rtt; | 504 | struct rpc_clnt *clnt = task->tk_client; |
505 | struct rpc_rtt *rtt = clnt->cl_rtt; | ||
505 | struct rpc_rqst *req = task->tk_rqstp; | 506 | struct rpc_rqst *req = task->tk_rqstp; |
506 | unsigned long max_timeout = req->rq_xprt->timeout.to_maxval; | 507 | unsigned long max_timeout = clnt->cl_timeout->to_maxval; |
507 | 508 | ||
508 | task->tk_timeout = rpc_calc_rto(rtt, timer); | 509 | task->tk_timeout = rpc_calc_rto(rtt, timer); |
509 | task->tk_timeout <<= rpc_ntimeo(rtt, timer) + req->rq_retries; | 510 | task->tk_timeout <<= rpc_ntimeo(rtt, timer) + req->rq_retries; |
@@ -514,7 +515,7 @@ EXPORT_SYMBOL_GPL(xprt_set_retrans_timeout_rtt); | |||
514 | 515 | ||
515 | static void xprt_reset_majortimeo(struct rpc_rqst *req) | 516 | static void xprt_reset_majortimeo(struct rpc_rqst *req) |
516 | { | 517 | { |
517 | struct rpc_timeout *to = &req->rq_xprt->timeout; | 518 | const struct rpc_timeout *to = req->rq_task->tk_client->cl_timeout; |
518 | 519 | ||
519 | req->rq_majortimeo = req->rq_timeout; | 520 | req->rq_majortimeo = req->rq_timeout; |
520 | if (to->to_exponential) | 521 | if (to->to_exponential) |
@@ -534,7 +535,7 @@ static void xprt_reset_majortimeo(struct rpc_rqst *req) | |||
534 | int xprt_adjust_timeout(struct rpc_rqst *req) | 535 | int xprt_adjust_timeout(struct rpc_rqst *req) |
535 | { | 536 | { |
536 | struct rpc_xprt *xprt = req->rq_xprt; | 537 | struct rpc_xprt *xprt = req->rq_xprt; |
537 | struct rpc_timeout *to = &xprt->timeout; | 538 | const struct rpc_timeout *to = req->rq_task->tk_client->cl_timeout; |
538 | int status = 0; | 539 | int status = 0; |
539 | 540 | ||
540 | if (time_before(jiffies, req->rq_majortimeo)) { | 541 | if (time_before(jiffies, req->rq_majortimeo)) { |
@@ -928,7 +929,7 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) | |||
928 | { | 929 | { |
929 | struct rpc_rqst *req = task->tk_rqstp; | 930 | struct rpc_rqst *req = task->tk_rqstp; |
930 | 931 | ||
931 | req->rq_timeout = xprt->timeout.to_initval; | 932 | req->rq_timeout = task->tk_client->cl_timeout->to_initval; |
932 | req->rq_task = task; | 933 | req->rq_task = task; |
933 | req->rq_xprt = xprt; | 934 | req->rq_xprt = xprt; |
934 | req->rq_buffer = NULL; | 935 | req->rq_buffer = NULL; |
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 39f10016c86b..d1389afc8342 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c | |||
@@ -332,7 +332,7 @@ xprt_setup_rdma(struct xprt_create *args) | |||
332 | } | 332 | } |
333 | 333 | ||
334 | /* 60 second timeout, no retries */ | 334 | /* 60 second timeout, no retries */ |
335 | memcpy(&xprt->timeout, &xprt_rdma_default_timeout, sizeof(xprt->timeout)); | 335 | xprt->timeout = &xprt_rdma_default_timeout; |
336 | xprt->bind_timeout = (60U * HZ); | 336 | xprt->bind_timeout = (60U * HZ); |
337 | xprt->connect_timeout = (60U * HZ); | 337 | xprt->connect_timeout = (60U * HZ); |
338 | xprt->reestablish_timeout = (5U * HZ); | 338 | xprt->reestablish_timeout = (5U * HZ); |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index d7b07ac5b710..6ba329d339a2 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1912,7 +1912,6 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args) | |||
1912 | struct sockaddr *addr = args->dstaddr; | 1912 | struct sockaddr *addr = args->dstaddr; |
1913 | struct rpc_xprt *xprt; | 1913 | struct rpc_xprt *xprt; |
1914 | struct sock_xprt *transport; | 1914 | struct sock_xprt *transport; |
1915 | const struct rpc_timeout *timeo = &xs_udp_default_timeout; | ||
1916 | 1915 | ||
1917 | xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries); | 1916 | xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries); |
1918 | if (IS_ERR(xprt)) | 1917 | if (IS_ERR(xprt)) |
@@ -1931,9 +1930,7 @@ static struct rpc_xprt *xs_setup_udp(struct xprt_create *args) | |||
1931 | 1930 | ||
1932 | xprt->ops = &xs_udp_ops; | 1931 | xprt->ops = &xs_udp_ops; |
1933 | 1932 | ||
1934 | if (args->timeout != NULL) | 1933 | xprt->timeout = &xs_udp_default_timeout; |
1935 | timeo = args->timeout; | ||
1936 | memcpy(&xprt->timeout, timeo, sizeof(xprt->timeout)); | ||
1937 | 1934 | ||
1938 | switch (addr->sa_family) { | 1935 | switch (addr->sa_family) { |
1939 | case AF_INET: | 1936 | case AF_INET: |
@@ -1984,7 +1981,6 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args) | |||
1984 | struct sockaddr *addr = args->dstaddr; | 1981 | struct sockaddr *addr = args->dstaddr; |
1985 | struct rpc_xprt *xprt; | 1982 | struct rpc_xprt *xprt; |
1986 | struct sock_xprt *transport; | 1983 | struct sock_xprt *transport; |
1987 | const struct rpc_timeout *timeo = &xs_tcp_default_timeout; | ||
1988 | 1984 | ||
1989 | xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries); | 1985 | xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries); |
1990 | if (IS_ERR(xprt)) | 1986 | if (IS_ERR(xprt)) |
@@ -2001,10 +1997,7 @@ static struct rpc_xprt *xs_setup_tcp(struct xprt_create *args) | |||
2001 | xprt->idle_timeout = XS_IDLE_DISC_TO; | 1997 | xprt->idle_timeout = XS_IDLE_DISC_TO; |
2002 | 1998 | ||
2003 | xprt->ops = &xs_tcp_ops; | 1999 | xprt->ops = &xs_tcp_ops; |
2004 | 2000 | xprt->timeout = &xs_tcp_default_timeout; | |
2005 | if (args->timeout != NULL) | ||
2006 | timeo = args->timeout; | ||
2007 | memcpy(&xprt->timeout, timeo, sizeof(xprt->timeout)); | ||
2008 | 2001 | ||
2009 | switch (addr->sa_family) { | 2002 | switch (addr->sa_family) { |
2010 | case AF_INET: | 2003 | case AF_INET: |