Commit 7468c4ef authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet
Browse files

bcachefs: Fix BCH_FS_ERROR flag handling



We were setting BCH_FS_ERROR on startup if the superblock was marked as
containing errors, which is not what we wanted - BCH_FS_ERROR indicates
whether errors have been found, so that after a successful fsck we're
able to clear the error bit in the superblock.

Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent e5464a37
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1632,7 +1632,7 @@ int bch2_gc(struct bch_fs *c, bool initial, bool metadata_only)

	bch2_mark_superblocks(c);

	if (test_bit(BCH_FS_TOPOLOGY_ERROR, &c->flags) &&
	if (BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb) &&
	    !test_bit(BCH_FS_INITIAL_GC_DONE, &c->flags) &&
	    c->opts.fix_errors != FSCK_OPT_NO) {
		bch_info(c, "starting topology repair pass");
+0 −10
Original line number Diff line number Diff line
@@ -445,16 +445,6 @@ int bch2_sb_to_fs(struct bch_fs *c, struct bch_sb *src)

	__copy_super(&c->disk_sb, src);

	if (BCH_SB_HAS_ERRORS(c->disk_sb.sb))
		set_bit(BCH_FS_ERROR, &c->flags);
	else
		clear_bit(BCH_FS_ERROR, &c->flags);

	if (BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb))
		set_bit(BCH_FS_TOPOLOGY_ERROR, &c->flags);
	else
		clear_bit(BCH_FS_TOPOLOGY_ERROR, &c->flags);

	if (BCH_SB_INITIALIZED(c->disk_sb.sb))
		set_bit(BCH_FS_INITIALIZED, &c->flags);