aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/delegation.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2019-10-21 14:15:32 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2019-11-03 21:28:46 -0500
commitf2d47b5502054749b278cdaf9cb9a60415cf884a (patch)
tree66c19b44f0727369c4006192bb3bf63f72d51dea /fs/nfs/delegation.c
parentNFSv4: Clear the NFS_DELEGATION_REVOKED flag in nfs_update_inplace_delegation() (diff)
downloadlinux-dev-f2d47b5502054749b278cdaf9cb9a60415cf884a.tar.xz
linux-dev-f2d47b5502054749b278cdaf9cb9a60415cf884a.zip
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 <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/delegation.c')
-rw-r--r--fs/nfs/delegation.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index a0f798d3c74f..aff2416dc277 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -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: