2019-10-24 10:56:45

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH 08/14] NFSv4: Hold the delegation spinlock when updating the seqid

Signed-off-by: Trond Myklebust <[email protected]>
---
fs/nfs/delegation.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index b49faf1b3d91..d9c80871cecc 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -376,8 +376,10 @@ int nfs_inode_set_delegation(struct inode *inode, const struct cred *cred,
/* Is this an update of the existing delegation? */
if (nfs4_stateid_match_other(&old_delegation->stateid,
&delegation->stateid)) {
+ spin_lock(&old_delegation->lock);
nfs_update_inplace_delegation(old_delegation,
delegation);
+ spin_unlock(&old_delegation->lock);
goto out;
}
/*
--
2.21.0


2019-10-24 10:57:38

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH 09/14] NFSv4: Clear the NFS_DELEGATION_REVOKED flag in nfs_update_inplace_delegation()

If the server sent us a new delegation stateid that is more recent than
the one that got revoked, then clear the NFS_DELEGATION_REVOKED flag.

Signed-off-by: Trond Myklebust <[email protected]>
---
fs/nfs/delegation.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index d9c80871cecc..b6cc2e71fcdb 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -332,6 +332,7 @@ nfs_update_inplace_delegation(struct nfs_delegation *delegation,
delegation->stateid.seqid = update->stateid.seqid;
smp_wmb();
delegation->type = update->type;
+ clear_bit(NFS_DELEGATION_REVOKED, &delegation->flags);
}
}

--
2.21.0