diff options
author | Olga Kornievskaia <kolga@netapp.com> | 2021-06-24 06:28:50 +0300 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2021-07-08 21:03:24 +0300 |
commit | 5b7eb78486cd9ac58bfbd6d84ea0fe2d9fead03b (patch) | |
tree | 1a71de43011ed7c434117cfe94676739a880c3f0 /net/sunrpc/xprtmultipath.c | |
parent | c1830a63c79aa90f725ed6feaad097473f2b990d (diff) | |
download | linux-5b7eb78486cd9ac58bfbd6d84ea0fe2d9fead03b.tar.xz |
SUNRPC: take a xprt offline using sysfs
Using sysfs's xprt_state attribute, mark a particular transport offline.
It will not be picked during the round-robin selection. It's not allowed
to take the main (1st created transport associated with the rpc_client)
offline. Also bring a transport back online via sysfs by writing "online"
and that would allow for this transport to be picked during the round-
robin selection.
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'net/sunrpc/xprtmultipath.c')
-rw-r--r-- | net/sunrpc/xprtmultipath.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/sunrpc/xprtmultipath.c b/net/sunrpc/xprtmultipath.c index 07e76ae1028a..5f4845d1e922 100644 --- a/net/sunrpc/xprtmultipath.c +++ b/net/sunrpc/xprtmultipath.c @@ -65,7 +65,8 @@ static void xprt_switch_remove_xprt_locked(struct rpc_xprt_switch *xps, { if (unlikely(xprt == NULL)) return; - xps->xps_nactive--; + if (!test_bit(XPRT_OFFLINE, &xprt->state)) + xps->xps_nactive--; xps->xps_nxprts--; if (xps->xps_nxprts == 0) xps->xps_net = NULL; @@ -230,7 +231,8 @@ void xprt_iter_default_rewind(struct rpc_xprt_iter *xpi) static bool xprt_is_active(const struct rpc_xprt *xprt) { - return kref_read(&xprt->kref) != 0; + return (kref_read(&xprt->kref) != 0 && + !test_bit(XPRT_OFFLINE, &xprt->state)); } static |