OpenCloudOS-Kernel/fs/nfsd
Chuck Lever 1dfc79bfc5 NFSD: Fix nfsd4_shutdown_copy()
[ Upstream commit 62a8642ba00aa8ceb0a02ade942f5ec52e877c95 ]

nfsd4_shutdown_copy() is just this:

	while ((copy = nfsd4_get_copy(clp)) != NULL)
		nfsd4_stop_copy(copy);

nfsd4_get_copy() bumps @copy's reference count, preventing
nfsd4_stop_copy() from releasing @copy.

A while loop like this usually works by removing the first element
of the list, but neither nfsd4_get_copy() nor nfsd4_stop_copy()
alters the async_copies list.

Best I can tell, then, is that nfsd4_shutdown_copy() continues to
loop until other threads manage to remove all the items from this
list. The spinning loop blocks shutdown until these items are gone.

Possibly the reason we haven't seen this issue in the field is
because client_has_state() prevents __destroy_client() from calling
nfsd4_shutdown_copy() if there are any items on this list. In a
subsequent patch I plan to remove that restriction.

Fixes: e0639dc580 ("NFSD introduce async copy feature")
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-12-09 10:32:30 +01:00
..
Kconfig NFS & NFSD: Update GSS dependencies 2023-03-10 09:38:47 -05:00
Makefile nfsd: allow disabling NFSv2 at compile time 2022-11-28 12:54:45 -05:00
acl.h NFSD: add posix ACLs to struct nfsd_attrs 2022-08-04 10:28:03 -04:00
auth.c cred: get rid of CONFIG_DEBUG_CREDENTIALS 2023-12-20 17:01:51 +01:00
auth.h
blocklayout.c nfsd: call op_release, even when op_func returns an error 2023-03-31 17:29:49 -04:00
blocklayoutxdr.c NFSD: da_addr_body field missing in some GETDEVICEINFO replies 2023-08-29 17:45:22 -04:00
blocklayoutxdr.h
cache.h nfsd: make all of the nfsd stats per-network namespace 2024-08-19 06:04:23 +02:00
current_stateid.h
export.c nfsd: release svc_expkey/svc_export with rcu_work 2024-12-09 10:32:30 +01:00
export.h nfsd: release svc_expkey/svc_export with rcu_work 2024-12-09 10:32:30 +01:00
filecache.c NFSD: Mark filecache "down" if init fails 2024-10-17 15:24:22 +02:00
filecache.h NFSD: Convert filecache to rhltable 2023-04-26 09:04:59 -04:00
flexfilelayout.c nfsd: move nfserrno() to vfs.c 2022-11-28 12:54:44 -05:00
flexfilelayoutxdr.c NFSD: da_addr_body field missing in some GETDEVICEINFO replies 2023-08-29 17:45:22 -04:00
flexfilelayoutxdr.h
idmap.h
lockd.c
netns.h NFSD: Limit the number of concurrent async COPY operations 2024-11-22 15:38:36 +01:00
nfs2acl.c NFSD 6.3 Release Notes 2023-02-22 14:21:40 -08:00
nfs3acl.c NFSD 6.3 Release Notes 2023-02-22 14:21:40 -08:00
nfs3proc.c nfsd: handle failure to collect pre/post-op attrs more sanely 2023-08-29 17:45:22 -04:00
nfs3xdr.c NFSD: Ensure that xdr_write_pages updates rq_next_page 2023-06-05 09:01:44 -04:00
nfs4acl.c nfsd: inherit required unset default acls from effective set 2023-08-29 17:45:22 -04:00
nfs4callback.c NFSD: Prevent NULL dereference in nfsd4_process_cb_update() 2024-12-09 10:32:29 +01:00
nfs4idmap.c nfsd: call cache_put if xdr_reserve_space returns NULL 2024-10-04 16:29:35 +02:00
nfs4layouts.c nfsd: fix race to check ls_layouts 2023-02-20 09:20:56 -05:00
nfs4proc.c NFSD: Fix nfsd4_shutdown_copy() 2024-12-09 10:32:30 +01:00
nfs4recover.c NFSD: Cap the number of bytes copied by nfs4_reset_recoverydir() 2024-12-09 10:32:30 +01:00
nfs4state.c NFSD: Limit the number of concurrent async COPY operations 2024-11-22 15:38:36 +01:00
nfs4xdr.c NFSD: Fix NFSv4's PUTPUBFH operation 2024-10-10 11:57:53 +02:00
nfscache.c nfsd: make all of the nfsd stats per-network namespace 2024-08-19 06:04:23 +02:00
nfsctl.c nfsd: make svc_stat per-network namespace instead of global 2024-08-19 06:04:24 +02:00
nfsd.h nfsd: remove nfsd_stats, make th_cnt a global counter 2024-08-19 06:04:24 +02:00
nfsfh.c nfsd: make all of the nfsd stats per-network namespace 2024-08-19 06:04:23 +02:00
nfsfh.h nfsd: handle failure to collect pre/post-op attrs more sanely 2023-08-29 17:45:22 -04:00
nfsproc.c NFSD: Hoist rq_vec preparation into nfsd_read() 2023-06-11 16:37:45 -04:00
nfssvc.c NFSD: simplify error paths in nfsd_svc() 2024-08-29 17:33:58 +02:00
nfsxdr.c NFSD: Ensure that xdr_write_pages updates rq_next_page 2023-06-05 09:01:44 -04:00
pnfs.h
state.h NFSD: handle GETATTR conflict with write delegation 2023-08-29 17:45:22 -04:00
stats.c nfsd: make svc_stat per-network namespace instead of global 2024-08-19 06:04:24 +02:00
stats.h nfsd: make svc_stat per-network namespace instead of global 2024-08-19 06:04:24 +02:00
trace.c
trace.h NFSD: Fix nfsd_clid_class use of __string_len() macro 2024-04-03 15:28:35 +02:00
vfs.c nfsd: map the EBADMSG to nfserr_io to avoid warning 2024-10-10 11:57:52 +02:00
vfs.h nfsd: Handle EOPENSTALE correctly in the filecache 2023-11-20 11:58:52 +01:00
xdr.h NFSD: prevent underflow in nfssvc_decode_writeargs() 2022-03-15 09:35:56 -04:00
xdr3.h SUNRPC: Change return value type of .pc_encode 2021-10-13 11:34:49 -04:00
xdr4.h NFSD: Limit the number of concurrent async COPY operations 2024-11-22 15:38:36 +01:00
xdr4cb.h NFSD: add support for sending CB_RECALL_ANY 2022-12-10 11:01:12 -05:00