Commit c925bd0a authored by David Howells's avatar David Howells

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: default avatarDavid Howells <dhowells@redhat.com>
parent 7c712458
...@@ -561,23 +561,12 @@ void afs_zap_data(struct afs_vnode *vnode) ...@@ -561,23 +561,12 @@ void afs_zap_data(struct afs_vnode *vnode)
} }
/* /*
* validate a vnode/inode * Check the validity of 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 afs_check_validity(struct afs_vnode *vnode)
{ {
time64_t now = ktime_get_real_seconds(); time64_t now = ktime_get_real_seconds();
bool valid; 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 /* 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 * 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) ...@@ -606,6 +595,28 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)
} }
read_sequnlock_excl(&vnode->cb_lock); 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)) if (test_bit(AFS_VNODE_DELETED, &vnode->flags))
clear_nlink(&vnode->vfs_inode); clear_nlink(&vnode->vfs_inode);
......
...@@ -1022,6 +1022,7 @@ extern struct inode *afs_iget(struct super_block *, struct key *, ...@@ -1022,6 +1022,7 @@ extern struct inode *afs_iget(struct super_block *, struct key *,
struct afs_cb_interest *, struct afs_cb_interest *,
struct afs_vnode *); struct afs_vnode *);
extern void afs_zap_data(struct afs_vnode *); extern void afs_zap_data(struct afs_vnode *);
extern bool afs_check_validity(struct afs_vnode *);
extern int afs_validate(struct afs_vnode *, struct key *); extern int afs_validate(struct afs_vnode *, struct key *);
extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int); extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int);
extern int afs_setattr(struct dentry *, struct iattr *); extern int afs_setattr(struct dentry *, struct iattr *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment