bcachefs: fsck: Fix reattach_inode() for subvol roots

bch_subvolume.fs_path_parent needs to be updated as well, it should
match inode.bi_parent_subvol.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet
2025-06-16 14:41:27 -04:00
parent c1ca07a4dd
commit 9fb09ace59
+12
View File
@@ -372,6 +372,18 @@ static int reattach_inode(struct btree_trans *trans, struct bch_inode_unpacked *
if (inode->bi_subvol) {
inode->bi_parent_subvol = BCACHEFS_ROOT_SUBVOL;
struct btree_iter subvol_iter;
struct bkey_i_subvolume *subvol =
bch2_bkey_get_mut_typed(trans, &subvol_iter,
BTREE_ID_subvolumes, POS(0, inode->bi_subvol),
0, subvolume);
ret = PTR_ERR_OR_ZERO(subvol);
if (ret)
return ret;
subvol->v.fs_path_parent = BCACHEFS_ROOT_SUBVOL;
bch2_trans_iter_exit(trans, &subvol_iter);
u64 root_inum;
ret = subvol_lookup(trans, inode->bi_parent_subvol,
&dirent_snapshot, &root_inum);