summaryrefslogtreecommitdiff
path: root/fs/bcachefs/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-10-07 21:53:21 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:13 +0300
commita9cb0a6706038292bbc22f50546859783ac492bc (patch)
tree0afd3bc2766eea73a083988e06e3a7037efbb0e2 /fs/bcachefs/super.c
parent97996ddfdb9b0b4df22913d04ce01a069a944430 (diff)
downloadlinux-a9cb0a6706038292bbc22f50546859783ac492bc.tar.xz
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 <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r--fs/bcachefs/super.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index a861ec32dbde..db38d6b0f2ad 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),