From a9cb0a6706038292bbc22f50546859783ac492bc Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 7 Oct 2021 14:53:21 -0400 Subject: [PATCH] bcachefs: Fix bch2_dev_remove_alloc() It was missing a lockrestart_do(), to call bch2_trans_begin() and also handle transaction restarts. Signed-off-by: Kent Overstreet --- fs/bcachefs/super.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index a861ec32dbdec..db38d6b0f2ade 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -1458,15 +1458,18 @@ static int bch2_dev_remove_alloc(struct bch_fs *c, struct bch_dev *ca) bch2_trans_init(&trans, c, 0, 0); for (i = 0; i < ca->mi.nbuckets; i++) { - ret = bch2_btree_key_cache_flush(&trans, - BTREE_ID_alloc, POS(ca->dev_idx, i)); + ret = lockrestart_do(&trans, + bch2_btree_key_cache_flush(&trans, + BTREE_ID_alloc, POS(ca->dev_idx, i))); if (ret) break; } bch2_trans_exit(&trans); - if (ret) + if (ret) { + bch_err(c, "error %i removing dev alloc info", ret); return ret; + } return bch2_btree_delete_range(c, BTREE_ID_alloc, POS(ca->dev_idx, 0), -- 2.30.2