2017-01-26 18:01:34

by Chuck Lever III

[permalink] [raw]
Subject: [PATCH v2] nfs: Don't increment lock sequence ID after NFS4ERR_MOVED

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 <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
Tested-by: Xuan Qi <[email protected]>
Cc: [email protected] # 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(-)

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;



2017-01-26 18:14:11

by Trond Myklebust

[permalink] [raw]
Subject: Re: [PATCH v2] nfs: Don't increment lock sequence ID after NFS4ERR_MOVED

T24gVGh1LCAyMDE3LTAxLTI2IGF0IDEzOjAwIC0wNTAwLCBDaHVjayBMZXZlciB3cm90ZToNCj4g
WHVhbiBRaSByZXBvcnRzIHRoYXQgdGhlIExpbnV4IE5GU3Y0IGNsaWVudCBmYWlsZWQgdG8gbG9j
ayBhIGZpbGUNCj4gdGhhdCB3YXMgbWlncmF0ZWQuIFRoZSBzdGVwcyBoZSBvYnNlcnZlZCBvbiB0
aGUgd2lyZToNCj4gDQo+IDEuIFRoZSBjbGllbnQgc2VudCBhIExPQ0sgcmVxdWVzdCB0byB0aGUg
c291cmNlIHNlcnZlcg0KPiAyLiBUaGUgc291cmNlIHNlcnZlciByZXBsaWVkIE5GUzRFUlJfTU9W
RUQNCj4gMy4gVGhlIGNsaWVudCBzd2l0Y2hlZCB0byB0aGUgZGVzdGluYXRpb24gc2VydmVyDQo+
IDQuIFRoZSBjbGllbnQgc2VudCB0aGUgTE9DSyByZXF1ZXN0IHRvIHRoZSBkZXN0aW5hdGlvbg0K
PiDCoMKgwqBzZXJ2ZXIgd2l0aCBhIGJ1bXBlZCBsb2NrIHNlcXVlbmNlIElEDQo+IDUuIFRoZSBk
ZXN0aW5hdGlvbiBzZXJ2ZXIgcmVqZWN0ZWQgdGhlIExPQ0sgcmVxdWVzdCB3aXRoDQo+IMKgwqDC
oE5GUzRFUlJfQkFEX1NFUUlEDQo+IA0KPiBSRkMgMzUzMCBzZWN0aW9uIDguMS41IHByb3ZpZGVz
IGEgbGlzdCBvZiBORlMgZXJyb3JzIHdoaWNoIGRvIG5vdA0KPiBidW1wIGEgbG9jayBzZXF1ZW5j
ZSBJRC4NCj4gDQo+IEhvd2V2ZXIsIFJGQyAzNTMwIGlzIG5vdyBvYnNvbGV0ZWQgYnkgUkZDIDc1
MzAuIEluIFJGQyA3NTMwIHNlY3Rpb24NCj4gOS4xLjcsIHRoaXMgbGlzdCBoYXMgYmVlbiB1cGRh
dGVkIGJ5IHRoZSBhZGRpdGlvbiBvZiBORlM0RVJSX01PVkVELg0KPiANCj4gUmVwb3J0ZWQtYnk6
IFh1YW4gUWkgPHh1YW4ucWlAb3JhY2xlLmNvbT4NCj4gU2lnbmVkLW9mZi1ieTogQ2h1Y2sgTGV2
ZXIgPGNodWNrLmxldmVyQG9yYWNsZS5jb20+DQo+IFRlc3RlZC1ieTogWHVhbiBRaSA8eHVhbi5x
aUBvcmFjbGUuY29tPg0KPiBDYzogc3RhYmxlQHZnZXIua2VybmVsLm9yZyAjIHYzLjcrDQo+IC0t
LQ0KPiBUZXN0aW5nIGNvbmZpcm1zIHRoaXMgcGF0Y2ggYWRkcmVzc2VzIHRoZSBwcm9ibGVtIHRo
YXQgWHVhbiBmaXJzdA0KPiBvYnNlcnZlZC4NCj4gDQoNClNpbmNlIHRoZSBmaXJzdCBwYXRjaCB3
YXMgYWxyZWFkeSBhcHBsaWVkIHRvIGxpbnV4LW5leHQsIGNvdWxkIHlvdQ0KcGxlYXNlIG1ha2Ug
dGhpcyBvbmUgaW5jcmVtZW50YWw/DQoNClRoYW5rcw0KDQotLSANClRyb25kIE15a2xlYnVzdA0K
TGludXggTkZTIGNsaWVudCBtYWludGFpbmVyLCBQcmltYXJ5RGF0YQ0KdHJvbmQubXlrbGVidXN0
QHByaW1hcnlkYXRhLmNvbQ0K


2017-01-26 19:58:00

by Chuck Lever III

[permalink] [raw]
Subject: Re: [PATCH v2] nfs: Don't increment lock sequence ID after NFS4ERR_MOVED


> On Jan 26, 2017, at 1:14 PM, Trond Myklebust <[email protected]> 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 <[email protected]>
>> Signed-off-by: Chuck Lever <[email protected]>
>> Tested-by: Xuan Qi <[email protected]>
>> Cc: [email protected] # 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