aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-10-19 19:57:58 -0400
committerDavid Howells <dhowells@redhat.com>2018-10-23 19:41:08 -0400
commitf58db83fd3325a305cf615f4ffb0e6f60745ed8a (patch)
treec7e94eeb615d960433a3e27795463342e9f0e2d5
parent12d8e95a911eb3921a1fecf1e4d913654f6f4fb5 (diff)
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>
-rw-r--r--fs/afs/dir.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 8936731c59ff..f2dd48d4363f 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -1174,7 +1174,7 @@ static void afs_dir_remove_subdir(struct dentry *dentry)
1174static int afs_rmdir(struct inode *dir, struct dentry *dentry) 1174static int afs_rmdir(struct inode *dir, struct dentry *dentry)
1175{ 1175{
1176 struct afs_fs_cursor fc; 1176 struct afs_fs_cursor fc;
1177 struct afs_vnode *dvnode = AFS_FS_I(dir); 1177 struct afs_vnode *dvnode = AFS_FS_I(dir), *vnode = NULL;
1178 struct key *key; 1178 struct key *key;
1179 u64 data_version = dvnode->status.data_version; 1179 u64 data_version = dvnode->status.data_version;
1180 int ret; 1180 int ret;
@@ -1188,6 +1188,14 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
1188 goto error; 1188 goto error;
1189 } 1189 }
1190 1190
1191 /* Try to make sure we have a callback promise on the victim. */
1192 if (d_really_is_positive(dentry)) {
1193 vnode = AFS_FS_I(d_inode(dentry));
1194 ret = afs_validate(vnode, key);
1195 if (ret < 0)
1196 goto error_key;
1197 }
1198
1191 ret = -ERESTARTSYS; 1199 ret = -ERESTARTSYS;
1192 if (afs_begin_vnode_operation(&fc, dvnode, key)) { 1200 if (afs_begin_vnode_operation(&fc, dvnode, key)) {
1193 while (afs_select_fileserver(&fc)) { 1201 while (afs_select_fileserver(&fc)) {
@@ -1206,6 +1214,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
1206 } 1214 }
1207 } 1215 }
1208 1216
1217error_key:
1209 key_put(key); 1218 key_put(key);
1210error: 1219error:
1211 return ret; 1220 return ret;