summaryrefslogtreecommitdiff
path: root/fs/afs/inode.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-05-09 16:31:11 +0300
committerDavid Howells <dhowells@redhat.com>2019-05-17 00:23:21 +0300
commitc925bd0ac4741badb567f594c41c8cba5e9e9732 (patch)
tree553b6c1ba69724e66becc4c37ed6f89ef23d2fc7 /fs/afs/inode.c
parent7c712458669f203fb2c59af8aafea4c4767b4bc9 (diff)
downloadlinux-c925bd0ac4741badb567f594c41c8cba5e9e9732.tar.xz
afs: Split afs_validate() so first part can be used under LOOKUP_RCU
Split afs_validate() so that the part that decides if the vnode is still valid can be used under LOOKUP_RCU conditions from afs_d_revalidate(). Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/inode.c')
-rw-r--r--fs/afs/inode.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 8d3d060a33fc..5c95da7d5f3d 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -561,23 +561,12 @@ void afs_zap_data(struct afs_vnode *vnode)
}
/*
- * validate a vnode/inode
- * - there are several things we need to check
- * - parent dir data changes (rm, rmdir, rename, mkdir, create, link,
- * symlink)
- * - parent dir metadata changed (security changes)
- * - dentry data changed (write, truncate)
- * - dentry metadata changed (security changes)
+ * Check the validity of a vnode/inode.
*/
-int afs_validate(struct afs_vnode *vnode, struct key *key)
+bool afs_check_validity(struct afs_vnode *vnode)
{
time64_t now = ktime_get_real_seconds();
bool valid;
- int ret;
-
- _enter("{v={%llx:%llu} fl=%lx},%x",
- vnode->fid.vid, vnode->fid.vnode, vnode->flags,
- key_serial(key));
/* Quickly check the callback state. Ideally, we'd use read_seqbegin
* here, but we have no way to pass the net namespace to the RCU
@@ -606,6 +595,28 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)
}
read_sequnlock_excl(&vnode->cb_lock);
+ return valid;
+}
+
+/*
+ * validate a vnode/inode
+ * - there are several things we need to check
+ * - parent dir data changes (rm, rmdir, rename, mkdir, create, link,
+ * symlink)
+ * - parent dir metadata changed (security changes)
+ * - dentry data changed (write, truncate)
+ * - dentry metadata changed (security changes)
+ */
+int afs_validate(struct afs_vnode *vnode, struct key *key)
+{
+ bool valid;
+ int ret;
+
+ _enter("{v={%llx:%llu} fl=%lx},%x",
+ vnode->fid.vid, vnode->fid.vnode, vnode->flags,
+ key_serial(key));
+
+ valid = afs_check_validity(vnode);
if (test_bit(AFS_VNODE_DELETED, &vnode->flags))
clear_nlink(&vnode->vfs_inode);