All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] fixes for btrfs_read_folio races
@ 2024-12-13 23:13 Boris Burkov
  2024-12-13 23:13 ` [PATCH 1/2] btrfs: fix btrfs_read_folio race in relocation Boris Burkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Boris Burkov @ 2024-12-13 23:13 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

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(+)

-- 
2.47.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-12-13 23:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-13 23:13 [PATCH 0/2] fixes for btrfs_read_folio races Boris Burkov
2024-12-13 23:13 ` [PATCH 1/2] btrfs: fix btrfs_read_folio race in relocation Boris Burkov
2024-12-13 23:13 ` [PATCH 2/2] btrfs: fix btrfs_read_folio race in send Boris Burkov
2024-12-13 23:17 ` [PATCH 0/2] fixes for btrfs_read_folio races Qu Wenruo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.