diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-03-29 19:01:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-07 10:08:37 +0200 |
commit | 9e6e83e1e2d01b99e70cd7812d7f758a8def9fc8 (patch) | |
tree | 4a94a0c1f94f63876d75f0671a9a6b6b7d1c81d8 | |
parent | a964484a3537f121edd94a0dfbe6ac853c0462cf (diff) | |
download | linux-9e6e83e1e2d01b99e70cd7812d7f758a8def9fc8.tar.gz linux-9e6e83e1e2d01b99e70cd7812d7f758a8def9fc8.tar.bz2 linux-9e6e83e1e2d01b99e70cd7812d7f758a8def9fc8.zip |
bcachefs: bch2_ioctl_subvolume_destroy() fixes
[ Upstream commit 707549600c4a012ed71c0204a7992a679880bf33 ]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/bcachefs/fs-ioctl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/bcachefs/fs-ioctl.c b/fs/bcachefs/fs-ioctl.c index 405cf08bda34..e599d5ac6e4d 100644 --- a/fs/bcachefs/fs-ioctl.c +++ b/fs/bcachefs/fs-ioctl.c @@ -520,10 +520,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); |