umount hangs on sec=krb5,i,p mounts
Subsystems (3)
cover umount hangs on sec=krb5,i,p mounts
I've dug into this a little more. Posting these two patches just as conversation pieces.
The spinning NULL task at umount time, it turns out, is the kernel's attempt to send GSS DESTROY_CONTEXT. This NULL is triggered just as the RPC client has killed all tasks. The spinning rpc_task will run until a soft timeout occurs, and then the umount unhangs.
Maybe set a shutdown flag in the client, and cause early FSM steps to fail if this flag is set? Or should the client skip context destruction if this flag is set?
Any other thoughts?
---
Chuck Lever (2):
SUNRPC: Set SOFTCONN when destroying GSS contexts
sunrpc: Ensure signalled RPC tasks exit
--
Chuck Lever
PATCH 1/2 SUNRPC: Set SOFTCONN when destroying GSS contexts
Prevent a (temporary) hang when shutting down an rpc_clnt that has used one or more GSS creds.
I noticed that callers of rpc_call_null_helper() use a common set of flags, so I collected them all in that helper function.
--- net/sunrpc/auth_gss/auth_gss.c | 2 +- net/sunrpc/clnt.c | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +1 -1
@@ -1285,7 +1285,7 @@ static void gss_pipe_free(struct gss_pipe *p) ctx->gc_proc =RPC_GSS_PROC_DESTROY ; task =rpc_call_null (gss_auth->client, &new->gc_base, -RPC_TASK_ASYNC |RPC_TASK_SOFT ); +RPC_TASK_ASYNC );if (!IS_ERR (task))rpc_put_task (task);
net/sunrpc/clnt.c +4 -6
@@ -2742,7 +2742,8 @@ struct rpc_task *rpc_call_null_helper(struct rpc_clnt *clnt, .rpc_op_cred = cred, .callback_ops = (ops != NULL) ? ops : &rpc_default_ops, .callback_data = data, - .flags = flags | RPC_TASK_NULLCREDS, + .flags = flags | RPC_TASK_SOFT | RPC_TASK_SOFTCONN | + RPC_TASK_NULLCREDS, };return rpc_run_task (&task_setup_data);
@@ -2805,8 +2806,7 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt, goto success; } - task =rpc_call_null_helper (clnt, xprt,NULL , -RPC_TASK_SOFT |RPC_TASK_SOFTCONN |RPC_TASK_ASYNC |RPC_TASK_NULLCREDS , + task =rpc_call_null_helper (clnt, xprt,NULL ,RPC_TASK_ASYNC , &rpc_cb_add_xprt_call_ops, data);if (IS_ERR (task))return PTR_ERR (task);
@@ -2850,9 +2850,7 @@ int rpc_clnt_setup_test_and_add_xprt(struct rpc_clnt *clnt, goto out_err;/* Test the connection */ - task =rpc_call_null_helper (clnt, xprt,NULL , -RPC_TASK_SOFT |RPC_TASK_SOFTCONN |RPC_TASK_NULLCREDS , -NULL ,NULL ); + task =rpc_call_null_helper (clnt, xprt,NULL ,0 ,NULL ,NULL );if (IS_ERR (task)) { status =PTR_ERR (task); goto out_err;
PATCH 2/2 sunrpc: Ensure signalled RPC tasks exit
In reply to Chuck LeverIf an RPC task is signaled while it is running and the transport is not connected, it will never sleep and never be terminated. This can happen when a RPC transport is shut down: the remaining tasks are signalled, but the transport is disconnected.
--- include/linux/sunrpc/sched.h | 3 ++- net/sunrpc/sched.c | 14 ++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-)
include/linux/sunrpc/sched.h +2 -1
@@ -170,7 +170,8 @@ struct rpc_task_setup {#define RPC_IS_ACTIVATED (t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) -#define RPC_SIGNALLED (t) test_bit(RPC_TASK_SIGNALLED, &(t)->tk_runstate) +#define RPC_SIGNALLED (t) \ + unlikely(test_bit(RPC_TASK_SIGNALLED, &(t)->tk_runstate) != 0)/* * Task priorities.
net/sunrpc/sched.c +6 -8
@@ -912,6 +912,12 @@ static void __rpc_execute(struct rpc_task *task)trace_rpc_task_run_action (task, do_action);do_action (task); +if (RPC_SIGNALLED (task)) { + task->tk_rpc_status = -ERESTARTSYS ; +rpc_exit (task, -ERESTARTSYS ); +break ; + } +/* * Lockless check for whether task is sleeping or not. */
@@ -919,14 +925,6 @@ static void __rpc_execute(struct rpc_task *task)continue ;/* -* Signalled tasks should exit rather than sleep. -*/ -if (RPC_SIGNALLED (task)) { - task->tk_rpc_status = -ERESTARTSYS ; -rpc_exit (task, -ERESTARTSYS ); - } - -/* * The queue->lock protects against races with * rpc_make_runnable(). *