From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH v1 15/16] NFS: Bind side-car connection to session
Date: Thu, 16 Oct 2014 15:40:16 -0400 [thread overview]
Message-ID: <20141016194016.13414.14921.stgit@manet.1015granger.net> (raw)
In-Reply-To: <20141016192919.13414.3151.stgit@manet.1015granger.net>
When recovering from a network partition, a client must identify
both the forward and backchannel it wants bound to a session.
Usually these use the same transport, which can be re-bound to the
session with a single BIND_CONN_TO_SESSION operation.
But with a sidecar backchannel, the fore and back channels use
separate transports that must be bound to the transport connection
using separate BC2S operations.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfs/nfs4client.c | 5 ++++-
fs/nfs/nfs4proc.c | 48 ++++++++++++++++++++++++++++++++++++++----------
2 files changed, 42 insertions(+), 11 deletions(-)
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index b1cc35e..97cc170 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -246,7 +246,10 @@ static int nfs4_init_callback(struct nfs_client *clp)
struct rpc_xprt *xprt;
int error;
- xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt);
+ if (clp->cl_bc_rpcclient)
+ xprt = rcu_dereference_raw(clp->cl_bc_rpcclient->cl_xprt);
+ else
+ xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt);
if (nfs4_has_session(clp)) {
error = xprt_setup_backchannel(xprt, NFS41_BC_MIN_CALLBACKS);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 9a8ffb7..2eaf7ec 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6569,18 +6569,16 @@ nfs41_same_server_scope(struct nfs41_server_scope *a,
return false;
}
-/*
- * nfs4_proc_bind_conn_to_session()
- *
- * The 4.1 client currently uses the same TCP connection for the
- * fore and backchannel.
- */
-int nfs4_proc_bind_conn_to_session(struct nfs_client *clp, struct rpc_cred *cred)
+static int _nfs4_proc_bind_conn_to_session(struct nfs_client *clp,
+ struct rpc_cred *cred,
+ struct rpc_clnt *clnt,
+ u32 dir_from_client,
+ u32 dir_from_server)
{
int status;
struct nfs41_bind_conn_to_session_args args = {
.client = clp,
- .dir = NFS4_CDFC4_BACK_OR_BOTH,
+ .dir = dir_from_client,
};
struct nfs41_bind_conn_to_session_res res;
struct rpc_message msg = {
@@ -6599,7 +6597,7 @@ int nfs4_proc_bind_conn_to_session(struct nfs_client *clp, struct rpc_cred *cred
goto out;
}
- status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
+ status = rpc_call_sync(clnt, &msg, RPC_TASK_TIMEOUT);
trace_nfs4_bind_conn_to_session(clp, status);
if (status == 0) {
if (memcmp(res.session->sess_id.data,
@@ -6608,7 +6606,7 @@ int nfs4_proc_bind_conn_to_session(struct nfs_client *clp, struct rpc_cred *cred
status = -EIO;
goto out_session;
}
- if (res.dir != NFS4_CDFS4_BOTH) {
+ if (res.dir != dir_from_server) {
dprintk("NFS: %s: Unexpected direction from server\n",
__func__);
status = -EIO;
@@ -6628,6 +6626,36 @@ out:
return status;
}
+/**
+ * nfs4_proc_bind_conn_to_session - (re)bind fore/back channels to session
+ * @clp: per-server state
+ * @cred: credential for managing state
+ *
+ * Returns zero on success, or a negative errno or negative NFS4ERR.
+ */
+int nfs4_proc_bind_conn_to_session(struct nfs_client *clp,
+ struct rpc_cred *cred)
+{
+ int ret;
+
+ if (!clp->cl_bc_rpcclient)
+ return _nfs4_proc_bind_conn_to_session(clp, cred,
+ clp->cl_rpcclient,
+ NFS4_CDFC4_BACK_OR_BOTH,
+ NFS4_CDFS4_BOTH);
+
+ ret = _nfs4_proc_bind_conn_to_session(clp, cred,
+ clp->cl_bc_rpcclient,
+ NFS4_CDFC4_BACK,
+ NFS4_CDFS4_BACK);
+ if (ret)
+ return ret;
+ return _nfs4_proc_bind_conn_to_session(clp, cred,
+ clp->cl_rpcclient,
+ NFS4_CDFC4_FORE,
+ NFS4_CDFS4_FORE);
+}
+
/*
* Minimum set of SP4_MACH_CRED operations from RFC 5661 in the enforce map
* and operations we'd like to see to enable certain features in the allow map
next prev parent reply other threads:[~2014-10-16 19:40 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-16 19:38 [PATCH v1 00/16] NFS/RDMA patches for 3.19 Chuck Lever
2014-10-16 19:38 ` [PATCH v1 01/16] xprtrdma: Return an errno from rpcrdma_register_external() Chuck Lever
2014-10-16 19:38 ` [PATCH v1 02/16] xprtrdma: Cap req_cqinit Chuck Lever
2014-10-20 13:27 ` Anna Schumaker
2014-10-16 19:38 ` [PATCH v1 03/16] SUNRPC: Pass callsize and recvsize to buf_alloc as separate arguments Chuck Lever
2014-10-20 14:04 ` Anna Schumaker
2014-10-20 18:21 ` Chuck Lever
2014-10-16 19:38 ` [PATCH v1 04/16] xprtrdma: Re-write rpcrdma_flush_cqs() Chuck Lever
2014-10-16 19:38 ` [PATCH v1 05/16] xprtrdma: unmap all FMRs during transport disconnect Chuck Lever
2014-10-16 19:39 ` [PATCH v1 06/16] xprtrdma: spin CQ completion vectors Chuck Lever
2014-10-16 19:39 ` [PATCH v1 07/16] SUNRPC: serialize iostats updates Chuck Lever
2014-10-16 19:39 ` [PATCH v1 08/16] xprtrdma: Display async errors Chuck Lever
2014-10-16 19:39 ` [PATCH v1 09/16] xprtrdma: Enable pad optimization Chuck Lever
2014-10-16 19:39 ` [PATCH v1 10/16] NFS: Include transport protocol name in UCS client string Chuck Lever
2014-10-16 19:39 ` [PATCH v1 11/16] NFS: Clean up nfs4_init_callback() Chuck Lever
2014-10-16 19:39 ` [PATCH v1 12/16] SUNRPC: Add rpc_xprt_is_bidirectional() Chuck Lever
2014-10-16 19:40 ` [PATCH v1 13/16] NFS: Add sidecar RPC client support Chuck Lever
2014-10-20 17:33 ` Anna Schumaker
2014-10-20 18:09 ` Chuck Lever
2014-10-20 19:40 ` Trond Myklebust
2014-10-20 20:11 ` Chuck Lever
2014-10-20 22:31 ` Trond Myklebust
2014-10-21 1:06 ` Chuck Lever
2014-10-21 7:45 ` Trond Myklebust
2014-10-21 17:11 ` Chuck Lever
2014-10-22 8:39 ` Trond Myklebust
2014-10-22 17:20 ` Chuck Lever
2014-10-22 20:53 ` Trond Myklebust
2014-10-22 22:38 ` Chuck Lever
2014-10-23 13:32 ` J. Bruce Fields
2014-10-23 13:55 ` Chuck Lever
2014-10-16 19:40 ` [PATCH v1 14/16] NFS: Set BIND_CONN_TO_SESSION arguments in the proc layer Chuck Lever
2014-10-16 19:40 ` Chuck Lever [this message]
2014-10-16 19:40 ` [PATCH v1 16/16] NFS: Disable SESSION4_BACK_CHAN when a backchannel sidecar is to be used Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141016194016.13414.14921.stgit@manet.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox