Skip to content

Commit d50039e

Browse files
author
J. Bruce Fields
committed
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>
1 parent 1208fd5 commit d50039e

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

fs/nfsd/nfs4callback.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -710,22 +710,6 @@ static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc
710710
}
711711
}
712712

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-
729713
static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses)
730714
{
731715
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
768752
args.authflavor = ses->se_cb_sec.flavor;
769753
}
770754
/* Create RPC client */
771-
client = create_backchannel_client(&args);
755+
client = rpc_create(&args);
772756
if (IS_ERR(client)) {
773757
dprintk("NFSD: couldn't create callback client: %ld\n",
774758
PTR_ERR(client));

include/linux/sunrpc/clnt.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ struct rpc_create_args {
137137
#define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9)
138138

139139
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);
142140
struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
143141
const struct rpc_program *, u32);
144142
struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);

net/sunrpc/clnt.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args,
446446
return ERR_PTR(err);
447447
}
448448

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,
450450
struct rpc_xprt *xprt)
451451
{
452452
struct rpc_clnt *clnt = NULL;
@@ -484,7 +484,6 @@ struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
484484

485485
return clnt;
486486
}
487-
EXPORT_SYMBOL_GPL(rpc_create_xprt);
488487

489488
/**
490489
* 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)
510509
};
511510
char servername[48];
512511

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+
513521
if (args->flags & RPC_CLNT_CREATE_INFINITE_SLOTS)
514522
xprtargs.flags |= XPRT_CREATE_INFINITE_SLOTS;
515523
if (args->flags & RPC_CLNT_CREATE_NO_IDLE_TIMEOUT)

0 commit comments

Comments
 (0)