summaryrefslogtreecommitdiffstats
path: root/fs/nfs/delegation.c
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2019-10-31 18:40:32 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-11-01 10:59:26 -0400
commitbe3df3dd4c70ee020587a943a31b98a0fb4b6424 (patch)
treefc9a15033a2e3285ca917bd41a01d0503961e89d /fs/nfs/delegation.c
parent669996add4c92476e0f8d6b4cd2bb308d1939fd7 (diff)
downloadlinux-be3df3dd4c70ee020587a943a31b98a0fb4b6424.tar.bz2
NFSv4: Don't allow a cached open with a revoked delegation
If the delegation is marked as being revoked, we must not use it for cached opens. Fixes: 869f9dfa4d6d ("NFSv4: Fix races between nfs_remove_bad_delegation() and delegation return") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/delegation.c')
-rw-r--r--fs/nfs/delegation.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 071b90a45933..ccdfb5f98f35 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -53,6 +53,16 @@ nfs4_is_valid_delegation(const struct nfs_delegation *delegation,
return false;
}
+struct nfs_delegation *nfs4_get_valid_delegation(const struct inode *inode)
+{
+ struct nfs_delegation *delegation;
+
+ delegation = rcu_dereference(NFS_I(inode)->delegation);
+ if (nfs4_is_valid_delegation(delegation, 0))
+ return delegation;
+ return NULL;
+}
+
static int
nfs4_do_check_delegation(struct inode *inode, fmode_t flags, bool mark)
{