linux-yocto/net/sunrpc
Long Li 05aba2d316 sunrpc: fix race in cache cleanup causing stale nextcheck time
[ Upstream commit 2298abcbe1 ]

When cache cleanup runs concurrently with cache entry removal, a race
condition can occur that leads to incorrect nextcheck times. This can
delay cache cleanup for the cache_detail by up to 1800 seconds:

1. cache_clean() sets nextcheck to current time plus 1800 seconds
2. While scanning a non-empty bucket, concurrent cache entry removal can
   empty that bucket
3. cache_clean() finds no cache entries in the now-empty bucket to update
   the nextcheck time
4. This maybe delays the next scan of the cache_detail by up to 1800
   seconds even when it should be scanned earlier based on remaining
   entries

Fix this by moving the hash_lock acquisition earlier in cache_clean().
This ensures bucket emptiness checks and nextcheck updates happen
atomically, preventing the race between cleanup and entry removal.

Signed-off-by: Long Li <leo.lilong@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-27 11:05:29 +01:00
..
auth_gss
xprtrdma svcrdma: fix miss destroy percpu_counter in svc_rdma_proc_init() 2024-12-14 19:51:07 +01:00
addr.c
auth_null.c
auth_unix.c
auth.c
backchannel_rqst.c
cache.c sunrpc: fix race in cache cleanup causing stale nextcheck time 2025-06-27 11:05:29 +01:00
clnt.c SUNRPC: rpc_clnt_set_transport() must not change the autobind setting 2025-06-04 14:37:55 +02:00
debugfs.c
fail.h
Kconfig
Makefile
netns.h
rpc_pipe.c
rpcb_clnt.c SUNRPC: rpcbind should never reset the port to the value '0' 2025-06-04 14:37:55 +02:00
sched.c SUNRPC: Fix a race to wake a sync task 2024-08-19 05:45:39 +02:00
socklib.c
socklib.h
stats.c sunrpc: use the struct net as the svc proc private 2024-09-04 13:23:30 +02:00
sunrpc_syms.c
sunrpc.h
svc_xprt.c
svc.c sunrpc: pass in the sv_stats struct through svc_create_pooled 2024-09-04 13:23:30 +02:00
svcauth_unix.c
svcauth.c
svcsock.c
sysctl.c
sysfs.c
sysfs.h
timer.c
xdr.c
xprt.c
xprtmultipath.c
xprtsock.c sunrpc: clear XPRT_SOCK_UPD_TIMEOUT when reset transport 2024-12-14 19:51:21 +01:00