NFSv4.1: Select the "most recent locking state" for read/write/setattr stateids
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 17 Mar 2013 19:31:15 +0000 (15:31 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 25 Mar 2013 16:04:11 +0000 (12:04 -0400)
Follow the practice described in section 8.2.2 of RFC5661: When sending a
read/write or setattr stateid, set the seqid field to zero in order to
signal that the NFS server should apply the most recent locking state.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4proc.c
fs/nfs/nfs4state.c
include/linux/nfs_fs_sb.h

index 22c80f9ed824639d54401dae711392137e60a627..625a729ebccad1605184e290ecf3f03e410732c1 100644 (file)
@@ -6841,7 +6841,8 @@ static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = {
        .init_caps = NFS_CAP_READDIRPLUS
                | NFS_CAP_ATOMIC_OPEN
                | NFS_CAP_CHANGE_ATTR
-               | NFS_CAP_POSIX_LOCK,
+               | NFS_CAP_POSIX_LOCK
+               | NFS_CAP_STATEID_NFSV41,
        .call_sync = nfs4_call_sync_sequence,
        .match_stateid = nfs41_match_stateid,
        .find_root_sec = nfs41_find_root_sec,
index 4e95bd72f48047f63636a44b61c1a6bee1f618db..685b1e953ed8c3178700ee81c544066062676b63 100644 (file)
@@ -1053,6 +1053,8 @@ int nfs4_select_rw_stateid(nfs4_stateid *dst, struct nfs4_state *state,
                goto out;
        ret = nfs4_copy_open_stateid(dst, state);
 out:
+       if (nfs_server_capable(state->inode, NFS_CAP_STATEID_NFSV41))
+               dst->seqid = 0;
        return ret;
 }
 
index 6c6ed153a9b4833f055ac7899b066b9c87782ece..74c9e52c933878a6300efe2bcbe6e12afda85da3 100644 (file)
@@ -197,5 +197,6 @@ struct nfs_server {
 #define NFS_CAP_MTIME          (1U << 13)
 #define NFS_CAP_POSIX_LOCK     (1U << 14)
 #define NFS_CAP_UIDGID_NOMAP   (1U << 15)
+#define NFS_CAP_STATEID_NFSV41 (1U << 16)
 
 #endif
This page took 0.061297 seconds and 5 git commands to generate.