From: Matthew Wilcox <willy@infradead.org>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: brauner@kernel.org, hch@infradead.org, djwong@kernel.org,
bfoster@redhat.com, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v5 1/1] iomap: fix invalid folio access after folio_end_read()
Date: Mon, 26 Jan 2026 23:54:57 +0000 [thread overview]
Message-ID: <aXf-0c8uLowOW8NQ@casper.infradead.org> (raw)
In-Reply-To: <20260126224107.2182262-2-joannelkoong@gmail.com>
On Mon, Jan 26, 2026 at 02:41:07PM -0800, Joanne Koong wrote:
> If the folio does not have an iomap_folio_state (ifs) attached and the
> folio gets read in by the filesystem's IO helper, folio_end_read() will
> be called by the IO helper at any time. For this case, we cannot access
> the folio after dispatching it to the IO helper, eg subsequent accesses
> like
>
> if (ctx->cur_folio &&
> offset_in_folio(ctx->cur_folio, iter->pos) == 0) {
>
> are incorrect.
>
> Fix these invalid accesses by invalidating ctx->cur_folio if all bytes
> of the folio have been read in by the IO helper.
>
> This allows us to also remove the +1 bias added for the ifs case. The
> bias was previously added to ensure that if all bytes are read in, the
> IO helper does not end the read on the folio until iomap has decremented
> the bias.
>
> Fixes: b2f35ac4146d ("iomap: add caller-provided callbacks for read and readahead")
> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
next prev parent reply other threads:[~2026-01-26 23:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 22:41 [PATCH v5 0/1] iomap: fix invalid folio access after folio_end_read() Joanne Koong
2026-01-26 22:41 ` [PATCH v5 1/1] " Joanne Koong
2026-01-26 23:54 ` Matthew Wilcox [this message]
2026-01-27 5:10 ` Christoph Hellwig
2026-01-29 12:42 ` [PATCH v5 0/1] " Christian Brauner
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=aXf-0c8uLowOW8NQ@casper.infradead.org \
--to=willy@infradead.org \
--cc=bfoster@redhat.com \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@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