Skip to content

Commit 9fb09ac

Browse files
author
Kent Overstreet
committed
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>
1 parent c1ca07a commit 9fb09ac

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

fs/bcachefs/fsck.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,18 @@ static int reattach_inode(struct btree_trans *trans, struct bch_inode_unpacked *
372372
if (inode->bi_subvol) {
373373
inode->bi_parent_subvol = BCACHEFS_ROOT_SUBVOL;
374374

375+
struct btree_iter subvol_iter;
376+
struct bkey_i_subvolume *subvol =
377+
bch2_bkey_get_mut_typed(trans, &subvol_iter,
378+
BTREE_ID_subvolumes, POS(0, inode->bi_subvol),
379+
0, subvolume);
380+
ret = PTR_ERR_OR_ZERO(subvol);
381+
if (ret)
382+
return ret;
383+
384+
subvol->v.fs_path_parent = BCACHEFS_ROOT_SUBVOL;
385+
bch2_trans_iter_exit(trans, &subvol_iter);
386+
375387
u64 root_inum;
376388
ret = subvol_lookup(trans, inode->bi_parent_subvol,
377389
&dirent_snapshot, &root_inum);

0 commit comments

Comments
 (0)