linux-stable/fs/nfs
NeilBrown 518662e0fc NFS: fix usage of mempools.
When passed GFP flags that allow sleeping (such as
GFP_NOIO), mempool_alloc() will never return NULL, it will
wait until memory is available.

This means that we don't need to handle failure, but that we
do need to ensure one thread doesn't call mempool_alloc()
twice on the one pool without queuing or freeing the first
allocation.  If multiple threads did this during times of
high memory pressure, the pool could be exhausted and a
deadlock could result.

pnfs_generic_alloc_ds_commits() attempts to allocate from
the nfs_commit_mempool while already holding an allocation
from that pool.  This is not safe.  So change
nfs_commitdata_alloc() to take a flag that indicates whether
failure is acceptable.

In pnfs_generic_alloc_ds_commits(), accept failure and
handle it as we currently do.  Else where, do not accept
failure, and do not handle it.

Even when failure is acceptable, we want to succeed if
possible.  That means both
 - using an entry from the pool if there is one
 - waiting for direct reclaim is there isn't.

We call mempool_alloc(GFP_NOWAIT) to achieve the first, then
kmem_cache_alloc(GFP_NOIO|__GFP_NORETRY) to achieve the
second.  Each of these can fail, but together they do the
best they can without blocking indefinitely.

The objects returned by kmem_cache_alloc() will still be freed
by mempool_free().  This is safe as mempool_alloc() uses
exactly the same function to allocate objects (since the mempool
was created with mempool_create_slab_pool()).  The object returned
by mempool_alloc() and kmem_cache_alloc() are indistinguishable
so mempool_free() will handle both identically, either adding to the
pool or calling kmem_cache_free().

Also, don't test for failure when allocating from
nfs_wdata_mempool.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
2017-04-20 13:44:05 -04:00
..
blocklayout lib/vsprintf.c: remove %Z support 2017-02-27 18:43:47 -08:00
filelayout NFS client fixes for 4.11 (part 2) 2017-03-31 12:29:03 -07:00
flexfilelayout nfs: flexfilelayout: remove v3-only data server limitation 2017-04-20 13:35:24 -04:00
objlayout lib/vsprintf.c: remove %Z support 2017-02-27 18:43:47 -08:00
cache_lib.c sunrpc/nfs: cleanup procfs/pipefs entry in cache_detail 2017-02-08 17:02:45 -05:00
cache_lib.h
callback.c NFS client fixes for 4.11 2017-03-17 14:16:22 -07:00
callback.h nfs: add handling for CB_NOTIFY_LOCK in client 2016-09-22 13:56:04 -04:00
callback_proc.c NFS: Remove extra dprintk()s from callback_proc.c 2017-04-20 13:39:32 -04:00
callback_xdr.c NFS: Remove extra dprintk()s from callback_xdr.c 2017-04-20 13:39:33 -04:00
client.c NFS: Clean up extra dprintk()s in client.c 2017-04-20 13:39:33 -04:00
delegation.c NFSv4: Optimise away forced revalidation when we know the attributes are OK 2016-12-01 17:21:37 -05:00
delegation.h NFSv4: nfs_inode_find_state_and_recover() should check all stateids 2016-09-27 14:34:35 -04:00
dir.c NFS: switch back to to ->iterate() 2017-04-20 13:33:09 -04:00
direct.c NFS: Clean up nfs_direct_commit_complete() 2017-04-20 13:39:33 -04:00
dns_resolve.c
dns_resolve.h
file.c mm, fs: reduce fault, page_mkwrite, and pfn_mkwrite to take only vmf 2017-02-24 17:46:54 -08:00
fscache-index.c
fscache.c
fscache.h
getroot.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
inode.c Merge branch 'rebased-statx' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-03-03 11:38:56 -08:00
internal.h pNFS: return status from nfs4_pnfs_ds_connect 2017-03-17 16:07:10 -04:00
io.c NFS: Do not serialise O_DIRECT reads and writes 2016-07-05 19:11:04 -04:00
iostat.h
Kconfig
Makefile NFS: Do not serialise O_DIRECT reads and writes 2016-07-05 19:11:04 -04:00
mount_clnt.c NFS: Remove unneeded NFS_DEBUG checking before define NFSDBG_FACILITY 2015-10-21 15:49:23 -05:00
namespace.c NFS: Remove extra dprintk()s from namespace.c 2017-04-20 13:39:34 -04:00
netns.h netns: make struct pernet_operations::id unsigned int 2016-11-18 10:59:15 -05:00
nfs.h
nfs2super.c
nfs2xdr.c
nfs3_fs.h
nfs3acl.c posix_acl: Inode acl caching fixes 2016-03-31 00:30:15 -04:00
nfs3client.c NFS: Remove unused authflavour parameter from nfs_get_client() 2016-12-01 17:46:32 -05:00
nfs3proc.c vfs: Remove {get,set,remove}xattr inode operations 2016-10-07 21:48:36 -04:00
nfs3super.c
nfs3xdr.c xprtrdma: Fix large NFS SYMLINK calls 2015-08-05 16:21:28 -04:00
nfs4_fs.h NFS: Use nfs4_setup_sequence() everywhere 2017-01-30 13:14:50 -05:00
nfs4client.c NFS: Remove extra dprintk()s from nfs4client.c 2017-04-20 13:39:35 -04:00
nfs4file.c NFSv4: add flock_owner to open context 2016-12-01 17:57:27 -05:00
nfs4getroot.c NFS: Clean up nfs4_get_rootfh() 2017-04-20 13:39:35 -04:00
nfs4idmap.c KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload() 2017-03-02 10:09:00 +11:00
nfs4idmap.h
nfs4namespace.c NFS: Remove extra dprintk()s from nfs4namespace.c 2017-04-20 13:39:35 -04:00
nfs4proc.c NFS: Clean up nfs4_proc_get_lease_time() 2017-04-20 13:39:35 -04:00
nfs4renewd.c NFSv4: Set the connection timeout to match the lease period 2017-02-09 14:15:16 -05:00
nfs4session.c NFSv4.1: Fix regression in callback retry handling 2016-12-01 17:21:38 -05:00
nfs4session.h NFS: Make trace_nfs4_setup_sequence() available to NFS v4.0 2017-01-30 13:14:50 -05:00
nfs4state.c NFSv4: Fix warning for using 0 as NULL 2017-01-30 13:14:51 -05:00
nfs4super.c
nfs4sysctl.c nfs: do not initialise statics to 0 2015-12-28 09:57:15 -05:00
nfs4trace.c pNFS: Modify pnfs_update_layout tracepoints to use layout stateid 2015-12-28 09:57:14 -05:00
nfs4trace.h NFS: Make trace_nfs4_setup_sequence() available to NFS v4.0 2017-01-30 13:14:50 -05:00
nfs4xdr.c nfs4: fix a typo of NFS_ATTR_FATTR_GROUP_NAME 2017-03-13 10:39:10 -04:00
nfs42.h NFS: Add COPY nfs operation 2016-05-17 15:47:55 -04:00
nfs42proc.c NFS: Clean up nfs42_layoutstat_done() 2017-04-20 13:39:34 -04:00
nfs42xdr.c pNFS/flexfiles: Minor refactoring before adding iostats to layoutreturn 2016-12-03 15:37:45 -05:00
nfsroot.c nfsroot: make nfsroot to accept the 1024 bytes long directory name 2015-10-21 15:49:19 -05:00
nfstrace.c
nfstrace.h NFS client updates for Linux 4.8 2016-07-30 16:33:25 -07:00
pagelist.c NFS: discard nfs_lockowner structure. 2016-12-01 17:58:13 -05:00
pnfs.c pNFS: Fix a reference leak in _pnfs_return_layout 2017-01-26 15:50:41 -05:00
pnfs.h pNFS: return status from nfs4_pnfs_ds_connect 2017-03-17 16:07:10 -04:00
pnfs_dev.c
pnfs_nfs.c NFS: fix usage of mempools. 2017-04-20 13:44:05 -04:00
proc.c fs: rename "rename2" i_op to "rename" 2016-09-27 11:03:58 +02:00
read.c mm: remove page_file_index 2016-10-07 18:46:28 -07:00
super.c NFS: tidy up nfs_show_mountd_netid 2017-01-30 13:14:50 -05:00
symlink.c vfs: remove ".readlink = generic_readlink" assignments 2016-12-09 16:45:04 +01:00
sysctl.c
unlink.c qstr: constify instances in nfs 2016-07-20 23:30:06 -04:00
write.c NFS: fix usage of mempools. 2017-04-20 13:44:05 -04:00