Skip to content

Commit f2d47b5

Browse files
author
Trond Myklebust
committed
NFSv4: Update the stateid seqid in nfs_revoke_delegation()
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 <[email protected]>
1 parent ae084a3 commit f2d47b5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

fs/nfs/delegation.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,19 @@ static bool nfs_revoke_delegation(struct inode *inode,
771771
if (stateid == NULL) {
772772
nfs4_stateid_copy(&tmp, &delegation->stateid);
773773
stateid = &tmp;
774-
} else if (!nfs4_stateid_match(stateid, &delegation->stateid))
775-
goto out;
774+
} else {
775+
if (!nfs4_stateid_match_other(stateid, &delegation->stateid))
776+
goto out;
777+
spin_lock(&delegation->lock);
778+
if (stateid->seqid) {
779+
if (nfs4_stateid_is_newer(&delegation->stateid, stateid)) {
780+
spin_unlock(&delegation->lock);
781+
goto out;
782+
}
783+
delegation->stateid.seqid = stateid->seqid;
784+
}
785+
spin_unlock(&delegation->lock);
786+
}
776787
nfs_mark_delegation_revoked(NFS_SERVER(inode), delegation);
777788
ret = true;
778789
out:

0 commit comments

Comments
 (0)