]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY
authorBenjamin Coddington <bcodding@redhat.com>
Thu, 10 Jul 2025 01:47:43 +0000 (21:47 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:09:01 +0000 (12:09 +0200)
commit75ed1f6ed8ee68067fda6ae9d1e4904d48eb2838
treee7338d529748bcbe65cedadea9129847aa047007
parent1116e66111f8f582e34cc143010d05bf9ce2ca15
NFS: Fixup allocation flags for nfsiod's __GFP_NORETRY

[ Upstream commit 99765233ab42bf7a4950377ad7894dce8a5c0e60 ]

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@kernel.org>
Fixes: 0bae835b63c5 ("NFS: Avoid writeback threads getting stuck in mempool_alloc()")
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Tested-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/f83ac1155a4bc670f2663959a7a068571e06afd9.1752111622.git.bcodding@redhat.com
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/internal.h