diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-21 14:57:58 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-13 21:22:24 -0400 |
commit | 45b4ed525e3c5b5dcdee65ae23a27b9efe595714 (patch) | |
tree | 2cc92a062e505d4ada79d12e99c4480aaef2974b /fs/bcachefs | |
parent | c60b7f803c8b7dbea75b3cbfd23d788bab7215a6 (diff) |
bcachefs: Repair subvol dirents that point to non subvols
when repair switches d_type to or from DT_SUBVOL, we need to update the
target accordingly
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r-- | fs/bcachefs/fsck.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c index ff7347cc395f..0d405b960a7c 100644 --- a/fs/bcachefs/fsck.c +++ b/fs/bcachefs/fsck.c @@ -1678,6 +1678,12 @@ static int check_dirent_target(struct btree_trans *trans, bkey_reassemble(&n->k_i, d.s_c); n->v.d_type = inode_d_type(target); + if (n->v.d_type == DT_SUBVOL) { + n->v.d_parent_subvol = cpu_to_le32(target->bi_parent_subvol); + n->v.d_child_subvol = cpu_to_le32(target->bi_subvol); + } else { + n->v.d_inum = cpu_to_le64(target->bi_inum); + } ret = bch2_trans_update(trans, iter, &n->k_i, 0); if (ret) |