mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
bcachefs: Don't write partially-initialized superblocks
This neatly avoids bugs where we fail partway through initializing a new filesystem, if we just don't write out partly-initialized state. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
64afbbc909
commit
80c80164a5
@ -833,6 +833,13 @@ int bch2_write_super(struct bch_fs *c)
|
||||
if (c->opts.nochanges)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Defer writing the superblock until filesystem initialization is
|
||||
* complete - don't write out a partly initialized superblock:
|
||||
*/
|
||||
if (!BCH_SB_INITIALIZED(c->disk_sb.sb))
|
||||
goto out;
|
||||
|
||||
for_each_online_member(ca, c, i) {
|
||||
__set_bit(ca->dev_idx, sb_written.d);
|
||||
ca->sb_write_error = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user