sunrpc: Fix connect metrics
For TCP, the logic in xprt_connect_status is currently never invoked
to record a successful connection. Commit 2a4919919a
("SUNRPC:
Return EAGAIN instead of ENOTCONN when waking up xprt->pending")
changed the way TCP xprt's are awoken after a connect succeeds.
Instead, change connection-oriented transports to bump connect_count
and compute connect_time the moment that XPRT_CONNECTED is set.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Родитель
d379eaa838
Коммит
3968a8a531
|
@ -789,17 +789,11 @@ void xprt_connect(struct rpc_task *task)
|
||||||
|
|
||||||
static void xprt_connect_status(struct rpc_task *task)
|
static void xprt_connect_status(struct rpc_task *task)
|
||||||
{
|
{
|
||||||
struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt;
|
switch (task->tk_status) {
|
||||||
|
case 0:
|
||||||
if (task->tk_status == 0) {
|
|
||||||
xprt->stat.connect_count++;
|
|
||||||
xprt->stat.connect_time += (long)jiffies - xprt->stat.connect_start;
|
|
||||||
dprintk("RPC: %5u xprt_connect_status: connection established\n",
|
dprintk("RPC: %5u xprt_connect_status: connection established\n",
|
||||||
task->tk_pid);
|
task->tk_pid);
|
||||||
return;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
switch (task->tk_status) {
|
|
||||||
case -ECONNREFUSED:
|
case -ECONNREFUSED:
|
||||||
case -ECONNRESET:
|
case -ECONNRESET:
|
||||||
case -ECONNABORTED:
|
case -ECONNABORTED:
|
||||||
|
@ -816,7 +810,7 @@ static void xprt_connect_status(struct rpc_task *task)
|
||||||
default:
|
default:
|
||||||
dprintk("RPC: %5u xprt_connect_status: error %d connecting to "
|
dprintk("RPC: %5u xprt_connect_status: error %d connecting to "
|
||||||
"server %s\n", task->tk_pid, -task->tk_status,
|
"server %s\n", task->tk_pid, -task->tk_status,
|
||||||
xprt->servername);
|
task->tk_rqstp->rq_xprt->servername);
|
||||||
task->tk_status = -EIO;
|
task->tk_status = -EIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,8 +242,12 @@ rpcrdma_connect_worker(struct work_struct *work)
|
||||||
|
|
||||||
spin_lock_bh(&xprt->transport_lock);
|
spin_lock_bh(&xprt->transport_lock);
|
||||||
if (ep->rep_connected > 0) {
|
if (ep->rep_connected > 0) {
|
||||||
if (!xprt_test_and_set_connected(xprt))
|
if (!xprt_test_and_set_connected(xprt)) {
|
||||||
|
xprt->stat.connect_count++;
|
||||||
|
xprt->stat.connect_time += (long)jiffies -
|
||||||
|
xprt->stat.connect_start;
|
||||||
xprt_wake_pending_tasks(xprt, 0);
|
xprt_wake_pending_tasks(xprt, 0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (xprt_test_and_clear_connected(xprt))
|
if (xprt_test_and_clear_connected(xprt))
|
||||||
xprt_wake_pending_tasks(xprt, -ENOTCONN);
|
xprt_wake_pending_tasks(xprt, -ENOTCONN);
|
||||||
|
|
|
@ -1611,6 +1611,9 @@ static void xs_tcp_state_change(struct sock *sk)
|
||||||
clear_bit(XPRT_SOCK_CONNECTING, &transport->sock_state);
|
clear_bit(XPRT_SOCK_CONNECTING, &transport->sock_state);
|
||||||
xprt_clear_connecting(xprt);
|
xprt_clear_connecting(xprt);
|
||||||
|
|
||||||
|
xprt->stat.connect_count++;
|
||||||
|
xprt->stat.connect_time += (long)jiffies -
|
||||||
|
xprt->stat.connect_start;
|
||||||
xprt_wake_pending_tasks(xprt, -EAGAIN);
|
xprt_wake_pending_tasks(xprt, -EAGAIN);
|
||||||
}
|
}
|
||||||
spin_unlock(&xprt->transport_lock);
|
spin_unlock(&xprt->transport_lock);
|
||||||
|
@ -2029,8 +2032,6 @@ static int xs_local_finish_connecting(struct rpc_xprt *xprt,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell the socket layer to start connecting... */
|
/* Tell the socket layer to start connecting... */
|
||||||
xprt->stat.connect_count++;
|
|
||||||
xprt->stat.connect_start = jiffies;
|
|
||||||
return kernel_connect(sock, xs_addr(xprt), xprt->addrlen, 0);
|
return kernel_connect(sock, xs_addr(xprt), xprt->addrlen, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2062,6 +2063,9 @@ static int xs_local_setup_socket(struct sock_xprt *transport)
|
||||||
case 0:
|
case 0:
|
||||||
dprintk("RPC: xprt %p connected to %s\n",
|
dprintk("RPC: xprt %p connected to %s\n",
|
||||||
xprt, xprt->address_strings[RPC_DISPLAY_ADDR]);
|
xprt, xprt->address_strings[RPC_DISPLAY_ADDR]);
|
||||||
|
xprt->stat.connect_count++;
|
||||||
|
xprt->stat.connect_time += (long)jiffies -
|
||||||
|
xprt->stat.connect_start;
|
||||||
xprt_set_connected(xprt);
|
xprt_set_connected(xprt);
|
||||||
case -ENOBUFS:
|
case -ENOBUFS:
|
||||||
break;
|
break;
|
||||||
|
@ -2387,8 +2391,6 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
|
||||||
xs_set_memalloc(xprt);
|
xs_set_memalloc(xprt);
|
||||||
|
|
||||||
/* Tell the socket layer to start connecting... */
|
/* Tell the socket layer to start connecting... */
|
||||||
xprt->stat.connect_count++;
|
|
||||||
xprt->stat.connect_start = jiffies;
|
|
||||||
set_bit(XPRT_SOCK_CONNECTING, &transport->sock_state);
|
set_bit(XPRT_SOCK_CONNECTING, &transport->sock_state);
|
||||||
ret = kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK);
|
ret = kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK);
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче