From: Kent Overstreet Date: Wed, 7 May 2025 20:54:25 +0000 (-0400) Subject: bcachefs: Ensure superblock gets written when we go ERO X-Git-Tag: v6.15-rc6~24^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da18dabc3784663a088943e613c36cd17aeb52d3;p=thirdparty%2Flinux.git bcachefs: Ensure superblock gets written when we go ERO When we go emergency read-only, make sure we do a final write_super() to persist counters and error counts - this can be critical for piecing together what fsck was doing. Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 27943082c093c..84a37d971ffda 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -377,6 +377,11 @@ void bch2_fs_read_only(struct bch_fs *c) bch_verbose(c, "marking filesystem clean"); bch2_fs_mark_clean(c); } else { + /* Make sure error counts/counters are persisted */ + mutex_lock(&c->sb_lock); + bch2_write_super(c); + mutex_unlock(&c->sb_lock); + bch_verbose(c, "done going read-only, filesystem not clean"); } }