rpc_switch_client_transport(9)
π rpc_switch_client_transport(9) π
okay bestie, welcome to the Kernel API Manual corner where we talk about rpc_switch_client_transport β the glow-up button for an RPC transport. No cap, this one is lowkey iconic when you're out here juggling mirrored NFS servers. β¨
π NAME π
rpc_switch_client_transport β switch the RPC transport on the fly. π¦
β¨ SYNOPSIS β¨
int rpc_switch_client_transport (struct rpc_clnt *clnt , struct
xprt_create *args , const struct rpc_timeout *timeout );
π ARGUMENTS π
clntβ pointer to astruct rpc_clnt. This is the main-character client struct getting its transport swapped. πargsβ pointer to the new transport arguments. Fresh xprt setup goes here. π§timeoutβ pointer to the new timeout parameters. The new timing vibe. β°
π DESCRIPTION π
So the tea is: this function lets the caller switch the RPC transport for the rpc_clnt structure 'clnt' so it can connect to a mirrored NFS server, for instance. π«
It assumes that the caller has ensured that there are no active RPC tasks by using some form of locking. Like, do the locking first, bestie β this function is not out here doing your task cleanup for you. π
Returns zero if "clnt" is now using the new xprt. Slay. β
Otherwise a negative errno is returned, and "clnt" continues to use the old xprt. So if it doesn't work, no dramatic transport change β it stays with its old xprt. π
π₯ SEE ALSO π₯
Kernel file ./net/sunrpc/clnt.c:
rpc_create(9)rpc_clone_client(9)rpc_clone_client_set_auth(9)rpc_clnt_iterate_for_each_xprt(9)rpc_cancel_tasks(9)rpc_hold_client(9)rpc_release_client(9)rpc_bind_new_program(9)rpc_run_task(9)rpc_call_sync(9)rpc_call_async(9)rpc_run_bc_task(9)rpc_prepare_reply_pages(9)rpc_peeraddr(9)rpc_peeraddr2str(9)rpc_localaddr(9)rpc_net_ns(9)rpc_max_payload(9)rpc_max_bc_payload(9)rpc_force_rebind(9)rpc_clnt_test_and_add_xprt(9)rpc_clnt_setup_test_and_add_xprt(9)rpc_clnt_add_xprt(9)
xoxo, your ./net/sunrpc source, October 2026 vibes, and the one and only rpc_switch_client_transport(9) π
β¨
π¦ 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