Skip to content

fixes for btrfs_read_folio races

Boris Burkov linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: fix btrfs_read_folio race in relocationfs/btrfs/relocation.c+6 -00 replies
2/2btrfs: fix btrfs_read_folio race in sendfs/btrfs/send.c+6 -00 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchQu Wenruo
SeriesR-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] fixes for btrfs_read_folio races

We have a common pattern of getting a folio (locked) checking if it is uptodate, then reading it with btrfs_read_folio if it is not.

btrfs_read_folio returns the folio unlocked, so we immediately lock it again with folio_lock. However, in the time that it is unlocked, a different thread can modify folio->mapping (like set it NULL with an invalidate) so we must also check that folio->mapping is still what we expect after folio_lock. Most users of btrfs_read_folio do it correctly (retry on mismatched folio->mapping), and this series tidies up a couple that were doing it wrong.

Boris Burkov (2):
btrfs: fix btrfs_read_folio race in relocation
btrfs: fix btrfs_read_folio race in send

 fs/btrfs/relocation.c | 6 ++++++
 fs/btrfs/send.c       | 6 ++++++
 2 files changed, 12 insertions(+)
Signature · 1 line
2.47.0