SUNRPC: Create a helper function for accessing the rpc_clnt's xprt_switch
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 30 Nov 2023 21:25:58 +0000 (16:25 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 4 Jan 2024 15:47:56 +0000 (10:47 -0500)
commita902f3dec70a46332a8c99604de384fbabd734e5
tree01f4c806113e09f67d62a9c5a9d020e402e56c41
parent5f1e77b2285b47c216b44e513071549cf006a309
SUNRPC: Create a helper function for accessing the rpc_clnt's xprt_switch

This function takes the necessary rcu read lock to dereference the
client's rpc_xprt_switch and bump the reference count so it doesn't
disappear underneath us before returning. This does mean that callers
are responsible for calling xprt_switch_put() on the returned object
when they are done with it.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/clnt.c