Skip to content

Commit 5789d04

Browse files
committed
Merge branch 'smc-fixes'
Tony Lu says: ==================== smc: Fixes for closing process and minor cleanup Patch 1 is a minor cleanup for local struct sock variables. Patch 2 ensures the active closing side enters TIME_WAIT. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 1c74312 + 606a63c commit 5789d04

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

net/smc/smc_close.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ int smc_close_active(struct smc_sock *smc)
228228
/* send close request */
229229
rc = smc_close_final(conn);
230230
sk->sk_state = SMC_PEERCLOSEWAIT1;
231+
232+
/* actively shutdown clcsock before peer close it,
233+
* prevent peer from entering TIME_WAIT state.
234+
*/
235+
if (smc->clcsock && smc->clcsock->sk)
236+
rc = kernel_sock_shutdown(smc->clcsock, SHUT_RDWR);
231237
} else {
232238
/* peer event has changed the state */
233239
goto again;
@@ -354,9 +360,9 @@ static void smc_close_passive_work(struct work_struct *work)
354360
if (rxflags->peer_conn_abort) {
355361
/* peer has not received all data */
356362
smc_close_passive_abort_received(smc);
357-
release_sock(&smc->sk);
363+
release_sock(sk);
358364
cancel_delayed_work_sync(&conn->tx_work);
359-
lock_sock(&smc->sk);
365+
lock_sock(sk);
360366
goto wakeup;
361367
}
362368

0 commit comments

Comments
 (0)