afs: Get the target vnode in afs_rmdir() and get a callback on it
Get the target vnode in afs_rmdir() and validate it before we attempt the deletion, The vnode pointer will be passed through to the delivery function in a later patch so that the delivery function can mark it deleted. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
parent
12d8e95a91
commit
f58db83fd3
1 changed files with 10 additions and 1 deletions
11
fs/afs/dir.c
11
fs/afs/dir.c
|
@ -1174,7 +1174,7 @@ static void afs_dir_remove_subdir(struct dentry *dentry)
|
||||||
static int afs_rmdir(struct inode *dir, struct dentry *dentry)
|
static int afs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct afs_fs_cursor fc;
|
struct afs_fs_cursor fc;
|
||||||
struct afs_vnode *dvnode = AFS_FS_I(dir);
|
struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL;
|
||||||
struct key *key;
|
struct key *key;
|
||||||
u64 data_version = dvnode->status.data_version;
|
u64 data_version = dvnode->status.data_version;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1188,6 +1188,14 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Try to make sure we have a callback promise on the victim. */
|
||||||
|
if (d_really_is_positive(dentry)) {
|
||||||
|
vnode = AFS_FS_I(d_inode(dentry));
|
||||||
|
ret = afs_validate(vnode, key);
|
||||||
|
if (ret < 0)
|
||||||
|
goto error_key;
|
||||||
|
}
|
||||||
|
|
||||||
ret = -ERESTARTSYS;
|
ret = -ERESTARTSYS;
|
||||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||||
while (afs_select_fileserver(&fc)) {
|
while (afs_select_fileserver(&fc)) {
|
||||||
|
@ -1206,6 +1214,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error_key:
|
||||||
key_put(key);
|
key_put(key);
|
||||||
error:
|
error:
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue