lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <315CF087-770E-464A-A4D5-70FA658357BA@redhat.com>
Date: Tue, 22 Jul 2025 11:12:48 -0400
From: Benjamin Coddington <bcodding@...hat.com>
To: Trond Myklebust <trondmy@...nel.org>, Anna Schumaker <anna@...nel.org>
Cc: linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org,
 Laurence Oberman <loberman@...hat.com>, Jeff Layton <jlayton@...nel.org>,
 Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH v3] NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY

Gentle ping on this one - let me know if anyone has further review or
critique.

Ben

On 9 Jul 2025, at 21:47, Benjamin Coddington wrote:

> If the NFS client is doing writeback from a workqueue context, avoid using
> __GFP_NORETRY for allocations if the task has set PF_MEMALLOC_NOIO or
> PF_MEMALLOC_NOFS.  The combination of these flags makes memory allocation
> failures much more likely.
>
> We've seen those allocation failures show up when the loopback driver is
> doing writeback from a workqueue to a file on NFS, where memory allocation
> failure results in errors or corruption within the loopback device's
> filesystem.
>
> Suggested-by: Trond Myklebust <trondmy@...nel.org>
> Fixes: 0bae835b63c5 ("NFS: Avoid writeback threads getting stuck in mempool_alloc()")
> Signed-off-by: Benjamin Coddington <bcodding@...hat.com>
> Reviewed-by: Laurence Oberman <loberman@...hat.com>
> Tested-by: Laurence Oberman <loberman@...hat.com>
> Reviewed-by: Jeff Layton <jlayton@...nel.org>
> ---
>
> 	On V3: fix ugly return (Thanks Paulo), add Jeff's R-b
> 	On V2: add missing 'Fixes' and Laurence's R-b T-b
>
>  fs/nfs/internal.h | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
> index 69c2c10ee658..d8f768254f16 100644
> --- a/fs/nfs/internal.h
> +++ b/fs/nfs/internal.h
> @@ -671,9 +671,12 @@ nfs_write_match_verf(const struct nfs_writeverf *verf,
>
>  static inline gfp_t nfs_io_gfp_mask(void)
>  {
> -	if (current->flags & PF_WQ_WORKER)
> -		return GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN;
> -	return GFP_KERNEL;
> +	gfp_t ret = current_gfp_context(GFP_KERNEL);
> +
> +	/* For workers __GFP_NORETRY only with __GFP_IO or __GFP_FS */
> +	if ((current->flags & PF_WQ_WORKER) && ret == GFP_KERNEL)
> +		ret |= __GFP_NORETRY | __GFP_NOWARN;
> +	return ret;
>  }
>
>  /*
> -- 
> 2.47.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ