summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-10-20 20:50:07 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2022-10-03 22:51:34 -0400
commit03d5aa0aa8e5a2e28b6ffa961cee434bd1c2f76d (patch)
tree372c44f64b18b0effb347f1f673820a70f8d7c1a
parenta660362c539abdd4ef4955ad1c159d75ab0a3cb9 (diff)
bcachefs: Delete dentry when deleting snapshots
This fixes a bug where subsequently doing creates with the same name fails. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/bcachefs/fs-ioctl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/bcachefs/fs-ioctl.c b/fs/bcachefs/fs-ioctl.c
index 3ed53f420e7e..513f7a7a3fd4 100644
--- a/fs/bcachefs/fs-ioctl.c
+++ b/fs/bcachefs/fs-ioctl.c
@@ -422,6 +422,7 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
struct bch_ioctl_subvolume arg)
{
struct path path;
+ struct inode *dir;
int ret = 0;
if (arg.flags)
@@ -438,7 +439,13 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
return -EXDEV;
}
- ret = __bch2_unlink(path.dentry->d_parent->d_inode, path.dentry, 1);
+ dir = path.dentry->d_parent->d_inode;
+
+ ret = __bch2_unlink(dir, path.dentry, 1);
+ if (!ret) {
+ fsnotify_rmdir(dir, path.dentry);
+ d_delete(path.dentry);
+ }
path_put(&path);
return ret;