diff options
-rw-r--r-- | fs/nfs/nfs4_fs.h | 24 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 14 | ||||
-rw-r--r-- | include/linux/nfs4.h | 16 |
3 files changed, 17 insertions, 37 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 1ec1a85fa71c..1a652a0bd7db 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -13,30 +13,6 @@ | |||
13 | 13 | ||
14 | struct idmap; | 14 | struct idmap; |
15 | 15 | ||
16 | /* | ||
17 | * In a seqid-mutating op, this macro controls which error return | ||
18 | * values trigger incrementation of the seqid. | ||
19 | * | ||
20 | * from rfc 3010: | ||
21 | * The client MUST monotonically increment the sequence number for the | ||
22 | * CLOSE, LOCK, LOCKU, OPEN, OPEN_CONFIRM, and OPEN_DOWNGRADE | ||
23 | * operations. This is true even in the event that the previous | ||
24 | * operation that used the sequence number received an error. The only | ||
25 | * exception to this rule is if the previous operation received one of | ||
26 | * the following errors: NFSERR_STALE_CLIENTID, NFSERR_STALE_STATEID, | ||
27 | * NFSERR_BAD_STATEID, NFSERR_BAD_SEQID, NFSERR_BADXDR, | ||
28 | * NFSERR_RESOURCE, NFSERR_NOFILEHANDLE. | ||
29 | * | ||
30 | */ | ||
31 | #define seqid_mutating_err(err) \ | ||
32 | (((err) != NFSERR_STALE_CLIENTID) && \ | ||
33 | ((err) != NFSERR_STALE_STATEID) && \ | ||
34 | ((err) != NFSERR_BAD_STATEID) && \ | ||
35 | ((err) != NFSERR_BAD_SEQID) && \ | ||
36 | ((err) != NFSERR_BAD_XDR) && \ | ||
37 | ((err) != NFSERR_RESOURCE) && \ | ||
38 | ((err) != NFSERR_NOFILEHANDLE)) | ||
39 | |||
40 | enum nfs4_client_state { | 16 | enum nfs4_client_state { |
41 | NFS4CLNT_MANAGER_RUNNING = 0, | 17 | NFS4CLNT_MANAGER_RUNNING = 0, |
42 | NFS4CLNT_CHECK_LEASE, | 18 | NFS4CLNT_CHECK_LEASE, |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 78c792fb59a8..04ad9a2ca3d0 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1623,18 +1623,6 @@ static void write_cinfo(__be32 **p, struct nfsd4_change_info *c) | |||
1623 | \ | 1623 | \ |
1624 | save = resp->p; | 1624 | save = resp->p; |
1625 | 1625 | ||
1626 | static bool seqid_mutating_err(__be32 err) | ||
1627 | { | ||
1628 | /* rfc 3530 section 8.1.5: */ | ||
1629 | return err != nfserr_stale_clientid && | ||
1630 | err != nfserr_stale_stateid && | ||
1631 | err != nfserr_bad_stateid && | ||
1632 | err != nfserr_bad_seqid && | ||
1633 | err != nfserr_bad_xdr && | ||
1634 | err != nfserr_resource && | ||
1635 | err != nfserr_nofilehandle; | ||
1636 | } | ||
1637 | |||
1638 | /* | 1626 | /* |
1639 | * Routine for encoding the result of a "seqid-mutating" NFSv4 operation. This | 1627 | * Routine for encoding the result of a "seqid-mutating" NFSv4 operation. This |
1640 | * is where sequence id's are incremented, and the replay cache is filled. | 1628 | * is where sequence id's are incremented, and the replay cache is filled. |
@@ -1643,7 +1631,7 @@ static bool seqid_mutating_err(__be32 err) | |||
1643 | */ | 1631 | */ |
1644 | 1632 | ||
1645 | #define ENCODE_SEQID_OP_TAIL(stateowner) do { \ | 1633 | #define ENCODE_SEQID_OP_TAIL(stateowner) do { \ |
1646 | if (seqid_mutating_err(nfserr) && stateowner) { \ | 1634 | if (seqid_mutating_err(ntohl(nfserr)) && stateowner) { \ |
1647 | stateowner->so_seqid++; \ | 1635 | stateowner->so_seqid++; \ |
1648 | stateowner->so_replay.rp_status = nfserr; \ | 1636 | stateowner->so_replay.rp_status = nfserr; \ |
1649 | stateowner->so_replay.rp_buflen = \ | 1637 | stateowner->so_replay.rp_buflen = \ |
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 76f99e8714f3..b875b0324fc0 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h | |||
@@ -373,6 +373,22 @@ enum nfsstat4 { | |||
373 | NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ | 373 | NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ |
374 | }; | 374 | }; |
375 | 375 | ||
376 | static inline bool seqid_mutating_err(u32 err) | ||
377 | { | ||
378 | /* rfc 3530 section 8.1.5: */ | ||
379 | switch (err) { | ||
380 | case NFS4ERR_STALE_CLIENTID: | ||
381 | case NFS4ERR_STALE_STATEID: | ||
382 | case NFS4ERR_BAD_STATEID: | ||
383 | case NFS4ERR_BAD_SEQID: | ||
384 | case NFS4ERR_BADXDR: | ||
385 | case NFS4ERR_RESOURCE: | ||
386 | case NFS4ERR_NOFILEHANDLE: | ||
387 | return false; | ||
388 | }; | ||
389 | return true; | ||
390 | } | ||
391 | |||
376 | /* | 392 | /* |
377 | * Note: NF4BAD is not actually part of the protocol; it is just used | 393 | * Note: NF4BAD is not actually part of the protocol; it is just used |
378 | * internally by nfsd. | 394 | * internally by nfsd. |