All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	brauner@kernel.org, hch@infradead.org, bfoster@redhat.com,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] iomap: fix readahead folio refcounting race
Date: Fri, 16 Jan 2026 18:30:02 -0800	[thread overview]
Message-ID: <20260117023002.GD15532@frogsfrogsfrogs> (raw)
In-Reply-To: <CAJnrk1YJFV5aE2U6bK1PpTBp5tfkRzBK5o24AhidYFUfQnQjNQ@mail.gmail.com>

On Fri, Jan 16, 2026 at 02:02:20PM -0800, Joanne Koong wrote:
> On Fri, Jan 16, 2026 at 1:45 PM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Fri, Jan 16, 2026 at 10:36:25AM -0800, Joanne Koong wrote:
> > > On Thu, Jan 15, 2026 at 6:52 PM Matthew Wilcox <willy@infradead.org> wrote:
> > > >
> > > > > +                     if (!ifs) {
> > > > > +                             ctx->cur_folio = NULL;
> > > > > +                             if (unlikely(plen != folio_len))
> > > > > +                                 return -EIO;
> > > >
> > > > This should be indented with a tab, not four spaces.  Can it even
> > > > happen?  If we didn't attach an ifs, can we do a short read?
> > >
> > > The short read can happen if the filesystem sets the iomap length to a
> > > size that's less than the folio size. plen is determined by
> > > iomap_length() (which returns the minimum of the iter->len and the
> > > iomap length value the filesystem set).
> >
> > Understood, but if plen is less than folio_size(), don't we allocate
> > an ifs?  So !ifs && plen < folio_size() shouldn't be possible?  Or have
> > I misunderstood this part?
> 
> Maybe I'm misunderstanding this, but I'm pretty sure the ifs is only
> allocated if the inode's block size is less than the folio size, and
> is not based on plen. The logic I'm looking at is the code inside
> ifs_alloc().

Hrmm.  If there's no ifs then blocksize == foliosize, so if
plen < foliosize then that means we're not fully reading in the folio
contents?  That doesn't sound good, especially if the folio can be
mmapped into someone's address space.

--D

> Thanks,
> Joanne
> 

  reply	other threads:[~2026-01-17  2:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16  1:54 [PATCH v2 0/1] iomap: fix readahead folio refcounting race Joanne Koong
2026-01-16  1:54 ` [PATCH v2 1/1] " Joanne Koong
2026-01-16  2:52   ` Matthew Wilcox
2026-01-16 18:36     ` Joanne Koong
2026-01-16 21:45       ` Matthew Wilcox
2026-01-16 22:02         ` Joanne Koong
2026-01-17  2:30           ` Darrick J. Wong [this message]
2026-01-21  0:34             ` Joanne Koong
2026-01-21  1:07               ` Matthew Wilcox
2026-01-21  4:12                 ` Joanne Koong
2026-01-21  4:42                   ` Matthew Wilcox
2026-01-21  5:51                     ` Joanne Koong

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=20260117023002.GD15532@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=brauner@kernel.org \
    --cc=hch@infradead.org \
    --cc=joannelkoong@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=willy@infradead.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 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.