net/smc: no socket state changes in tasklet context
Several state changes occur during SMC socket closing. Currently state changes triggered locally occur in process context with lock_sock() taken while state changes triggered by peer occur in tasklet context with bh_lock_sock() taken. bh_lock_sock() does not wait till a lock_sock(() task in process context is finished. This may lead to races in socket state transitions resulting in dangling SMC-sockets, or it may lead to duplicate SMC socket freeing. This patch introduces a closing worker to run all state changes under lock_sock(). Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com> Reported-by: Dave Jones <davej@codemonkey.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
90e9517ed9
commit
46c28dbd4c
@@ -217,8 +217,13 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc,
|
||||
smc->sk.sk_err = ECONNRESET;
|
||||
conn->local_tx_ctrl.conn_state_flags.peer_conn_abort = 1;
|
||||
}
|
||||
if (smc_cdc_rxed_any_close_or_senddone(conn))
|
||||
smc_close_passive_received(smc);
|
||||
if (smc_cdc_rxed_any_close_or_senddone(conn)) {
|
||||
smc->sk.sk_shutdown |= RCV_SHUTDOWN;
|
||||
if (smc->clcsock && smc->clcsock->sk)
|
||||
smc->clcsock->sk->sk_shutdown |= RCV_SHUTDOWN;
|
||||
sock_set_flag(&smc->sk, SOCK_DONE);
|
||||
schedule_work(&conn->close_work);
|
||||
}
|
||||
|
||||
/* piggy backed tx info */
|
||||
/* trigger sndbuf consumer: RDMA write into peer RMBE and CDC */
|
||||
|
Reference in New Issue
Block a user