Commit 6cd67869 authored by Liang Zhen's avatar Liang Zhen Committed by Greg Kroah-Hartman

staging: lustre: ksocklnd: ignore timedout TX on closing connection

ksocklnd reaper thread always tries to close the connection for the
first timedout zero-copy TX. This is wrong if this connection is
already being closed, because the reaper will see the same TX again
and again and cannot find out other timedout zero-copy TXs and close
connections for them.
Signed-off-by: default avatarLiang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8867
Reviewed-on: https://review.whamcloud.com/23973Reviewed-by: default avatarDoug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 59bedbcc
...@@ -2456,6 +2456,7 @@ ksocknal_check_peer_timeouts(int idx) ...@@ -2456,6 +2456,7 @@ ksocknal_check_peer_timeouts(int idx)
list_for_each_entry(peer, peers, ksnp_list) { list_for_each_entry(peer, peers, ksnp_list) {
unsigned long deadline = 0; unsigned long deadline = 0;
struct ksock_tx *tx_stale;
int resid = 0; int resid = 0;
int n = 0; int n = 0;
...@@ -2503,6 +2504,7 @@ ksocknal_check_peer_timeouts(int idx) ...@@ -2503,6 +2504,7 @@ ksocknal_check_peer_timeouts(int idx)
if (list_empty(&peer->ksnp_zc_req_list)) if (list_empty(&peer->ksnp_zc_req_list))
continue; continue;
tx_stale = NULL;
spin_lock(&peer->ksnp_lock); spin_lock(&peer->ksnp_lock);
list_for_each_entry(tx, &peer->ksnp_zc_req_list, tx_zc_list) { list_for_each_entry(tx, &peer->ksnp_zc_req_list, tx_zc_list) {
if (!cfs_time_aftereq(cfs_time_current(), if (!cfs_time_aftereq(cfs_time_current(),
...@@ -2511,26 +2513,26 @@ ksocknal_check_peer_timeouts(int idx) ...@@ -2511,26 +2513,26 @@ ksocknal_check_peer_timeouts(int idx)
/* ignore the TX if connection is being closed */ /* ignore the TX if connection is being closed */
if (tx->tx_conn->ksnc_closing) if (tx->tx_conn->ksnc_closing)
continue; continue;
if (!tx_stale)
tx_stale = tx;
n++; n++;
} }
if (!n) { if (!tx_stale) {
spin_unlock(&peer->ksnp_lock); spin_unlock(&peer->ksnp_lock);
continue; continue;
} }
tx = list_entry(peer->ksnp_zc_req_list.next, deadline = tx_stale->tx_deadline;
struct ksock_tx, tx_zc_list); resid = tx_stale->tx_resid;
deadline = tx->tx_deadline; conn = tx_stale->tx_conn;
resid = tx->tx_resid;
conn = tx->tx_conn;
ksocknal_conn_addref(conn); ksocknal_conn_addref(conn);
spin_unlock(&peer->ksnp_lock); spin_unlock(&peer->ksnp_lock);
read_unlock(&ksocknal_data.ksnd_global_lock); read_unlock(&ksocknal_data.ksnd_global_lock);
CERROR("Total %d stale ZC_REQs for peer %s detected; the oldest(%p) timed out %ld secs ago, resid: %d, wmem: %d\n", CERROR("Total %d stale ZC_REQs for peer %s detected; the oldest(%p) timed out %ld secs ago, resid: %d, wmem: %d\n",
n, libcfs_nid2str(peer->ksnp_id.nid), tx, n, libcfs_nid2str(peer->ksnp_id.nid), tx_stale,
cfs_duration_sec(cfs_time_current() - deadline), cfs_duration_sec(cfs_time_current() - deadline),
resid, conn->ksnc_sock->sk->sk_wmem_queued); resid, conn->ksnc_sock->sk->sk_wmem_queued);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment