svc_xprt_destroy_all(9)
π svc_xprt_destroy_all(9) π
okay so this one's straight out of the Kernel API Manual, section 9 β the kernel's own little corner of the docs β and bestie, it's giving "cleanup era" β¨
πΈ NAME πΈ
svc_xprt_destroy_all β destroy the transports that are associated with @serv. that's it. that's the whole vibe. π
π SYNOPSIS π
void svc_xprt_destroy_all (struct svc_serv *serv , struct net *net ,
bool unregister );
β¨ ARGUMENTS β¨
servβ the RPC service that's getting shut down π«Άnetβ the target network namespace, iykykunregisterβ abool; it'strueif it's OK to unregister the destroyed xprts
π¦ DESCRIPTION π¦
okay so the situation is: server threads might still be running π like, especially when the service is still alive in other network namespaces. not me having to deal with that.
so the way we handle it: we shut down sockets the exact same way we would on a running server β set XPT_CLOSE, enqueue, and let a thread pick it up and do the actual close. main character thread behavior, honestly. no cap.
now here's the fork in the road:
- in the case where there are no such other threads running,
svc_clean_up_xprtsdoes a simple version of a server's main event loop π - and in the case where there are other threads, we may need to wait a little while and then check again to see if they're done π (yes, we're waiting and re-checking. it's that kind of function.)
π SEE ALSO π
kernel file ./net/sunrpc/svc_xprt.c plus the whole friend group:
svc_reg_xprt_class(9), svc_unreg_xprt_class(9), svc_print_xprts(9), svc_xprt_deferred_close(9), svc_xprt_received(9), svc_xprt_create_from_sa(9), svc_xprt_create(9), svc_print_addr(9), svc_xprt_enqueue(9), svc_reserve(9), svc_wake_up(9), svc_recv(9), svc_send(9), svc_xprt_close(9), svc_find_listener(9), svc_find_xprt(9), svc_xprt_names(9)
fr fr if you're touching this, read the whole group chat first. the XPT_CLOSE + enqueue + let-a-thread-handle-it flow is the whole point, don't skip steps π
π«Ά mwah, that's a wrap! this lil page lives in ./net/sunrpc and it's dated October 2026 β so go forth, destroy those transports responsibly, and slay π
πβ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms