Skip to content

Commit da18dab

Browse files
author
Kent Overstreet
committed
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 <kent.overstreet@linux.dev>
1 parent 2fea3aa commit da18dab

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/bcachefs/super.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ void bch2_fs_read_only(struct bch_fs *c)
377377
bch_verbose(c, "marking filesystem clean");
378378
bch2_fs_mark_clean(c);
379379
} else {
380+
/* Make sure error counts/counters are persisted */
381+
mutex_lock(&c->sb_lock);
382+
bch2_write_super(c);
383+
mutex_unlock(&c->sb_lock);
384+
380385
bch_verbose(c, "done going read-only, filesystem not clean");
381386
}
382387
}

0 commit comments

Comments
 (0)