Commit da18dabc authored by Kent Overstreet's avatar Kent Overstreet
Browse files

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 2fea3aa7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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");
	}
}