linux-stable/net/sunrpc
NeilBrown f859788868 NFS: fix disabling of swap
[ Upstream commit 5bab56fff5 ]

When swap is activated to a file on an NFSv4 mount we arrange that the
state manager thread is always present as starting a new thread requires
memory allocations that might block waiting for swap.

Unfortunately the code for allowing the state manager thread to exit when
swap is disabled was not tested properly and does not work.
This can be seen by examining /proc/fs/nfsfs/servers after disabling swap
and unmounting the filesystem.  The servers file will still list one
entry.  Also a "ps" listing will show the state manager thread is still
present.

There are two problems.
 1/ rpc_clnt_swap_deactivate() doesn't walk up the ->cl_parent list to
    find the primary client on which the state manager runs.

 2/ The thread is not woken up properly and it immediately goes back to
    sleep without checking whether it is really needed.  Using
    nfs4_schedule_state_manager() ensures a proper wake-up.

Reported-by: Olga Kornievskaia <aglo@umich.edu>
Fixes: 4dc73c6791 ("NFSv4: keep state manager thread active if swap is enabled")
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-10 09:33:22 +01:00
..
auth_gss Revert "SUNRPC: Use RMW bitops in single-threaded hot paths" 2023-01-14 10:33:42 +01:00
xprtrdma Revert "SUNRPC: Use RMW bitops in single-threaded hot paths" 2023-01-14 10:33:42 +01:00
addr.c
auth.c NFS client updates for Linux 5.20 2022-08-10 14:04:32 -07:00
auth_null.c
auth_unix.c SUNRPC: Fix unx_lookup_cred() allocation 2022-03-22 15:52:55 -04:00
backchannel_rqst.c NFS client updates for Linux 5.20 2022-08-10 14:04:32 -07:00
cache.c treewide: use prandom_u32_max() when possible, part 1 2022-10-11 17:42:55 -06:00
clnt.c NFS: fix disabling of swap 2023-03-10 09:33:22 +01:00
debugfs.c SUNRPC: Cache deferral injection 2022-05-19 12:25:38 -04:00
fail.h SUNRPC: Cache deferral injection 2022-05-19 12:25:38 -04:00
Kconfig
Makefile
netns.h
rpc_pipe.c fs: allocate inode by using alloc_inode_sb() 2022-03-22 15:57:03 -07:00
rpcb_clnt.c SUNRPC: Make the rpciod and xprtiod slab allocation modes consistent 2022-03-22 15:52:55 -04:00
sched.c NFS Client Updates for Linux 6.1 2022-10-13 09:58:42 -07:00
socklib.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
socklib.h
stats.c proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
sunrpc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_149.RULE 2022-06-10 14:51:35 +02:00
sunrpc_syms.c
svc.c Revert "SUNRPC: Use RMW bitops in single-threaded hot paths" 2023-01-14 10:33:42 +01:00
svc_xprt.c Revert "SUNRPC: Use RMW bitops in single-threaded hot paths" 2023-01-14 10:33:42 +01:00
svcauth.c SUNRPC: Teach server to recognize RPC_AUTH_TLS 2022-02-28 10:26:40 -05:00
svcauth_unix.c SUNRPC: Teach server to recognize RPC_AUTH_TLS 2022-02-28 10:26:40 -05:00
svcsock.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00
sysctl.c
sysfs.c SUNRPC: Fix null-ptr-deref when xps sysfs alloc failed 2022-10-27 15:52:10 -04:00
sysfs.h
timer.c
xdr.c SUNRPC: Fix typo in xdr_buf_subsegment's kdoc comment 2022-09-26 14:02:47 -04:00
xprt.c Random number generator fixes for Linux 6.1-rc1. 2022-10-16 15:27:07 -07:00
xprtmultipath.c SUNRPC: Directly use ida_alloc()/free() 2022-10-03 11:26:36 -04:00
xprtsock.c use less confusing names for iov_iter direction initializers 2023-02-09 11:28:04 +01:00