linux-stable/net/sunrpc
NeilBrown 5343fcfc6c SUNRPC in case of backlog, hand free slots directly to waiting task
commit e877a88d1f upstream.

If sunrpc.tcp_max_slot_table_entries is small and there are tasks
on the backlog queue, then when a request completes it is freed and the
first task on the queue is woken.  The expectation is that it will wake
and claim that request.  However if it was a sync task and the waiting
process was killed at just that moment, it will wake and NOT claim the
request.

As long as TASK_CONGESTED remains set, requests can only be claimed by
tasks woken from the backlog, and they are woken only as requests are
freed, so when a task doesn't claim a request, no other task can ever
get that request until TASK_CONGESTED is cleared.  Each time this
happens the number of available requests is decreased by one.

With a sufficiently high workload and sufficiently low setting of
max_slot (16 in the case where this was seen), TASK_CONGESTED can remain
set for an extended period, and the above scenario (of a process being
killed just as its task was woken) can repeat until no requests can be
allocated.  Then traffic stops.

This patch addresses the problem by introducing a positive handover of a
request from a completing task to a backlog task - the request is never
freed when there is a backlog.

When a task is woken it might not already have a request attached in
which case it is *not* freed (as with current code) but is initialised
(if needed) and used.  If it isn't used it will eventually be freed by
rpc_exit_task().  xprt_release() is enhanced to be able to correctly
release an uninitialised request.

Fixes: ba60eb25ff ("SUNRPC: Fix a livelock problem in the xprt->backlog queue")
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-03 09:00:37 +02:00
..
auth_gss rpc: fix NULL dereference on kmalloc failure 2021-04-07 15:00:04 +02:00
xprtrdma xprtrdma: rpcrdma_mr_pop() already does list_del_init() 2021-05-19 10:13:04 +02:00
addr.c net: sunrpc: interpret the return value of kstrtou32 correctly 2021-01-19 18:27:33 +01:00
auth.c sunrpc: add missing newline when printing parameter 'auth_hashtable_size' by sysfs 2020-06-11 13:33:48 -04:00
auth_null.c SUNRPC: Add rpc_auth::au_ralign field 2019-02-14 11:48:36 -05:00
auth_unix.c SUNRPC: Use the client user namespace when encoding creds 2019-04-26 16:24:32 -04:00
backchannel_rqst.c The one new feature this time, from Anna Schumaker, is READ_PLUS, which 2020-10-22 09:44:27 -07:00
cache.c sunrpc: raise kernel RPC channel buffer size 2020-10-20 13:21:30 -04:00
clnt.c SUNRPC in case of backlog, hand free slots directly to waiting task 2021-06-03 09:00:37 +02:00
debugfs.c net: sunrpc: Fix 'snprintf' return value check in 'do_xprt_debugfs' 2020-12-30 11:53:30 +01:00
Kconfig SUNRPC: remove RC4-HMAC-MD5 support from KerberosV 2020-09-11 14:39:15 +10:00
Makefile SUNRPC: remove generic cred code. 2018-12-19 13:52:46 -05:00
netns.h
rpc_pipe.c sunrpc: destroy rpc_inode_cachep after unregister_filesystem 2020-07-17 13:12:44 -04:00
rpcb_clnt.c SUNRPC: Replace rpcbind dprintk call sites with tracepoints 2020-09-21 10:21:09 -04:00
sched.c SUNRPC: Set memalloc_nofs_save() for sync tasks 2021-03-17 17:06:33 +01:00
socklib.c skb_copy_and_csum_bits(): don't bother with the last argument 2020-08-20 15:45:13 -04:00
socklib.h SUNRPC: Refactor xs_sendpages() 2020-03-16 12:04:33 -04:00
stats.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
sunrpc.h Replace HTTP links with HTTPS ones: NFS, SUNRPC, and LOCKD clients 2020-09-21 10:21:10 -04:00
sunrpc_syms.c sunrpc: check that domain table is empty at module unload. 2020-05-28 18:15:00 -04:00
svc.c sunrpc: fix refcount leak for rpc auth modules 2021-03-25 09:04:08 +01:00
svc_xprt.c NFSD: Repair misuse of sv_lock in 5.10.16-rt30. 2021-03-25 09:04:08 +01:00
svcauth.c sunrpc: check that domain table is empty at module unload. 2020-05-28 18:15:00 -04:00
svcauth_unix.c sunrpc: Remove unused function ip_map_update 2020-05-06 16:00:11 -04:00
svcsock.c SUNRPC: fix ternary sign expansion bug in tracing 2021-05-19 10:13:04 +02:00
sysctl.c net/sunrpc: fix useless comparison in proc_do_xprt() 2020-11-08 16:28:25 -05:00
timer.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
xdr.c The one new feature this time, from Anna Schumaker, is READ_PLUS, which 2020-10-22 09:44:27 -07:00
xprt.c SUNRPC in case of backlog, hand free slots directly to waiting task 2021-06-03 09:00:37 +02:00
xprtmultipath.c SUNRPC: Optimise transport balancing code 2019-07-18 14:43:52 -04:00
xprtsock.c sunrpc: fix xs_read_xdr_buf for partial pages receive 2020-12-30 11:53:53 +01:00