summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/move.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-02-15 00:06:59 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:24 -0400
commiteb331fe5a4e801dc11d96ba7fbda0a91c8bd626c (patch)
treebb8144cd4214f0bf41f7e8f680c1a09d8d4adda7 /fs/bcachefs/move.c
parentfcf01959eaa828b1005f8f30732949e64edb8c4d (diff)
downloadlinux-stable-eb331fe5a4e801dc11d96ba7fbda0a91c8bd626c.tar.gz
linux-stable-eb331fe5a4e801dc11d96ba7fbda0a91c8bd626c.tar.bz2
linux-stable-eb331fe5a4e801dc11d96ba7fbda0a91c8bd626c.zip
bcachefs: Check for stale dirty pointer before reads
Since we retry reads when we discover we read from a pointer that went stale, if a dirty pointer is erroniously stale it would cause us to loop retrying that read forever - unless we check before issuing the read, while the btree is still locked, when we know that a dirty pointer should never be stale. This patch adds that check, along with printing some helpful debug info. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/move.c')
-rw-r--r--fs/bcachefs/move.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 04971bf847bf..4751d79219cb 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -752,10 +752,12 @@ static int __bch2_move_data(struct bch_fs *c,
BUG();
}
- /* unlock before doing IO: */
+ /*
+ * The iterator gets unlocked by __bch2_read_extent - need to
+ * save a copy of @k elsewhere:
+ */
bch2_bkey_buf_reassemble(&sk, c, k);
k = bkey_i_to_s_c(sk.k);
- bch2_trans_unlock(&trans);
ret2 = bch2_move_extent(&trans, ctxt, wp, io_opts, btree_id, k,
data_cmd, data_opts);