All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v1 08/12] NFSv4.1: Handle EXCHGID4_FLAG_CONFIRMED_R during NFSv4.1 migration
Date: Tue, 23 May 2017 10:54:43 -0400	[thread overview]
Message-ID: <20170523145442.961.53875.stgit@manet.1015granger.net> (raw)
In-Reply-To: <20170523142629.961.81233.stgit-FYjufvaPoItvLzlybtyyYzGyq/o6K9yX@public.gmane.org>

Transparent State Migration copies a client's lease state from the
server where a filesystem used to reside to the server where it now
resides. When an NFSv4.1 client first contacts that destination
server, it uses EXCHANGE_ID to detect trunking relationships.

The lease that was copied there is returned to that client, but the
destination server sets EXCHGID4_FLAG_CONFIRMED_R when replying to
the client. This is because the lease was confirmed on the source
server (before it was copied).

Normally, when CONFIRMED_R is set, a client purges the lease and
creates a new one. However, that throws away the entire benefit of
Transparent State Migration.

Therefore, the client must not purge that lease, and it must use the
contrived slot sequence value returned by the destination for its
first CREATE_SESSION operation.

Reported-by: Xuan Qi <xuan.qi-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Chuck Lever <chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
 fs/nfs/nfs4proc.c  |    2 +-
 fs/nfs/nfs4state.c |   11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index c08c46a..54e561a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7375,11 +7375,11 @@ static void nfs4_exchange_id_done(struct rpc_task *task, void *data)
 	if (status == 0) {
 		clp->cl_clientid = cdata->res.clientid;
 		clp->cl_exchange_flags = cdata->res.flags;
+		clp->cl_seqid = cdata->res.seqid;
 		/* Client ID is not confirmed */
 		if (!(cdata->res.flags & EXCHGID4_FLAG_CONFIRMED_R)) {
 			clear_bit(NFS4_SESSION_ESTABLISHED,
 			&clp->cl_session->session_state);
-			clp->cl_seqid = cdata->res.seqid;
 		}
 
 		kfree(clp->cl_serverowner);
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index b34de03..1b8a848 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -341,6 +341,7 @@ int nfs41_discover_server_trunking(struct nfs_client *clp,
 				   struct rpc_cred *cred)
 {
 	int status;
+	bool tsm;
 
 	status = nfs4_proc_exchange_id(clp, cred);
 	if (status != NFS4_OK)
@@ -352,8 +353,14 @@ int nfs41_discover_server_trunking(struct nfs_client *clp,
 	if (clp != *result)
 		return 0;
 
-	/* Purge state if the client id was established in a prior instance */
-	if (clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R)
+	/*
+	 * Purge state if the client id was established in a prior
+	 * instance and the client id could not have arrived on the
+	 * server via Transparent State Migration.
+	 */
+	tsm = test_bit(NFS4CLNT_MOVED, &clp->cl_state) ||
+	      test_bit(NFS4CLNT_LEASE_MOVED, &clp->cl_state);
+	if (clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R && !tsm)
 		set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);
 	else
 		set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: [PATCH v1 08/12] NFSv4.1: Handle EXCHGID4_FLAG_CONFIRMED_R during NFSv4.1 migration
Date: Tue, 23 May 2017 10:54:43 -0400	[thread overview]
Message-ID: <20170523145442.961.53875.stgit@manet.1015granger.net> (raw)
In-Reply-To: <20170523142629.961.81233.stgit@manet.1015granger.net>

Transparent State Migration copies a client's lease state from the
server where a filesystem used to reside to the server where it now
resides. When an NFSv4.1 client first contacts that destination
server, it uses EXCHANGE_ID to detect trunking relationships.

The lease that was copied there is returned to that client, but the
destination server sets EXCHGID4_FLAG_CONFIRMED_R when replying to
the client. This is because the lease was confirmed on the source
server (before it was copied).

Normally, when CONFIRMED_R is set, a client purges the lease and
creates a new one. However, that throws away the entire benefit of
Transparent State Migration.

Therefore, the client must not purge that lease, and it must use the
contrived slot sequence value returned by the destination for its
first CREATE_SESSION operation.

Reported-by: Xuan Qi <xuan.qi@oracle.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfs/nfs4proc.c  |    2 +-
 fs/nfs/nfs4state.c |   11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index c08c46a..54e561a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7375,11 +7375,11 @@ static void nfs4_exchange_id_done(struct rpc_task *task, void *data)
 	if (status == 0) {
 		clp->cl_clientid = cdata->res.clientid;
 		clp->cl_exchange_flags = cdata->res.flags;
+		clp->cl_seqid = cdata->res.seqid;
 		/* Client ID is not confirmed */
 		if (!(cdata->res.flags & EXCHGID4_FLAG_CONFIRMED_R)) {
 			clear_bit(NFS4_SESSION_ESTABLISHED,
 			&clp->cl_session->session_state);
-			clp->cl_seqid = cdata->res.seqid;
 		}
 
 		kfree(clp->cl_serverowner);
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index b34de03..1b8a848 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -341,6 +341,7 @@ int nfs41_discover_server_trunking(struct nfs_client *clp,
 				   struct rpc_cred *cred)
 {
 	int status;
+	bool tsm;
 
 	status = nfs4_proc_exchange_id(clp, cred);
 	if (status != NFS4_OK)
@@ -352,8 +353,14 @@ int nfs41_discover_server_trunking(struct nfs_client *clp,
 	if (clp != *result)
 		return 0;
 
-	/* Purge state if the client id was established in a prior instance */
-	if (clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R)
+	/*
+	 * Purge state if the client id was established in a prior
+	 * instance and the client id could not have arrived on the
+	 * server via Transparent State Migration.
+	 */
+	tsm = test_bit(NFS4CLNT_MOVED, &clp->cl_state) ||
+	      test_bit(NFS4CLNT_LEASE_MOVED, &clp->cl_state);
+	if (clp->cl_exchange_flags & EXCHGID4_FLAG_CONFIRMED_R && !tsm)
 		set_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);
 	else
 		set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);


  parent reply	other threads:[~2017-05-23 14:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 14:53 [PATCH v1 00/12] NFS/RDMA client-side patches proposed for v4.13 Chuck Lever
2017-05-23 14:53 ` Chuck Lever
     [not found] ` <20170523142629.961.81233.stgit-FYjufvaPoItvLzlybtyyYzGyq/o6K9yX@public.gmane.org>
2017-05-23 14:53   ` [PATCH v1 01/12] xprtrdma: Don't defer MR recovery if ro_map fails Chuck Lever
2017-05-23 14:53     ` Chuck Lever
2017-05-23 14:53   ` [PATCH v1 02/12] xprtrdma: On invalidation failure, remove MWs from rl_registered Chuck Lever
2017-05-23 14:53     ` Chuck Lever
2017-05-23 14:54   ` [PATCH v1 03/12] xprtrdma: Fix FRWR invalidation error recovery Chuck Lever
2017-05-23 14:54     ` Chuck Lever
2017-05-23 14:54   ` [PATCH v1 04/12] xprtrdma: Pre-mark remotely invalidated MRs Chuck Lever
2017-05-23 14:54     ` Chuck Lever
2017-05-23 14:54   ` [PATCH v1 05/12] xprtrdma: Pass only the list of registered MRs to ro_unmap_sync Chuck Lever
2017-05-23 14:54     ` Chuck Lever
2017-05-23 14:54   ` [PATCH v1 06/12] xprtrdma: Rename rpcrdma_req::rl_free Chuck Lever
2017-05-23 14:54     ` Chuck Lever
2017-05-23 14:54   ` [PATCH v1 07/12] xprtrdma: Fix client lock-up after application signal fires Chuck Lever
2017-05-23 14:54     ` Chuck Lever
2017-05-23 14:54   ` Chuck Lever [this message]
2017-05-23 14:54     ` [PATCH v1 08/12] NFSv4.1: Handle EXCHGID4_FLAG_CONFIRMED_R during NFSv4.1 migration Chuck Lever
2017-05-23 14:54   ` [PATCH v1 09/12] xprtrdma: Demote "connect" log messages Chuck Lever
2017-05-23 14:54     ` Chuck Lever
2017-05-23 14:54   ` [PATCH v1 10/12] xprtrdma: FMR does not need list_del_init() Chuck Lever
2017-05-23 14:54     ` Chuck Lever
2017-05-23 14:55   ` [PATCH v1 11/12] xprtrdma: Replace PAGE_MASK with offset_in_page() Chuck Lever
2017-05-23 14:55     ` Chuck Lever
2017-05-23 14:55   ` [PATCH v1 12/12] xprtrdma: Fix documenting comments in frwr_ops.c Chuck Lever
2017-05-23 14:55     ` 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=20170523145442.961.53875.stgit@manet.1015granger.net \
    --to=chuck.lever-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.