diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-03-28 03:40:39 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2019-04-03 12:44:14 -0400 |
commit | 183f66ecf1bebb19f0db971e0eb5082ade0b67e1 (patch) | |
tree | cc1b60949ebbb710f726c6aec78c086a535516e1 | |
parent | e4f93a2bdc6893d4dae368d4c725b71e3dd44615 (diff) |
bcachefs: Write out alloc info more carefully
In flight btree updates could update alloc info until they're flushed -
so we have to try writing again after they've been flushed.
-rw-r--r-- | fs/bcachefs/super.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 3bcc32400987..7b1683611c1e 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -206,7 +206,7 @@ static void __bch2_fs_read_only(struct bch_fs *c) { struct bch_dev *ca; bool wrote; - unsigned i; + unsigned i, clean_passes = 0; int ret; bch2_rebalance_stop(c); @@ -226,15 +226,15 @@ static void __bch2_fs_read_only(struct bch_fs *c) goto allocator_not_running; do { - ret = bch2_alloc_write(c, false, &wrote); + ret = bch2_stripes_write(c, &wrote); if (ret) { - bch2_fs_inconsistent(c, "error writing out alloc info %i", ret); + bch2_fs_inconsistent(c, "error writing out stripes"); break; } - ret = bch2_stripes_write(c, &wrote); + ret = bch2_alloc_write(c, false, &wrote); if (ret) { - bch2_fs_inconsistent(c, "error writing out stripes"); + bch2_fs_inconsistent(c, "error writing out alloc info %i", ret); break; } @@ -252,7 +252,9 @@ static void __bch2_fs_read_only(struct bch_fs *c) */ closure_wait_event(&c->btree_interior_update_wait, !bch2_btree_interior_updates_nr_pending(c)); - } while (wrote); + + clean_passes = wrote ? 0 : clean_passes + 1; + } while (clean_passes < 2); allocator_not_running: for_each_member_device(ca, c, i) bch2_dev_allocator_stop(ca); |