SUNRPC: increase max timeout for rebind to handle NFS server restart
Subsystems (3)
Dai Ngo
reviewerRFC PATCH 1/1 SUNRPC: increase max timeout for rebind to handle NFS server restart
Occasionally NLM lock and unlock request fail with EIO and ENOLCK respectively. This usually happens when the NFS server is restarted while NLM lock test is running.
Currently there is a 9 seconds limit for retrying the bind operation. If the server is under load the port mapper might take more than 9 seconds to become ready after the NFS server restarted.
This patch increases the timeout for rebind from 9 to 30 seconds allowing a bit more time for the port mapper to become ready.
--- include/linux/sunrpc/clnt.h | 3 +++ include/linux/sunrpc/sched.h | 4 ++-- net/sunrpc/clnt.c | 2 +- net/sunrpc/sched.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-)
include/linux/sunrpc/clnt.h +3 -0
@@ -162,6 +162,9 @@ struct rpc_add_xprt_test {#define RPC_CLNT_CREATE_REUSEPORT (1UL << 11)#define RPC_CLNT_CREATE_CONNECTED (1UL << 12) +#define RPC_CLNT_REBIND_DELAY 3 +#define RPC_CLNT_REBIND_MAX_TIMEOUT 30 +struct rpc_clnt *rpc_create (struct rpc_create_args *args);struct rpc_clnt *rpc_bind_new_program (struct rpc_clnt *,const struct rpc_program *,u32 );
include/linux/sunrpc/sched.h +2 -2
@@ -90,8 +90,8 @@ struct rpc_task {#endif unsigned char tk_priority : 2,/* Task priority */ tk_garb_retry : 2, - tk_cred_retry : 2, - tk_rebind_retry : 2; + tk_cred_retry : 2; +unsigned char tk_rebind_retry; };typedef void (*rpc_action )(struct rpc_task *);
net/sunrpc/clnt.c +1 -1
@@ -2053,7 +2053,7 @@ call_bind_status(struct rpc_task *task)if (task->tk_rebind_retry ==0 )break ; task->tk_rebind_retry--; -rpc_delay (task,3 *HZ ); +rpc_delay (task,RPC_CLNT_REBIND_DELAY *HZ ); goto retry_timeout;case -ENOBUFS :rpc_delay (task,HZ >>2 );
net/sunrpc/sched.c +2 -1
@@ -817,7 +817,8 @@ rpc_init_task_statistics(struct rpc_task *task)/* Initialize retry counters */ task->tk_garb_retry =2 ; task->tk_cred_retry =2 ; - task->tk_rebind_retry =2 ; + task->tk_rebind_retry =RPC_CLNT_REBIND_MAX_TIMEOUT / +RPC_CLNT_REBIND_DELAY ;/* starting timestamp */ task->tk_start =ktime_get ();
Signature · 1 line
2.9.5
[email protected]
reviewerHi Trond,
Could you please let me know your opinion on this patch?
Thanks,
-Dai
Quoted 75 lines · Dai Ngo
Occasionally NLM lock and unlock request fail with EIO and ENOLCK respectively. This usually happens when the NFS server is restarted while NLM lock test is running.
Currently there is a 9 seconds limit for retrying the bind operation. If the server is under load the port mapper might take more than 9 seconds to become ready after the NFS server restarted.
This patch increases the timeout for rebind from 9 to 30 seconds allowing a bit more time for the port mapper to become ready.
Signed-off-by Dai Ngo <[email protected]>--- include/linux/sunrpc/clnt.h | 3 +++ include/linux/sunrpc/sched.h | 4 ++-- net/sunrpc/clnt.c | 2 +- net/sunrpc/sched.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-)include/linux/sunrpc/clnt.h +3
-0@@ -162,6 +162,9 @@ struct rpc_add_xprt_test {#define RPC_CLNT_CREATE_REUSEPORT (1UL << 11)#define RPC_CLNT_CREATE_CONNECTED (1UL << 12) +#define RPC_CLNT_REBIND_DELAY 3 +#define RPC_CLNT_REBIND_MAX_TIMEOUT 30 +struct rpc_clnt *rpc_create (struct rpc_create_args *args);struct rpc_clnt *rpc_bind_new_program (struct rpc_clnt *,const struct rpc_program *,u32 );include/linux/sunrpc/sched.h +2
-2@@ -90,8 +90,8 @@ struct rpc_task {#endif unsigned char tk_priority : 2,/* Task priority */ tk_garb_retry : 2, - tk_cred_retry : 2, - tk_rebind_retry : 2; + tk_cred_retry : 2; +unsigned char tk_rebind_retry; };typedef void (*rpc_action )(struct rpc_task *);net/sunrpc/clnt.c +1
-1@@ -2053,7 +2053,7 @@ call_bind_status(struct rpc_task *task)if (task->tk_rebind_retry ==0 )break ; task->tk_rebind_retry--; -rpc_delay (task,3 *HZ ); +rpc_delay (task,RPC_CLNT_REBIND_DELAY *HZ ); goto retry_timeout;case -ENOBUFS :rpc_delay (task,HZ >>2 );net/sunrpc/sched.c +2
-1@@ -817,7 +817,8 @@ rpc_init_task_statistics(struct rpc_task *task)/* Initialize retry counters */ task->tk_garb_retry =2 ; task->tk_cred_retry =2 ; - task->tk_rebind_retry =2 ; + task->tk_rebind_retry =RPC_CLNT_REBIND_MAX_TIMEOUT / +RPC_CLNT_REBIND_DELAY ;/* starting timestamp */ task->tk_start =ktime_get ();
[email protected]
reviewerHi Anna,
Just a reminder that this patch is still waiting for a review.
Thanks,
-Dai
Quoted 80 lines · On 2/17/23 10:22 AM, [email protected] wrote:
Hi Trond,
Could you please let me know your opinion on this patch?
Thanks,
-DaiQuoted 72 lines · Dai Ngo
Occasionally NLM lock and unlock request fail with EIO and ENOLCK respectively. This usually happens when the NFS server is restarted while NLM lock test is running.
Currently there is a 9 seconds limit for retrying the bind operation. If the server is under load the port mapper might take more than 9 seconds to become ready after the NFS server restarted.
This patch increases the timeout for rebind from 9 to 30 seconds allowing a bit more time for the port mapper to become ready.
Signed-off-by Dai Ngo <[email protected]>---
include/linux/sunrpc/clnt.h | 3 +++
include/linux/sunrpc/sched.h| 4 ++--
net/sunrpc/clnt.c | 2 +-
net/sunrpc/sched.c | 3 ++-4 files changed, 8 insertions(+), 4 deletions(-)include/linux/sunrpc/clnt.h +0
-0@@ -162,6 +162,9 @@ struct rpc_add_xprt_test { #define RPC_CLNT_CREATE_REUSEPORT (1UL << 11) #define RPC_CLNT_CREATE_CONNECTED (1UL << 12)+#define RPC_CLNT_REBIND_DELAY 3
include/linux/sunrpc/clnt.h +2
-0+#define RPC_CLNT_REBIND_MAX_TIMEOUT 30 +struct
rpc_clnt*rpc_create(structrpc_create_args*args); struct rpc_clnt *rpc_bind_new_program(structrpc_clnt*, const structrpc_program*, u32);include/linux/sunrpc/sched.h +0
-0@@ -90,8 +90,8 @@ struct rpc_task { #endifunsigned char
tk_priority: 2,/* Task priority */tk_garb_retry: 2,
-tk_cred_retry: 2,
-tk_rebind_retry: 2;
+tk_cred_retry: 2;
+ unsigned chartk_rebind_retry;
};
typedef void (*rpc_action)(structrpc_task*);net/sunrpc/clnt.c +1
-1@@ -2053,7 +2053,7 @@ call_bind_status(struct rpc_task *task) if (task->tk_rebind_retry == 0) break; task->tk_rebind_retry--; - rpc_delay(task, 3*HZ); + rpc_delay(task, RPC_CLNT_REBIND_DELAY * HZ); goto retry_timeout;case
-ENOBUFS:
rpc_delay(task, HZ >> 2);net/sunrpc/sched.c +2
-1@@ -817,7 +817,8 @@ rpc_init_task_statistics(struct rpc_task *task) /* Initialize retry counters */ task->tk_garb_retry = 2; task->tk_cred_retry = 2; - task->tk_rebind_retry = 2; + task->tk_rebind_retry = RPC_CLNT_REBIND_MAX_TIMEOUT / + RPC_CLNT_REBIND_DELAY; /* starting timestamp */ task->tk_start = ktime_get();