Commit 83179760 authored by Ursula Braun's avatar Ursula Braun Committed by Jakub Kicinski

net/smc: tell peers about abnormal link group termination

There are lots of link group termination scenarios. Most of them
still allow to inform the peer of the terminating sockets about aborting.
This patch tries to call smc_close_abort() for terminating sockets.

And the internal TCP socket is reset with tcp_abort().
Signed-off-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
parent 8e316b9e
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/sched/signal.h> #include <linux/sched/signal.h>
#include <net/sock.h> #include <net/sock.h>
#include <net/tcp.h>
#include "smc.h" #include "smc.h"
#include "smc_tx.h" #include "smc_tx.h"
...@@ -102,7 +103,7 @@ static int smc_close_final(struct smc_connection *conn) ...@@ -102,7 +103,7 @@ static int smc_close_final(struct smc_connection *conn)
return smc_cdc_get_slot_and_msg_send(conn); return smc_cdc_get_slot_and_msg_send(conn);
} }
static int smc_close_abort(struct smc_connection *conn) int smc_close_abort(struct smc_connection *conn)
{ {
conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1; conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
...@@ -118,10 +119,8 @@ static void smc_close_active_abort(struct smc_sock *smc) ...@@ -118,10 +119,8 @@ static void smc_close_active_abort(struct smc_sock *smc)
if (sk->sk_state != SMC_INIT && smc->clcsock && smc->clcsock->sk) { if (sk->sk_state != SMC_INIT && smc->clcsock && smc->clcsock->sk) {
sk->sk_err = ECONNABORTED; sk->sk_err = ECONNABORTED;
if (smc->clcsock && smc->clcsock->sk) { if (smc->clcsock && smc->clcsock->sk)
smc->clcsock->sk->sk_err = ECONNABORTED; tcp_abort(smc->clcsock->sk, ECONNABORTED);
smc->clcsock->sk->sk_state_change(smc->clcsock->sk);
}
} }
switch (sk->sk_state) { switch (sk->sk_state) {
case SMC_ACTIVE: case SMC_ACTIVE:
......
...@@ -24,5 +24,6 @@ int smc_close_active(struct smc_sock *smc); ...@@ -24,5 +24,6 @@ int smc_close_active(struct smc_sock *smc);
int smc_close_shutdown_write(struct smc_sock *smc); int smc_close_shutdown_write(struct smc_sock *smc);
void smc_close_init(struct smc_sock *smc); void smc_close_init(struct smc_sock *smc);
void smc_clcsock_release(struct smc_sock *smc); void smc_clcsock_release(struct smc_sock *smc);
int smc_close_abort(struct smc_connection *conn);
#endif /* SMC_CLOSE_H */ #endif /* SMC_CLOSE_H */
...@@ -513,8 +513,8 @@ static void __smc_lgr_terminate(struct smc_link_group *lgr) ...@@ -513,8 +513,8 @@ static void __smc_lgr_terminate(struct smc_link_group *lgr)
smc = container_of(conn, struct smc_sock, conn); smc = container_of(conn, struct smc_sock, conn);
lock_sock(&smc->sk); lock_sock(&smc->sk);
sock_hold(&smc->sk); /* sock_put in close work */ sock_hold(&smc->sk); /* sock_put in close work */
smc_close_abort(conn);
conn->killed = 1; conn->killed = 1;
conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
smc_lgr_unregister_conn(conn); smc_lgr_unregister_conn(conn);
conn->lgr = NULL; conn->lgr = NULL;
if (!schedule_work(&conn->close_work)) if (!schedule_work(&conn->close_work))
......
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