summaryrefslogtreecommitdiff
path: root/fs/bcachefs/move.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-12-21 05:42:19 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:50 +0300
commitf0e70018d14ef94a5f680c977591ccb6cf29e9ca (patch)
tree73ed1782d13e819834b3290fbeae2cffbb0f2067 /fs/bcachefs/move.c
parent07bd4c285b79e068d2e6986a4cc60703434f1eed (diff)
downloadlinux-f0e70018d14ef94a5f680c977591ccb6cf29e9ca.tar.xz
bcachefs: Fix iterator overflow in move path
The move path was calling bch2_bucket_io_time_reset() for cached pointers (which it shouldn't have been), and then not calling bch2_trans_reset() when it got -EINTR (indicating transaction restart). Oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/move.c')
-rw-r--r--fs/bcachefs/move.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 62a6bbd676ae..1b1a14d2fa23 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -611,6 +611,12 @@ peek:
ret2 = bch2_move_extent(&trans, ctxt, wp, io_opts, btree_id, k,
data_cmd, data_opts);
if (ret2) {
+ if (ret2 == -EINTR) {
+ bch2_trans_reset(&trans, 0);
+ bch2_trans_cond_resched(&trans);
+ continue;
+ }
+
if (ret2 == -ENOMEM) {
/* memory allocation failure, wait for some IO to finish */
bch2_move_ctxt_wait_for_io(ctxt);