Skip to content

Commit 732720f

Browse files
Ursula Braundavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 610db66 commit 732720f

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

net/smc/smc_close.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static int smc_close_abort(struct smc_connection *conn)
8989
}
9090

9191
/* terminate smc socket abnormally - active abort
92-
* RDMA communication no longer possible
92+
* link group is terminated, i.e. RDMA communication no longer possible
9393
*/
9494
static void smc_close_active_abort(struct smc_sock *smc)
9595
{
@@ -113,7 +113,6 @@ static void smc_close_active_abort(struct smc_sock *smc)
113113
break;
114114
case SMC_APPCLOSEWAIT1:
115115
case SMC_APPCLOSEWAIT2:
116-
txflags->peer_conn_abort = 1;
117116
sock_release(smc->clcsock);
118117
if (!smc_cdc_rxed_any_close(&smc->conn))
119118
sk->sk_state = SMC_PEERABORTWAIT;
@@ -127,18 +126,15 @@ static void smc_close_active_abort(struct smc_sock *smc)
127126
case SMC_PEERCLOSEWAIT2:
128127
if (!txflags->peer_conn_closed) {
129128
sk->sk_state = SMC_PEERABORTWAIT;
130-
txflags->peer_conn_abort = 1;
131129
sock_release(smc->clcsock);
132130
} else {
133131
sk->sk_state = SMC_CLOSED;
134132
}
135133
break;
136134
case SMC_PROCESSABORT:
137135
case SMC_APPFINCLOSEWAIT:
138-
if (!txflags->peer_conn_closed) {
139-
txflags->peer_conn_abort = 1;
136+
if (!txflags->peer_conn_closed)
140137
sock_release(smc->clcsock);
141-
}
142138
sk->sk_state = SMC_CLOSED;
143139
break;
144140
case SMC_PEERFINCLOSEWAIT:
@@ -303,8 +299,9 @@ static void smc_close_passive_abort_received(struct smc_sock *smc)
303299
}
304300
}
305301

306-
/* Some kind of closing has been received: peer_conn_closed, peer_conn_abort,
307-
* or peer_done_writing.
302+
/* Either some kind of closing has been received: peer_conn_closed,
303+
* peer_conn_abort, or peer_done_writing
304+
* or the link group of the connection terminates abnormally.
308305
*/
309306
static void smc_close_passive_work(struct work_struct *work)
310307
{
@@ -327,6 +324,7 @@ static void smc_close_passive_work(struct work_struct *work)
327324

328325
rxflags = &conn->local_rx_ctrl.conn_state_flags;
329326
if (rxflags->peer_conn_abort) {
327+
/* peer has not received all data */
330328
smc_close_passive_abort_received(smc);
331329
release_sock(&smc->sk);
332330
cancel_delayed_work_sync(&conn->tx_work);

net/smc/smc_core.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,7 @@ static void smc_buf_unuse(struct smc_connection *conn)
234234
/* remove a finished connection from its link group */
235235
void smc_conn_free(struct smc_connection *conn)
236236
{
237-
struct smc_link_group *lgr = conn->lgr;
238-
239-
if (!lgr)
237+
if (!conn->lgr)
240238
return;
241239
smc_cdc_tx_dismiss_slots(conn);
242240
smc_lgr_unregister_conn(conn);
@@ -331,12 +329,16 @@ void smc_lgr_terminate(struct smc_link_group *lgr)
331329
conn = rb_entry(node, struct smc_connection, alert_node);
332330
smc = container_of(conn, struct smc_sock, conn);
333331
sock_hold(&smc->sk);
332+
conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
334333
__smc_lgr_unregister_conn(conn);
334+
write_unlock_bh(&lgr->conns_lock);
335335
schedule_work(&conn->close_work);
336+
write_lock_bh(&lgr->conns_lock);
336337
sock_put(&smc->sk);
337338
node = rb_first(&lgr->conns_all);
338339
}
339340
write_unlock_bh(&lgr->conns_lock);
341+
wake_up(&lgr->lnk[SMC_SINGLE_LINK].wr_reg_wait);
340342
}
341343

342344
/* Determine vlan of internal TCP socket.

0 commit comments

Comments
 (0)