If the delegation has been revoked, ignore it.
Signed-off-by: Trond Myklebust <[email protected]>
---
fs/nfs/callback_proc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index db3e7771e597..58a77c41ff36 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -50,7 +50,7 @@ __be32 nfs4_callback_getattr(void *argp, void *resp,
nfsi = NFS_I(inode);
rcu_read_lock();
delegation = rcu_dereference(nfsi->delegation);
- if (delegation == NULL || (delegation->type & FMODE_WRITE) == 0)
+ if (!nfs4_is_valid_delegation(delegation, FMODE_WRITE))
goto out_iput;
res->size = i_size_read(inode);
res->change_attr = delegation->change_attr;
--
2.21.0
If we're processsing a delegation recall, ignore the delegations that
have already been revoked or returned.
Signed-off-by: Trond Myklebust <[email protected]>
---
fs/nfs/delegation.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 5f3eea926af5..4bc40c27141b 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -830,7 +830,7 @@ int nfs_async_inode_return_delegation(struct inode *inode,
rcu_read_lock();
delegation = rcu_dereference(NFS_I(inode)->delegation);
- if (delegation == NULL)
+ if (!nfs4_is_valid_delegation(delegation, FMODE_READ))
goto out_enoent;
if (stateid != NULL &&
!clp->cl_mvops->match_stateid(&delegation->stateid, stateid))
@@ -855,6 +855,7 @@ nfs_delegation_find_inode_server(struct nfs_server *server,
list_for_each_entry_rcu(delegation, &server->delegations, super_list) {
spin_lock(&delegation->lock);
if (delegation->inode != NULL &&
+ !test_bit(NFS_DELEGATION_REVOKED, &delegation->flags) &&
nfs_compare_fh(fhandle, &NFS_I(delegation->inode)->fh) == 0) {
freeme = igrab(delegation->inode);
if (freeme && nfs_sb_active(freeme->i_sb))
--
2.21.0