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 19:01:03 +0000 (21:01 +0200)
commit34681aeddcfcc0c47d45154f5d39310def87c55f
tree6491006b8c50ea60d538cc10c591d4dc14c33e18
parent7a506fabcfe1a58bcdf6dd18fa3fca42635235f0
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