Commit eeee2452 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

SUNRPC: Fix a deadlock in rpc_client_register()

Commit 38481605

 (SUNRPC: fix races on
PipeFS MOUNT notifications) introduces a regression when we call
rpc_setup_pipedir() with RPCSEC_GSS as the auth flavour.

By calling rpcauth_create() while holding the sn->pipefs_sb_lock, we
end up deadlocking in gss_pipes_dentries_create_net().
Fix is to register the client and release the mutex before calling
Reported-by: default avatarWeston Andros Adamson <>
Tested-by: default avatarWeston Andros Adamson <>
Cc: Stanislav Kinsbursky <>
Cc: <> # : 38481605: SUNRPC: fix races on PipeFS MOUNT
Cc: <> # : e73f4cc0

: SUNRPC: split client creation
Signed-off-by: default avatarTrond Myklebust <>
parent 4f8568cb
......@@ -290,7 +290,7 @@ static int rpc_client_register(const struct rpc_create_args *args,
struct rpc_auth *auth;
struct net *net = rpc_net_ns(clnt);
struct super_block *pipefs_sb;
int err = 0;
int err;
pipefs_sb = rpc_get_sb_net(net);
if (pipefs_sb) {
......@@ -299,6 +299,10 @@ static int rpc_client_register(const struct rpc_create_args *args,
goto out;
if (pipefs_sb)
auth = rpcauth_create(args->authflavor, clnt);
if (IS_ERR(auth)) {
dprintk("RPC: Couldn't create auth handle (flavor %u)\n",
......@@ -306,16 +310,14 @@ static int rpc_client_register(const struct rpc_create_args *args,
err = PTR_ERR(auth);
goto err_auth;
return 0;
pipefs_sb = rpc_get_sb_net(net);
if (pipefs_sb)
return err;
goto out;
static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, struct rpc_xprt *xprt)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment