SUNRPC: wake a thread after re-queueing transports in svc_clean_up_xprts()
Subsystems (3)
PATCH v2 1/1 SUNRPC: wake a thread after re-queueing transports in svc_clean_up_xprts()
From: Benjamin Coddington <[email protected]>
svc_clean_up_xprts() takes every ready transport off the pool's queue, deletes those belonging to the network namespace being shut down, and puts the rest back with lwq_enqueue_batch(). No thread is woken. A thread that tested the queue while it was drained has gone to sleep, and the re-queued transports still carry XPT_BUSY, so the data they receive next cannot enqueue them either. They wait until an unrelated transport wakes a thread. lockd and the NFSv4 callback service share one service across network namespaces and wait in svc_recv() without a timeout, so nothing bounds that wait.
Reproduced with lockd: with NLM traffic running in the initial network namespace, mounting and unmounting NFSv3 in a second namespace takes lockd down there, and lock requests in the first namespace stop being answered until something else wakes the lockd thread.
Wake a thread after putting the transports back.
---
Changes in v2:
- wake a thread whenever transports are put back, not only when the
queue was empty (Chuck)
- description: drop nfsd, its service is per-net and has nothing to
put back (Chuck)
- sent with an in-body From so the author matches the Signed-off-by
v1: https://lore.kernel.org/linux-nfs/5b162e1a03d59bd0d3cc479891965834d0d4f0c8.1790948398.git.bcodding@hammerspace.com/
net/sunrpc/svc_xprt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sunrpc/svc_xprt.c +3 -1
@@ -1246,8 +1246,10 @@ static void svc_clean_up_xprts(struct svc_serv *serv, struct net *net) } } -if (q) +if (q) {lwq_enqueue_batch (q, &pool->sp_xprts); +svc_pool_wake_idle_thread (pool); + } } }
Signature · 1 line
2.53.0
Chuck Lever
maintainerQuoted 11 lines · Benjamin Coddington
svc_clean_up_xprts()takes every ready transport off the pool's queue, deletes those belonging to the network namespace being shut down, and puts the rest back withlwq_enqueue_batch(). No thread is woken. A thread that tested the queue while it was drained has gone to sleep, and the re-queued transports still carryXPT_BUSY, so the data they receive next cannot enqueue them either. They wait until an unrelated transport wakes a thread. lockd and the NFSv4 callback service share one service across network namespaces and wait insvc_recv()without a timeout, so nothing bounds that wait.[...]
Applied to nfsd-testing, thanks!
[1/1] SUNRPC: wake a thread after re-queueing transports in svc_clean_up_xprts()
commit: 5bf64b6b9099be94627be83231ed705d7ed35b1f
--
Chuck Lever