From: Boris Burkov <boris@bur.io>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 0/2] fixes for btrfs_read_folio races
Date: Fri, 13 Dec 2024 15:13:12 -0800 [thread overview]
Message-ID: <cover.1734131353.git.boris@bur.io> (raw)
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
next reply other threads:[~2024-12-13 23:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 23:13 Boris Burkov [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1734131353.git.boris@bur.io \
--to=boris@bur.io \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox