]> git.hungrycats.org Git - linux/commit
btrfs: don't cache rbio if an error is hit
authorQu Wenruo <wqu@suse.com>
Wed, 28 Oct 2026 06:30:47 +0000 (17:00 +1030)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Oct 2026 20:36:19 +0000 (21:36 +0100)
commitf750b1dd48985d6cdfbdb6c458d3c2cafe9ed8fe
treefacd7cc3aff249e32b232ac01da26d6d57f49d26
parent2976d37925785a9b6b85604526178d1da9020090
btrfs: don't cache rbio if an error is hit

If rmw_rbio() hit an error after cache_rbio_pages() call, the rbio still
have RBIO_CACHE_READY_BIT set, thus can be utilized for future page
stealing.

But that rbio didn't really reach the disk, thus using the pages for
future steal can cause data inconsistency between in-memory cache and
on-disk data.

Fix the problem by clearing the RBIO_CACHE_READY_BIT on the error path
of rmw_rbio().

Fixes: 5eb30ee26fa4 ("btrfs: raid56: introduce the main entrance for RMW path")
Assisted-by: LLM (find the bug)
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid56.c