diff options
author | J. Bruce Fields <bfields@redhat.com> | 2016-05-16 17:03:42 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2016-06-15 10:32:25 -0400 |
commit | d50039ea5ee63c589b0434baa5ecf6e5075bb6f9 (patch) | |
tree | 3f93ee65837cdd026d59c7b97ab5156a8aa08745 | |
parent | 1208fd569c07ab84aa5d024abd863267c2953b4a (diff) |
nfsd4/rpc: move backchannel create logic into rpc code
Also simplify the logic a bit.
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: Trond Myklebust <trondmy@primarydata.com>
-rw-r--r-- | fs/nfsd/nfs4callback.c | 18 | ||||
-rw-r--r-- | include/linux/sunrpc/clnt.h | 2 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 12 |
3 files changed, 11 insertions, 21 deletions
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 7389cb1d7409..04c68d900324 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -710,22 +710,6 @@ static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc | |||
710 | } | 710 | } |
711 | } | 711 | } |
712 | 712 | ||
713 | static struct rpc_clnt *create_backchannel_client(struct rpc_create_args *args) | ||
714 | { | ||
715 | struct rpc_xprt *xprt; | ||
716 | |||
717 | if (args->protocol != XPRT_TRANSPORT_BC_TCP) | ||
718 | return rpc_create(args); | ||
719 | |||
720 | xprt = args->bc_xprt->xpt_bc_xprt; | ||
721 | if (xprt) { | ||
722 | xprt_get(xprt); | ||
723 | return rpc_create_xprt(args, xprt); | ||
724 | } | ||
725 | |||
726 | return rpc_create(args); | ||
727 | } | ||
728 | |||
729 | static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses) | 713 | static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses) |
730 | { | 714 | { |
731 | int maxtime = max_cb_time(clp->net); | 715 | int maxtime = max_cb_time(clp->net); |
@@ -768,7 +752,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c | |||
768 | args.authflavor = ses->se_cb_sec.flavor; | 752 | args.authflavor = ses->se_cb_sec.flavor; |
769 | } | 753 | } |
770 | /* Create RPC client */ | 754 | /* Create RPC client */ |
771 | client = create_backchannel_client(&args); | 755 | client = rpc_create(&args); |
772 | if (IS_ERR(client)) { | 756 | if (IS_ERR(client)) { |
773 | dprintk("NFSD: couldn't create callback client: %ld\n", | 757 | dprintk("NFSD: couldn't create callback client: %ld\n", |
774 | PTR_ERR(client)); | 758 | PTR_ERR(client)); |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 19c659d1c0f8..b6810c92b8bb 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -137,8 +137,6 @@ struct rpc_create_args { | |||
137 | #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) | 137 | #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) |
138 | 138 | ||
139 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); | 139 | struct rpc_clnt *rpc_create(struct rpc_create_args *args); |
140 | struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, | ||
141 | struct rpc_xprt *xprt); | ||
142 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, | 140 | struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, |
143 | const struct rpc_program *, u32); | 141 | const struct rpc_program *, u32); |
144 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); | 142 | struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 173c5dd2d751..b33721d41adc 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -446,7 +446,7 @@ out_no_rpciod: | |||
446 | return ERR_PTR(err); | 446 | return ERR_PTR(err); |
447 | } | 447 | } |
448 | 448 | ||
449 | struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, | 449 | static struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, |
450 | struct rpc_xprt *xprt) | 450 | struct rpc_xprt *xprt) |
451 | { | 451 | { |
452 | struct rpc_clnt *clnt = NULL; | 452 | struct rpc_clnt *clnt = NULL; |
@@ -484,7 +484,6 @@ struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, | |||
484 | 484 | ||
485 | return clnt; | 485 | return clnt; |
486 | } | 486 | } |
487 | EXPORT_SYMBOL_GPL(rpc_create_xprt); | ||
488 | 487 | ||
489 | /** | 488 | /** |
490 | * rpc_create - create an RPC client and transport with one call | 489 | * rpc_create - create an RPC client and transport with one call |
@@ -510,6 +509,15 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
510 | }; | 509 | }; |
511 | char servername[48]; | 510 | char servername[48]; |
512 | 511 | ||
512 | if (args->bc_xprt) { | ||
513 | WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP); | ||
514 | xprt = args->bc_xprt->xpt_bc_xprt; | ||
515 | if (xprt) { | ||
516 | xprt_get(xprt); | ||
517 | return rpc_create_xprt(args, xprt); | ||
518 | } | ||
519 | } | ||
520 | |||
513 | if (args->flags & RPC_CLNT_CREATE_INFINITE_SLOTS) | 521 | if (args->flags & RPC_CLNT_CREATE_INFINITE_SLOTS) |
514 | xprtargs.flags |= XPRT_CREATE_INFINITE_SLOTS; | 522 | xprtargs.flags |= XPRT_CREATE_INFINITE_SLOTS; |
515 | if (args->flags & RPC_CLNT_CREATE_NO_IDLE_TIMEOUT) | 523 | if (args->flags & RPC_CLNT_CREATE_NO_IDLE_TIMEOUT) |