From 8d65e475b20610854419fef8dba155200b45a687 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sat, 12 Feb 2022 02:32:11 -0500 Subject: [PATCH] bcachefs: Always check for bucket reuse after read Since dirty extents can be moved or overwritten, it's not just cached data that we need the ptr_stale() check in bc2h_read_endio for - this fixes data checksum errors seen in the tiering ktest tests. Signed-off-by: Kent Overstreet --- fs/bcachefs/io.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c index d69e63e519bf9..f172da9229045 100644 --- a/fs/bcachefs/io.c +++ b/fs/bcachefs/io.c @@ -1972,9 +1972,8 @@ static void bch2_read_endio(struct bio *bio) return; } - if (rbio->pick.ptr.cached && - (((rbio->flags & BCH_READ_RETRY_IF_STALE) && race_fault()) || - ptr_stale(ca, &rbio->pick.ptr))) { + if (((rbio->flags & BCH_READ_RETRY_IF_STALE) && race_fault()) || + ptr_stale(ca, &rbio->pick.ptr)) { atomic_long_inc(&c->read_realloc_races); if (rbio->flags & BCH_READ_RETRY_IF_STALE) -- 2.39.5