bcachefs: Ensure we flush btree updates in evacuate path

This fixes a possible race where we fail to remove a device because of
btree nodes still on it, that are being deleted by in flight btree
updates.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2021-10-24 17:00:33 -04:00 committed by Kent Overstreet
parent f3cf0999ac
commit 23af498cc4

View File

@ -932,6 +932,10 @@ next:
if (ret)
bch_err(c, "error %i in bch2_move_btree", ret);
/* flush relevant btree updates */
closure_wait_event(&c->btree_interior_update_wait,
!bch2_btree_interior_updates_nr_pending(c));
progress_list_del(c, stats);
return ret;
}
@ -1075,10 +1079,6 @@ int bch2_data_job(struct bch_fs *c,
op.start_btree, op.start_pos,
op.end_btree, op.end_pos,
rereplicate_btree_pred, c, stats) ?: ret;
closure_wait_event(&c->btree_interior_update_wait,
!bch2_btree_interior_updates_nr_pending(c));
ret = bch2_replicas_gc2(c) ?: ret;
ret = bch2_move_data(c,