summaryrefslogtreecommitdiff
path: root/libbcachefs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/super.c')
-rw-r--r--libbcachefs/super.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/libbcachefs/super.c b/libbcachefs/super.c
index 3bcc3240..7748dafb 100644
--- a/libbcachefs/super.c
+++ b/libbcachefs/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);
@@ -461,9 +463,6 @@ int bch2_fs_read_write_early(struct bch_fs *c)
{
lockdep_assert_held(&c->state_lock);
- if (c->opts.read_only)
- return -EROFS;
-
return __bch2_fs_read_write(c, true);
}
@@ -873,7 +872,6 @@ err:
}
BUG_ON(!err);
- set_bit(BCH_FS_ERROR, &c->flags);
goto out;
}