diff mbox

[v2] nfs: Don't increment lock sequence ID after NFS4ERR_MOVED

Message ID 20170126175938.6021.69650.stgit@manet.1015granger.net (mailing list archive)
State New, archived
Headers show

Commit Message

Chuck Lever Jan. 26, 2017, 6 p.m. UTC
Xuan Qi reports that the Linux NFSv4 client failed to lock a file
that was migrated. The steps he observed on the wire:

1. The client sent a LOCK request to the source server
2. The source server replied NFS4ERR_MOVED
3. The client switched to the destination server
4. The client sent the LOCK request to the destination
   server with a bumped lock sequence ID
5. The destination server rejected the LOCK request with
   NFS4ERR_BAD_SEQID

RFC 3530 section 8.1.5 provides a list of NFS errors which do not
bump a lock sequence ID.

However, RFC 3530 is now obsoleted by RFC 7530. In RFC 7530 section
9.1.7, this list has been updated by the addition of NFS4ERR_MOVED.

Reported-by: Xuan Qi <xuan.qi@oracle.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Xuan Qi <xuan.qi@oracle.com>
Cc: stable@vger.kernel.org # v3.7+
---
Testing confirms this patch addresses the problem that Xuan first
observed.


 fs/nfs/nfs4state.c   |    1 +
 include/linux/nfs4.h |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)


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

Comments

Trond Myklebust Jan. 26, 2017, 6:14 p.m. UTC | #1
T24gVGh1LCAyMDE3LTAxLTI2IGF0IDEzOjAwIC0wNTAwLCBDaHVjayBMZXZlciB3cm90ZToNCj4g
WHVhbiBRaSByZXBvcnRzIHRoYXQgdGhlIExpbnV4IE5GU3Y0IGNsaWVudCBmYWlsZWQgdG8gbG9j
ayBhIGZpbGUNCj4gdGhhdCB3YXMgbWlncmF0ZWQuIFRoZSBzdGVwcyBoZSBvYnNlcnZlZCBvbiB0
aGUgd2lyZToNCj4gDQo+IDEuIFRoZSBjbGllbnQgc2VudCBhIExPQ0sgcmVxdWVzdCB0byB0aGUg
c291cmNlIHN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RkcmVzc2VzIHRoZSBwcm9ibGVtIHRo
YXQgWHVhbiBmaXJzdA0KPiBvYnNlcnZlZC4NCj4gDQoNClNpbmNlIHRoZSBmaXJzdCBwYXRjaCB3
YXMgYWxyZWFkeSBhcHBsaWVkIHRvIGxpbnV4LW5leHQsIGNvdWxkIHlvdQ0KcGxlYXNlIG1ha2Ug
dGhpcyBvbmUgaW5jcmVtZW50YWw/DQoNClRoYW5rcw0KDQotLSANClRyb25kIE15a2xlYnVzdA0K
TGludXggTkZTIGNsaWVudCBtYWludGFpbmVyLCBQcmltYXJ5RGF0YQ0KdHJvbmQubXlrbGVidXN0
QHByaW1hcnlkYXRhLmNvbQ0K

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chuck Lever Jan. 26, 2017, 7:57 p.m. UTC | #2
> On Jan 26, 2017, at 1:14 PM, Trond Myklebust <trondmy@primarydata.com> wrote:
> 
> On Thu, 2017-01-26 at 13:00 -0500, Chuck Lever wrote:
>> Xuan Qi reports that the Linux NFSv4 client failed to lock a file
>> that was migrated. The steps he observed on the wire:
>> 
>> 1. The client sent a LOCK request to the source server
>> 2. The source server replied NFS4ERR_MOVED
>> 3. The client switched to the destination server
>> 4. The client sent the LOCK request to the destination
>> ย ย ย server with a bumped lock sequence ID
>> 5. The destination server rejected the LOCK request with
>> ย ย ย NFS4ERR_BAD_SEQID
>> 
>> RFC 3530 section 8.1.5 provides a list of NFS errors which do not
>> bump a lock sequence ID.
>> 
>> However, RFC 3530 is now obsoleted by RFC 7530. In RFC 7530 section
>> 9.1.7, this list has been updated by the addition of NFS4ERR_MOVED.
>> 
>> Reported-by: Xuan Qi <xuan.qi@oracle.com>
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> Tested-by: Xuan Qi <xuan.qi@oracle.com>
>> Cc: stable@vger.kernel.org # v3.7+
>> ---
>> Testing confirms this patch addresses the problem that Xuan first
>> observed.
>> 
> 
> Since the first patch was already applied to linux-next, could you
> please make this one incremental?

Is there a stable commit ID for v1 of this patch?

Just wondering if I should include a Fixes: tag in the incremental
patch.


--
Chuck Lever



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

Patch

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 90e6193..daeb94e 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1091,6 +1091,7 @@  static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
 		case -NFS4ERR_BADXDR:
 		case -NFS4ERR_RESOURCE:
 		case -NFS4ERR_NOFILEHANDLE:
+		case -NFS4ERR_MOVED:
 			/* Non-seqid mutating errors */
 			return;
 	};
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index bca5363..1b1ca04 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -282,7 +282,7 @@  enum nfsstat4 {
 
 static inline bool seqid_mutating_err(u32 err)
 {
-	/* rfc 3530 section 8.1.5: */
+	/* See RFC 7530, section 9.1.7 */
 	switch (err) {
 	case NFS4ERR_STALE_CLIENTID:
 	case NFS4ERR_STALE_STATEID:
@@ -291,6 +291,7 @@  static inline bool seqid_mutating_err(u32 err)
 	case NFS4ERR_BADXDR:
 	case NFS4ERR_RESOURCE:
 	case NFS4ERR_NOFILEHANDLE:
+	case NFS4ERR_MOVED:
 		return false;
 	};
 	return true;