summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-04-24 14:08:56 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:39 -0400
commit2c480a7102f20c22315b45fcc79d63078e51b13d (patch)
tree754a9e520d0cf8f2ff57c3aa86c55d745c8392a4 /fs
parent41697f382cffc0e396dd832d19c78e69cdd10aa3 (diff)
bcachefs: Handle -EINTR bch2_migrate_index_update()
peek_slot() shouldn't return -EINTR when there's only a single live iterator, but that's tricky to guarantee - we seem to be returning -EINTR when we shouldn't, but it's easy enough to handle in the caller. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/move.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index a9a72963e1b7..882e86e70db7 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -69,19 +69,26 @@ static int bch2_migrate_index_update(struct bch_write_op *op)
BTREE_ITER_SLOTS|BTREE_ITER_INTENT);
while (1) {
- struct bkey_s_c k = bch2_btree_iter_peek_slot(iter);
+ struct bkey_s_c k;
struct bkey_i *insert;
- struct bkey_i_extent *new =
- bkey_i_to_extent(bch2_keylist_front(keys));
+ struct bkey_i_extent *new;
BKEY_PADDED(k) _new, _insert;
const union bch_extent_entry *entry;
struct extent_ptr_decoded p;
bool did_work = false;
int nr;
+ bch2_trans_reset(&trans, 0);
+
+ k = bch2_btree_iter_peek_slot(iter);
ret = bkey_err(k);
- if (ret)
+ if (ret) {
+ if (ret == -EINTR)
+ continue;
break;
+ }
+
+ new = bkey_i_to_extent(bch2_keylist_front(keys));
if (bversion_cmp(k.k->version, new->k.version) ||
!bch2_bkey_matches_ptr(c, k, m->ptr, m->offset))