summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/inode.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-08-12 12:34:47 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:10 -0400
commitc036359197705e5b133b30154771c3ebad5698b0 (patch)
tree9a6f3dca07277dc996edcc71ffa55394160bae1d /fs/bcachefs/inode.c
parent791236b85c2dfd3bc6b857431658efb49de83343 (diff)
downloadlinux-stable-c036359197705e5b133b30154771c3ebad5698b0.tar.gz
linux-stable-c036359197705e5b133b30154771c3ebad5698b0.tar.bz2
linux-stable-c036359197705e5b133b30154771c3ebad5698b0.zip
bcachefs: Check for directories in deleted inodes btree
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/inode.c')
-rw-r--r--fs/bcachefs/inode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c
index e0d416553bf0..46c4012facb0 100644
--- a/fs/bcachefs/inode.c
+++ b/fs/bcachefs/inode.c
@@ -1048,6 +1048,11 @@ static int may_delete_deleted_inode(struct btree_trans *trans, struct bpos pos)
if (ret)
goto err;
+ if (fsck_err_on(S_ISDIR(inode.bi_mode), c,
+ "directory %llu:%u in deleted_inodes btree",
+ pos.offset, pos.snapshot))
+ goto delete;
+
if (fsck_err_on(!(inode.bi_flags & BCH_INODE_UNLINKED), c,
"non-deleted inode %llu:%u in deleted_inodes btree",
pos.offset, pos.snapshot))