Skip to content

Commit 20826fe

Browse files
author
Kent Overstreet
committed
bcachefs: Fix reattach_inode()
Ensure a copy of the lost+found inode exists in the snapshot that we're reattaching, so that we don't trigger warnings in lookup_inode_for_snapshot() later. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 6b63a94 commit 20826fe

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

fs/bcachefs/fsck.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,12 @@ static int reattach_inode(struct btree_trans *trans,
354354
if (ret)
355355
return ret;
356356

357-
if (S_ISDIR(inode->bi_mode)) {
358-
lostfound.bi_nlink++;
357+
lostfound.bi_nlink += S_ISDIR(inode->bi_mode);
359358

360-
ret = __bch2_fsck_write_inode(trans, &lostfound, U32_MAX);
361-
if (ret)
362-
return ret;
363-
}
359+
/* ensure lost+found inode is also present in inode snapshot */
360+
ret = __bch2_fsck_write_inode(trans, &lostfound, inode_snapshot);
361+
if (ret)
362+
return ret;
364363

365364
dir_hash = bch2_hash_info_init(c, &lostfound);
366365

0 commit comments

Comments
 (0)