From: Kent Overstreet Date: Sun, 21 Nov 2021 21:15:48 +0000 (-0500) Subject: bcachefs: Fix BCH_FS_ERROR flag handling X-Git-Tag: v6.7-rc1~201^2~1283 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7468c4effc8c93464ec0fd4336494312bebb8033;p=thirdparty%2Fkernel%2Flinux.git 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: Kent Overstreet --- diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index ec5b7e2c72718..a15b3bfa9d474 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -1632,7 +1632,7 @@ again: 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"); diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index 3cc5d8ea743fc..170f7d46fa345 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -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);