Skip to content

Commit 9e6e83e

Browse files
Kent Overstreetgregkh
authored andcommitted
bcachefs: bch2_ioctl_subvolume_destroy() fixes
[ Upstream commit 7075496 ] bch2_evict_subvolume_inodes() was getting stuck - due to incorrectly pruning the dcache. Also, fix missing permissions checks. Reported-by: Alexander Viro <[email protected]> Signed-off-by: Kent Overstreet <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a964484 commit 9e6e83e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/bcachefs/fs-ioctl.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,12 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
520520
ret = -ENOENT;
521521
goto err;
522522
}
523-
ret = __bch2_unlink(dir, victim, true);
523+
524+
ret = inode_permission(file_mnt_idmap(filp), d_inode(victim), MAY_WRITE) ?:
525+
__bch2_unlink(dir, victim, true);
524526
if (!ret) {
525527
fsnotify_rmdir(dir, victim);
526-
d_delete(victim);
528+
d_invalidate(victim);
527529
}
528530
err:
529531
inode_unlock(dir);

0 commit comments

Comments
 (0)