NFS: nfsiod should not block forever in mempool_alloc()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 21 Mar 2022 16:34:19 +0000 (12:34 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Apr 2022 18:59:13 +0000 (20:59 +0200)
commitda747de6859948e75bcaaa1019ef0f7fdaf0b867
tree8da2125b671b2a3e89da0e0ebb0786f0cf159d4a
parente04ef859d6c657e023702fe1109e4196a3e64011
NFS: nfsiod should not block forever in mempool_alloc()

[ Upstream commit 515dcdcd48736576c6f5c197814da6f81c60a21e ]

The concern is that since nfsiod is sometimes required to kick off a
commit, it can get locked up waiting forever in mempool_alloc() instead
of failing gracefully and leaving the commit until later.

Try to allocate from the slab first, with GFP_KERNEL | __GFP_NORETRY,
then fall back to a non-blocking attempt to allocate from the memory
pool.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/internal.h
fs/nfs/pnfs_nfs.c
fs/nfs/write.c
include/linux/nfs_fs.h