[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250224141744.GA1088@lst.de>
Date: Mon, 24 Feb 2025 15:17:44 +0100
From: Christoph Hellwig <hch@....de>
To: "Raphael S. Carvalho" <raphaelsc@...lladb.com>
Cc: linux-kernel@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
djwong@...nel.org, Dave Chinner <david@...morbit.com>, hch@....de,
willy@...radead.org
Subject: Re: [PATCH v2] mm: Fix error handling in __filemap_get_folio()
with FGP_NOWAIT
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.
*/
Powered by blists - more mailing lists