]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
NFSv4: Update the stateid seqid in nfs_revoke_delegation()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 21 Oct 2019 18:15:32 +0000 (14:15 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 4 Nov 2019 02:28:46 +0000 (21:28 -0500)
If we revoke a delegation, but the stateid's seqid is newer, then
ensure we update the seqid when marking the delegation as revoked.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/delegation.c

index a0f798d3c74f227148b0d719245d7b2ec0820899..aff2416dc277473de880aea85e51e814025c4bef 100644 (file)
@@ -771,8 +771,19 @@ static bool nfs_revoke_delegation(struct inode *inode,
        if (stateid == NULL) {
                nfs4_stateid_copy(&tmp, &delegation->stateid);
                stateid = &tmp;
-       } else if (!nfs4_stateid_match(stateid, &delegation->stateid))
-               goto out;
+       } else {
+               if (!nfs4_stateid_match_other(stateid, &delegation->stateid))
+                       goto out;
+               spin_lock(&delegation->lock);
+               if (stateid->seqid) {
+                       if (nfs4_stateid_is_newer(&delegation->stateid, stateid)) {
+                               spin_unlock(&delegation->lock);
+                               goto out;
+                       }
+                       delegation->stateid.seqid = stateid->seqid;
+               }
+               spin_unlock(&delegation->lock);
+       }
        nfs_mark_delegation_revoked(NFS_SERVER(inode), delegation);
        ret = true;
 out: