svcrdma: Select NFSv4.1 backchannel transport based on forward channel
authorChuck Lever <chuck.lever@oracle.com>
Wed, 16 Jul 2014 19:38:32 +0000 (15:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Sep 2014 23:28:37 +0000 (16:28 -0700)
commit 3c45ddf823d679a820adddd53b52c6699c9a05ac upstream.

The current code always selects XPRT_TRANSPORT_BC_TCP for the back
channel, even when the forward channel was not TCP (eg, RDMA). When
a 4.1 mount is attempted with RDMA, the server panics in the TCP BC
code when trying to send CB_NULL.

Instead, construct the transport protocol number from the forward
channel transport or'd with XPRT_TRANSPORT_BC. Transports that do
not support bi-directional RPC will not have registered a "BC"
transport, causing create_backchannel_client() to fail immediately.

Fixes: https://bugzilla.linux-nfs.org/show_bug.cgi?id=265
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs4callback.c
include/linux/sunrpc/svc_xprt.h
net/sunrpc/svcsock.c
net/sunrpc/xprt.c
net/sunrpc/xprtrdma/svc_rdma_transport.c

index 3eaa6e30a2dc701a1a179c292c32c168942b6898..cc8c5b32043cb9f221a739957a95a4e6fd71f78b 100644 (file)
@@ -672,7 +672,8 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
                clp->cl_cb_session = ses;
                args.bc_xprt = conn->cb_xprt;
                args.prognumber = clp->cl_cb_session->se_cb_prog;
-               args.protocol = XPRT_TRANSPORT_BC_TCP;
+               args.protocol = conn->cb_xprt->xpt_class->xcl_ident |
+                               XPRT_TRANSPORT_BC;
                args.authflavor = ses->se_cb_sec.flavor;
        }
        /* Create RPC client */
index b05963f09ebf7b499902973a2707fad9aaa471e0..f5bfb1a80abe382808437a1dcf87c9666063a5f3 100644 (file)
@@ -32,6 +32,7 @@ struct svc_xprt_class {
        struct svc_xprt_ops     *xcl_ops;
        struct list_head        xcl_list;
        u32                     xcl_max_payload;
+       int                     xcl_ident;
 };
 
 /*
index 422759bae60d64f42a3bb488bca993d6fca22733..5c62c5e89b4633524b173edcbe7f442597e6e9bb 100644 (file)
@@ -683,6 +683,7 @@ static struct svc_xprt_class svc_udp_class = {
        .xcl_owner = THIS_MODULE,
        .xcl_ops = &svc_udp_ops,
        .xcl_max_payload = RPCSVC_MAXPAYLOAD_UDP,
+       .xcl_ident = XPRT_TRANSPORT_UDP,
 };
 
 static void svc_udp_init(struct svc_sock *svsk, struct svc_serv *serv)
@@ -1275,6 +1276,7 @@ static struct svc_xprt_class svc_tcp_class = {
        .xcl_owner = THIS_MODULE,
        .xcl_ops = &svc_tcp_ops,
        .xcl_max_payload = RPCSVC_MAXPAYLOAD_TCP,
+       .xcl_ident = XPRT_TRANSPORT_TCP,
 };
 
 void svc_init_xprt_sock(void)
index 095363eee764b3ff496a745f56e4fa646f5f02c0..42ce6bfc729d4f775741b5170dc99aa8a50102cb 100644 (file)
@@ -1290,7 +1290,7 @@ struct rpc_xprt *xprt_create_transport(struct xprt_create *args)
                }
        }
        spin_unlock(&xprt_list_lock);
-       printk(KERN_ERR "RPC: transport (%d) not supported\n", args->ident);
+       dprintk("RPC: transport (%d) not supported\n", args->ident);
        return ERR_PTR(-EIO);
 
 found:
index 62e4f9bcc387182f829cc5c7d7559b0c16cfee34..ed36cb52cd8678422e45a773ecdafac6c3a1447e 100644 (file)
@@ -89,6 +89,7 @@ struct svc_xprt_class svc_rdma_class = {
        .xcl_owner = THIS_MODULE,
        .xcl_ops = &svc_rdma_ops,
        .xcl_max_payload = RPCSVC_MAXPAYLOAD_TCP,
+       .xcl_ident = XPRT_TRANSPORT_RDMA,
 };
 
 struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)