Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux.git] / fs / nfsd / nfs4callback.c
index 7f05cd140de3cb2a8c75665bdbcad8bb3d823582..39c8ef875f91b5a93b57c8886b56569d679296a3 100644 (file)
@@ -32,6 +32,7 @@
  */
 
 #include <linux/sunrpc/clnt.h>
+#include <linux/sunrpc/xprt.h>
 #include <linux/sunrpc/svc_xprt.h>
 #include <linux/slab.h>
 #include "nfsd.h"
@@ -635,6 +636,22 @@ static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc
        }
 }
 
+static struct rpc_clnt *create_backchannel_client(struct rpc_create_args *args)
+{
+       struct rpc_xprt *xprt;
+
+       if (args->protocol != XPRT_TRANSPORT_BC_TCP)
+               return rpc_create(args);
+
+       xprt = args->bc_xprt->xpt_bc_xprt;
+       if (xprt) {
+               xprt_get(xprt);
+               return rpc_create_xprt(args, xprt);
+       }
+
+       return rpc_create(args);
+}
+
 static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses)
 {
        struct rpc_timeout      timeparms = {
@@ -674,7 +691,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
                args.authflavor = ses->se_cb_sec.flavor;
        }
        /* Create RPC client */
-       client = rpc_create(&args);
+       client = create_backchannel_client(&args);
        if (IS_ERR(client)) {
                dprintk("NFSD: couldn't create callback client: %ld\n",
                        PTR_ERR(client));