From: "Raphael S. Carvalho" <raphaelsc@scylladb.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>,
linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
djwong@kernel.org, Dave Chinner <david@fromorbit.com>
Subject: Re: [PATCH v2] mm: Fix error handling in __filemap_get_folio() with FGP_NOWAIT
Date: Mon, 24 Feb 2025 12:50:48 -0300 [thread overview]
Message-ID: <CAKhLTr26AEbwyTrTgw0GF4_FSxfKC2rdJ79vsAwqwrWG8bakwg@mail.gmail.com> (raw)
In-Reply-To: <Z7yVB0w7YoY_DrNz@casper.infradead.org>
On Mon, Feb 24, 2025 at 12:49 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Mon, Feb 24, 2025 at 12:45:21PM -0300, Raphael S. Carvalho wrote:
> > On Mon, Feb 24, 2025 at 12:33 PM Matthew Wilcox <willy@infradead.org> wrote:
> > >
> > > On Mon, Feb 24, 2025 at 03:17:44PM +0100, Christoph Hellwig wrote:
> > > > On Mon, Feb 24, 2025 at 05:13:28AM -0300, Raphael S. Carvalho wrote:
> > > > > + if (err) {
> > > > > + /* Prevents -ENOMEM from escaping to user space with FGP_NOWAIT */
> > > > > + if ((fgp_flags & FGP_NOWAIT) && err == -ENOMEM)
> > > > > + err = -EAGAIN;
> > > > > return ERR_PTR(err);
> > > >
> > > > I don't think the comment is all that useful. It's also overly long.
> > > >
> > > > I'd suggest this instead:
> > > >
> > > > /*
> > > > * When NOWAIT I/O fails to allocate folios this could
> > > > * be due to a nonblocking memory allocation and not
> > > > * because the system actually is out of memory.
> > > > * Return -EAGAIN so that there caller retries in a
> > > > * blocking fashion instead of propagating -ENOMEM
> > > > * to the application.
> > > > */
> > >
> > > I don't think it needs a comment at all, but the memory allocation
> > > might be for something other than folios, so your suggested comment
> > > is misleading.
> >
> > Isn't it all in the context of allocating or adding folio? The reason
> > behind a comment is to prevent movements in the future that could
> > cause a similar regression, and also to inform the poor reader that
> > might be left wondering why we're converting -ENOMEM into -EAGAIN with
> > FGP_NOWAIT. Can it be slightly adjusted to make it more correct? Or
> > you really think it's better to remove it completely?
>
> I really don't think the comment is needed. This is a common mistake
> when fixing a bug.
Ok, so I will proceed with v4 now, removing the comment.
next prev parent reply other threads:[~2025-02-24 15:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 8:13 Raphael S. Carvalho
2025-02-24 14:17 ` Christoph Hellwig
2025-02-24 15:33 ` Matthew Wilcox
2025-02-24 15:45 ` Raphael S. Carvalho
2025-02-24 15:49 ` Matthew Wilcox
2025-02-24 15:50 ` Raphael S. Carvalho [this message]
2025-02-24 15:51 ` Matthew Wilcox
2025-02-24 15:52 ` Raphael S. Carvalho
2025-02-24 15:56 ` Christoph Hellwig
2025-02-24 16:02 ` Christoph Hellwig
2025-02-24 16:15 ` Raphael S. Carvalho
2025-02-25 16:04 ` Raphael S. Carvalho
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=CAKhLTr26AEbwyTrTgw0GF4_FSxfKC2rdJ79vsAwqwrWG8bakwg@mail.gmail.com \
--to=raphaelsc@scylladb.com \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox