diff options
author | Ursula Braun <ubraun@linux.vnet.ibm.com> | 2018-01-25 11:15:35 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-25 16:10:42 -0500 |
commit | 732720fafdb04ad8daec36ba7f09b44641ebc13f (patch) | |
tree | 0b4f8d0b1e745bd79b929852c5353dc34326bd38 /net/smc | |
parent | 610db66f377cf99aa07a2b1990727238f2e2d6d3 (diff) | |
download | linux-732720fafdb04ad8daec36ba7f09b44641ebc13f.tar.bz2 |
net/smc: wake up wr_reg_wait when terminating a link group
If a new connection with a new rmb is added to a link group, its
memory region is registered. If a link group is terminated, a pending
registration requires a wake up.
And consolidate setting of tx_flag peer_conn_abort in smc_lgr_terminate().
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc')
-rw-r--r-- | net/smc/smc_close.c | 14 | ||||
-rw-r--r-- | net/smc/smc_core.c | 8 |
2 files changed, 11 insertions, 11 deletions
diff --git a/net/smc/smc_close.c b/net/smc/smc_close.c index 3dc109f5db56..babe05d385e7 100644 --- a/net/smc/smc_close.c +++ b/net/smc/smc_close.c @@ -89,7 +89,7 @@ static int smc_close_abort(struct smc_connection *conn) } /* terminate smc socket abnormally - active abort - * RDMA communication no longer possible + * link group is terminated, i.e. RDMA communication no longer possible */ static void smc_close_active_abort(struct smc_sock *smc) { @@ -113,7 +113,6 @@ static void smc_close_active_abort(struct smc_sock *smc) break; case SMC_APPCLOSEWAIT1: case SMC_APPCLOSEWAIT2: - txflags->peer_conn_abort = 1; sock_release(smc->clcsock); if (!smc_cdc_rxed_any_close(&smc->conn)) sk->sk_state = SMC_PEERABORTWAIT; @@ -127,7 +126,6 @@ static void smc_close_active_abort(struct smc_sock *smc) case SMC_PEERCLOSEWAIT2: if (!txflags->peer_conn_closed) { sk->sk_state = SMC_PEERABORTWAIT; - txflags->peer_conn_abort = 1; sock_release(smc->clcsock); } else { sk->sk_state = SMC_CLOSED; @@ -135,10 +133,8 @@ static void smc_close_active_abort(struct smc_sock *smc) break; case SMC_PROCESSABORT: case SMC_APPFINCLOSEWAIT: - if (!txflags->peer_conn_closed) { - txflags->peer_conn_abort = 1; + if (!txflags->peer_conn_closed) sock_release(smc->clcsock); - } sk->sk_state = SMC_CLOSED; break; case SMC_PEERFINCLOSEWAIT: @@ -303,8 +299,9 @@ static void smc_close_passive_abort_received(struct smc_sock *smc) } } -/* Some kind of closing has been received: peer_conn_closed, peer_conn_abort, - * or peer_done_writing. +/* Either some kind of closing has been received: peer_conn_closed, + * peer_conn_abort, or peer_done_writing + * or the link group of the connection terminates abnormally. */ static void smc_close_passive_work(struct work_struct *work) { @@ -327,6 +324,7 @@ static void smc_close_passive_work(struct work_struct *work) rxflags = &conn->local_rx_ctrl.conn_state_flags; if (rxflags->peer_conn_abort) { + /* peer has not received all data */ smc_close_passive_abort_received(smc); release_sock(&smc->sk); cancel_delayed_work_sync(&conn->tx_work); diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 7406cbb41856..ed5b46d1fe41 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -234,9 +234,7 @@ static void smc_buf_unuse(struct smc_connection *conn) /* remove a finished connection from its link group */ void smc_conn_free(struct smc_connection *conn) { - struct smc_link_group *lgr = conn->lgr; - - if (!lgr) + if (!conn->lgr) return; smc_cdc_tx_dismiss_slots(conn); smc_lgr_unregister_conn(conn); @@ -331,12 +329,16 @@ void smc_lgr_terminate(struct smc_link_group *lgr) conn = rb_entry(node, struct smc_connection, alert_node); smc = container_of(conn, struct smc_sock, conn); sock_hold(&smc->sk); + conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1; __smc_lgr_unregister_conn(conn); + write_unlock_bh(&lgr->conns_lock); schedule_work(&conn->close_work); + write_lock_bh(&lgr->conns_lock); sock_put(&smc->sk); node = rb_first(&lgr->conns_all); } write_unlock_bh(&lgr->conns_lock); + wake_up(&lgr->lnk[SMC_SINGLE_LINK].wr_reg_wait); } /* Determine vlan of internal TCP socket. |