summaryrefslogtreecommitdiff
path: root/net/smc/smc_close.c
diff options
context:
space:
mode:
authorUrsula Braun <ubraun@linux.ibm.com>2019-10-21 17:13:08 +0300
committerJakub Kicinski <jakub.kicinski@netronome.com>2019-10-22 21:23:43 +0300
commitb290098092e4aeaa1712d3326bf5b64d2751c740 (patch)
treea61e1a914084e4c9876d8eb15af342529b036e49 /net/smc/smc_close.c
parentfe28afe23e91b162df31171a376d519cdd95f881 (diff)
downloadlinux-b290098092e4aeaa1712d3326bf5b64d2751c740.tar.xz
net/smc: cancel send and receive for terminated socket
The resources for a terminated socket are being cleaned up. This patch makes sure * no more data is received for an actively terminated socket * no more data is sent for an actively or passively terminated socket Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Diffstat (limited to 'net/smc/smc_close.c')
-rw-r--r--net/smc/smc_close.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c
index 1a858e59fc31..1d706c581592 100644
--- a/net/smc/smc_close.c
+++ b/net/smc/smc_close.c
@@ -66,7 +66,8 @@ static void smc_close_stream_wait(struct smc_sock *smc, long timeout)
rc = sk_wait_event(sk, &timeout,
!smc_tx_prepared_sends(&smc->conn) ||
sk->sk_err == ECONNABORTED ||
- sk->sk_err == ECONNRESET,
+ sk->sk_err == ECONNRESET ||
+ smc->conn.killed,
&wait);
if (rc)
break;
@@ -95,6 +96,8 @@ static int smc_close_final(struct smc_connection *conn)
conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
else
conn->local_tx_ctrl.conn_state_flags.peer_conn_closed = 1;
+ if (conn->killed)
+ return -EPIPE;
return smc_cdc_get_slot_and_msg_send(conn);
}
@@ -326,7 +329,7 @@ static void smc_close_passive_work(struct work_struct *work)
lock_sock(sk);
old_state = sk->sk_state;
- if (!conn->alert_token_local) {
+ if (conn->killed) {
/* abnormal termination */
smc_close_active_abort(smc);
goto wakeup;