]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bcachefs: bch2_ioctl_subvolume_destroy() fixes
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 29 Mar 2025 23:01:09 +0000 (19:01 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 30 Mar 2025 20:33:22 +0000 (16:33 -0400)
bch2_evict_subvolume_inodes() was getting stuck - due to incorrectly
pruning the dcache.

Also, fix missing permissions checks.

Reported-by: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-ioctl.c

index e3a3230fc65284525807bfc151af6e65e358a78c..0273130f18dcdd59d5c5bd005ad14b62ecb344c3 100644 (file)
@@ -541,10 +541,12 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
                ret = -ENOENT;
                goto err;
        }
-       ret = __bch2_unlink(dir, victim, true);
+
+       ret =   inode_permission(file_mnt_idmap(filp), d_inode(victim), MAY_WRITE) ?:
+               __bch2_unlink(dir, victim, true);
        if (!ret) {
                fsnotify_rmdir(dir, victim);
-               d_delete(victim);
+               d_invalidate(victim);
        }
 err:
        inode_unlock(dir);