linux/fs/nfs
NeilBrown ec52361df9 SUNRPC: stop using ->sv_nrthreads as a refcount
The use of sv_nrthreads as a general refcount results in clumsy code, as
is seen by various comments needed to explain the situation.

This patch introduces a 'struct kref' and uses that for reference
counting, leaving sv_nrthreads to be a pure count of threads.  The kref
is managed particularly in svc_get() and svc_put(), and also nfsd_put();

svc_destroy() now takes a pointer to the embedded kref, rather than to
the serv.

nfsd allows the svc_serv to exist with ->sv_nrhtreads being zero.  This
happens when a transport is created before the first thread is started.
To support this, a 'keep_active' flag is introduced which holds a ref on
the svc_serv.  This is set when any listening socket is successfully
added (unless there are running threads), and cleared when the number of
threads is set.  So when the last thread exits, the nfs_serv will be
destroyed.
The use of 'keep_active' replaces previous code which checked if there
were any permanent sockets.

We no longer clear ->rq_server when nfsd() exits.  This was done
to prevent svc_exit_thread() from calling svc_destroy().
Instead we take an extra reference to the svc_serv to prevent
svc_destroy() from being called.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-12-13 13:42:51 -05:00
..
blocklayout nfs/blocklayout: use bdev_nr_bytes instead of open coding it 2021-10-18 14:43:23 -06:00
filelayout SUNRPC: Trace calls to .rpc_call_done 2021-10-20 18:09:54 -04:00
flexfilelayout SUNRPC: Trace calls to .rpc_call_done 2021-10-20 18:09:54 -04:00
cache_lib.c
cache_lib.h
callback_proc.c NFSv4.2 add tracepoint to CB_OFFLOAD 2021-11-04 19:43:30 -04:00
callback_xdr.c SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
callback.c SUNRPC: stop using ->sv_nrthreads as a refcount 2021-12-13 13:42:51 -05:00
callback.h NFSv4: Add support for CB_RECALL_ANY for flexfiles layouts 2020-03-16 08:34:30 -04:00
client.c NFS: Remove the nfs4_label from the nfs4_getattr_res 2021-11-05 14:54:39 -04:00
delegation.c NFSv4: Fixes for nfs4_inode_return_delegation() 2021-10-20 18:09:53 -04:00
delegation.h NFSv4: Fix delegation return in cases where we have to retry 2021-06-13 19:36:27 -04:00
dir.c NFS: Remove the nfs4_label argument from nfs_setsecurity 2021-11-05 14:54:40 -04:00
direct.c NFS client updates for Linux 5.16 2021-11-10 16:32:46 -08:00
dns_resolve.c NFS: remove duplicate headers 2020-05-27 10:10:12 -04:00
dns_resolve.h
export.c NFS: Remove the nfs4_label argument from nfs_fhget() 2021-11-05 14:54:40 -04:00
file.c locks: remove LOCK_MAND flock lock support 2021-09-10 16:21:44 -04:00
fs_context.c NFSv4 introduce max_connect mount options 2021-08-27 16:37:17 -04:00
fscache-index.c nfs: fscache: use timespec64 in inode auxdata 2020-01-15 10:54:30 -05:00
fscache.c NFS: Fix fscache read from NFS after cache error 2021-07-08 14:03:26 -04:00
fscache.h nfs: fscache: use timespec64 in inode auxdata 2020-01-15 10:54:30 -05:00
getroot.c NFS: Remove the nfs4_label argument from nfs_setsecurity 2021-11-05 14:54:40 -04:00
inode.c NFS: Add a tracepoint to show the results of nfs_set_cache_invalid() 2021-11-17 14:08:23 -05:00
internal.h NFS: Create a new nfs_alloc_fattr_with_label() function 2021-11-05 14:54:38 -04:00
io.c NFS: Fix up incorrect documentation 2021-04-05 09:04:20 -04:00
iostat.h
Kconfig nfs: fix PNFS_FLEXFILE_LAYOUT Kconfig default 2021-03-08 11:47:47 -05:00
Makefile NFSv4.2: add client side xattr caching. 2020-07-13 17:52:46 -04:00
mount_clnt.c nfs: hornor timeo and retrans option when mounting NFSv3 2021-04-05 09:04:21 -04:00
namespace.c NFS: Remove the label from the nfs4_lookup_res struct 2021-11-05 14:54:39 -04:00
netns.h NFS: Add sysfs support for per-container identifier 2019-07-06 14:54:49 -04:00
nfs2super.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
nfs2xdr.c SUNRPC: Clean up the handling of page padding in rpc_prepare_reply_pages() 2020-12-02 14:05:53 -05:00
nfs3_fs.h vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
nfs3acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
nfs3client.c NFS: Additional refactoring for fs_context conversion 2020-01-15 10:15:17 -05:00
nfs3proc.c NFS: Remove the nfs4_label argument from nfs_add_or_obtain() 2021-11-05 14:54:39 -04:00
nfs3super.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
nfs3xdr.c NFS: Default change_attr_type to NFS4_CHANGE_TYPE_IS_UNDEFINED 2021-10-03 20:49:06 -04:00
nfs4_fs.h NFS: Remove the nfs4_label from the nfs4_getattr_res 2021-11-05 14:54:39 -04:00
nfs4client.c NFS: Replace calls to nfs_probe_fsinfo() with nfs_probe_server() 2021-10-20 18:09:54 -04:00
nfs4file.c NFS: Remove the nfs4_label argument from nfs_fhget() 2021-11-05 14:54:40 -04:00
nfs4getroot.c
nfs4idmap.c Fix user namespace leak 2021-10-20 18:09:54 -04:00
nfs4idmap.h
nfs4namespace.c nfs: Fix memory leak of export_path 2020-06-26 08:43:14 -04:00
nfs4proc.c NFS client updates for Linux 5.16 2021-11-10 16:32:46 -08:00
nfs4renewd.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
nfs4session.c NFSv4: Sanity check the parameters in nfs41_update_target_slotid() 2021-11-07 09:23:14 -05:00
nfs4session.h NFSv4: Sanity check the parameters in nfs41_update_target_slotid() 2021-11-07 09:23:14 -05:00
nfs4state.c NFSv4.1: handle NFS4ERR_NOSPC by CREATE_SESSION 2021-11-17 18:26:31 -05:00
nfs4super.c NFS: Adjust fs_context error logging 2021-01-10 13:32:39 -05:00
nfs4sysctl.c
nfs4trace.c pNFS/flexfiles: Add tracing for layout errors 2020-01-15 10:54:33 -05:00
nfs4trace.h NFSv4.2 add tracepoint to OFFLOAD_CANCEL 2021-11-04 19:43:30 -04:00
nfs4xdr.c NFS: Remove the nfs4_label argument from decode_getattr_*() functions 2021-11-05 14:54:40 -04:00
nfs42.h NFSv4.2: add the extended attribute proc functions. 2020-07-13 17:52:45 -04:00
nfs42proc.c NFSv42: Fix pagecache invalidation after COPY/CLONE 2021-11-17 14:08:23 -05:00
nfs42xattr.c nfs: Fix a typo in the file nfs42xattr.c 2021-04-05 09:04:20 -04:00
nfs42xdr.c NFSv42: Don't fail clone() unless the OP_CLONE operation failed 2021-11-17 14:08:23 -05:00
nfs.h
nfsroot.c nfsroot: Default mount option should ask for built-in NFS version 2020-11-02 10:29:03 -05:00
nfstrace.c NFSv4: Catch and trace server filehandle encoding errors 2021-04-14 09:36:29 -04:00
nfstrace.h NFS: Add a tracepoint to show the results of nfs_set_cache_invalid() 2021-11-17 14:08:23 -05:00
pagelist.c SUNRPC: Trace calls to .rpc_call_done 2021-10-20 18:09:54 -04:00
pnfs_dev.c NFSv4/pnfs: Add tracing for the deviceid cache 2020-12-16 17:25:24 -05:00
pnfs_nfs.c NFS: Fix up commit deadlocks 2021-10-20 18:09:45 -04:00
pnfs.c NFSv4/pnfs: The layout barrier indicate a minimal value for the seqid 2021-08-09 16:57:04 -04:00
pnfs.h NFS: Move NFS protocol display macros to global header 2021-11-02 12:31:23 -04:00
proc.c NFS: Remove the nfs4_label argument from nfs_instantiate() 2021-11-05 14:54:39 -04:00
read.c NFS: Add offset to nfs_aop_readahead tracepoint 2021-11-02 16:44:02 -04:00
super.c NFS: Call nfs_probe_server() during a fscontext-reconfigure event 2021-10-20 18:09:55 -04:00
symlink.c nfs: pass the correct prototype to read_cache_page 2019-05-09 16:26:57 -04:00
sysctl.c
sysfs.c NFSv4: Fix up RCU annotations for struct nfs_netns_client 2020-10-15 13:31:08 -04:00
sysfs.h NFSv4: Fix up RCU annotations for struct nfs_netns_client 2020-10-15 13:31:08 -04:00
unlink.c NFS: Fix open coded versions of nfs_set_cache_invalid() 2021-03-08 16:13:55 -05:00
write.c NFS: Remove redundant call to __set_page_dirty_nobuffers 2021-10-21 17:11:41 -04:00