From: Karsten Graul <kgraul@linux.ibm.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org,
gor@linux.ibm.com, heiko.carstens@de.ibm.com,
raspl@linux.ibm.com, ubraun@linux.ibm.com
Subject: [PATCH net-next 5/8] net/smc: tell peers about abnormal link group termination
Date: Mon, 21 Oct 2019 16:13:12 +0200 [thread overview]
Message-ID: <20191021141315.58969-6-kgraul@linux.ibm.com> (raw)
In-Reply-To: <20191021141315.58969-1-kgraul@linux.ibm.com>
From: Ursula Braun <ubraun@linux.ibm.com>
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: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
---
net/smc/smc_close.c | 9 ++++-----
net/smc/smc_close.h | 1 +
net/smc/smc_core.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c
index 1d706c581592..2bbcd45a421e 100644
--- a/net/smc/smc_close.c
+++ b/net/smc/smc_close.c
@@ -13,6 +13,7 @@
#include <linux/sched/signal.h>
#include <net/sock.h>
+#include <net/tcp.h>
#include "smc.h"
#include "smc_tx.h"
@@ -102,7 +103,7 @@ static int smc_close_final(struct smc_connection *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;
@@ -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) {
sk->sk_err = ECONNABORTED;
- if (smc->clcsock && smc->clcsock->sk) {
- smc->clcsock->sk->sk_err = ECONNABORTED;
- smc->clcsock->sk->sk_state_change(smc->clcsock->sk);
- }
+ if (smc->clcsock && smc->clcsock->sk)
+ tcp_abort(smc->clcsock->sk, ECONNABORTED);
}
switch (sk->sk_state) {
case SMC_ACTIVE:
diff --git a/net/smc/smc_close.h b/net/smc/smc_close.h
index e0e3b5df25d2..084c4f37aa96 100644
--- a/net/smc/smc_close.h
+++ b/net/smc/smc_close.h
@@ -24,5 +24,6 @@ int smc_close_active(struct smc_sock *smc);
int smc_close_shutdown_write(struct smc_sock *smc);
void smc_close_init(struct smc_sock *smc);
void smc_clcsock_release(struct smc_sock *smc);
+int smc_close_abort(struct smc_connection *conn);
#endif /* SMC_CLOSE_H */
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index e7e9dbcd7d8b..494288f32df6 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -513,8 +513,8 @@ static void __smc_lgr_terminate(struct smc_link_group *lgr)
smc = container_of(conn, struct smc_sock, conn);
lock_sock(&smc->sk);
sock_hold(&smc->sk); /* sock_put in close work */
+ smc_close_abort(conn);
conn->killed = 1;
- conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
smc_lgr_unregister_conn(conn);
conn->lgr = NULL;
if (!schedule_work(&conn->close_work))
--
2.17.1
next prev parent reply other threads:[~2019-10-21 14:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 14:13 [PATCH net-next 0/8] net/smc: improve termination handling (part 2) Karsten Graul
2019-10-21 14:13 ` [PATCH net-next 1/8] net/smc: cancel send and receive for terminated socket Karsten Graul
2019-10-21 14:13 ` [PATCH net-next 2/8] net/smc: terminate link group without holding lgr lock Karsten Graul
2019-10-21 14:13 ` [PATCH net-next 3/8] net/smc: improve abnormal termination locking Karsten Graul
2019-10-21 14:13 ` [PATCH net-next 4/8] net/smc: improve link group freeing Karsten Graul
2019-10-21 14:13 ` Karsten Graul [this message]
2019-10-21 14:13 ` [PATCH net-next 6/8] net/smc: improve abnormal termination of link groups Karsten Graul
2019-10-21 14:13 ` [PATCH net-next 7/8] net/smc: introduce link group termination worker Karsten Graul
2019-10-21 14:13 ` [PATCH net-next 8/8] net/smc: remove close abort worker Karsten Graul
2019-10-22 18:36 ` [PATCH net-next 0/8] net/smc: improve termination handling (part 2) Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191021141315.58969-6-kgraul@linux.ibm.com \
--to=kgraul@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=gor@linux.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=raspl@linux.ibm.com \
--cc=ubraun@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox