summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fsck.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-07-14 07:44:09 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:35 +0300
commite4085b70f21f0e4b578a50a9fd7e84f2a055010f (patch)
tree397cc27f23a037711d0cd2723fb8173388e32203 /fs/bcachefs/fsck.c
parent597dee1cd67d591cd5aeba184fdb69d0da0ceb78 (diff)
downloadlinux-e4085b70f21f0e4b578a50a9fd7e84f2a055010f.tar.xz
bcachefs: fsck_inode_rm() shouldn't delete subvols
We should never see an inode marked as unlinked that's a subvolume root (or a directory) in fsck, but even if we do it's not correct for fsck to delete the subvolume: subvolumes are owned by dirents, and if we find a dangling subvolume (not marked as unlinked) we want fsck to reattach it. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/fsck.c')
-rw-r--r--fs/bcachefs/fsck.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index bdf0183d5d21..609ac37ff1e9 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -231,6 +231,7 @@ static int write_inode(struct btree_trans *trans,
static int fsck_inode_rm(struct btree_trans *trans, u64 inum, u32 snapshot)
{
+ struct bch_fs *c = trans->c;
struct btree_iter iter = { NULL };
struct bkey_i_inode_generation delete;
struct bch_inode_unpacked inode_u;
@@ -263,7 +264,7 @@ retry:
goto err;
if (!bkey_is_inode(k.k)) {
- bch2_fs_inconsistent(trans->c,
+ bch2_fs_inconsistent(c,
"inode %llu:%u not found when deleting",
inum, snapshot);
ret = -EIO;
@@ -273,11 +274,8 @@ retry:
bch2_inode_unpack(k, &inode_u);
/* Subvolume root? */
- if (inode_u.bi_subvol) {
- ret = bch2_subvolume_delete(trans, inode_u.bi_subvol);
- if (ret)
- goto err;
- }
+ if (inode_u.bi_subvol)
+ bch_warn(c, "deleting inode %llu marked as unlinked, but also a subvolume root!?", inode_u.bi_inum);
bkey_inode_generation_init(&delete.k_i);
delete.k.p = iter.pos;