|
@@ -174,15 +174,15 @@ int smc_close_active(struct smc_sock *smc)
|
|
|
{
|
|
|
struct smc_cdc_conn_state_flags *txflags =
|
|
|
&smc->conn.local_tx_ctrl.conn_state_flags;
|
|
|
- long timeout = SMC_MAX_STREAM_WAIT_TIMEOUT;
|
|
|
struct smc_connection *conn = &smc->conn;
|
|
|
struct sock *sk = &smc->sk;
|
|
|
int old_state;
|
|
|
+ long timeout;
|
|
|
int rc = 0;
|
|
|
|
|
|
- if (sock_flag(sk, SOCK_LINGER) &&
|
|
|
- !(current->flags & PF_EXITING))
|
|
|
- timeout = sk->sk_lingertime;
|
|
|
+ timeout = current->flags & PF_EXITING ?
|
|
|
+ 0 : sock_flag(sk, SOCK_LINGER) ?
|
|
|
+ sk->sk_lingertime : SMC_MAX_STREAM_WAIT_TIMEOUT;
|
|
|
|
|
|
again:
|
|
|
old_state = sk->sk_state;
|
|
@@ -208,7 +208,7 @@ again:
|
|
|
case SMC_ACTIVE:
|
|
|
smc_close_stream_wait(smc, timeout);
|
|
|
release_sock(sk);
|
|
|
- cancel_work_sync(&conn->tx_work);
|
|
|
+ cancel_delayed_work_sync(&conn->tx_work);
|
|
|
lock_sock(sk);
|
|
|
if (sk->sk_state == SMC_ACTIVE) {
|
|
|
/* send close request */
|
|
@@ -234,7 +234,7 @@ again:
|
|
|
if (!smc_cdc_rxed_any_close(conn))
|
|
|
smc_close_stream_wait(smc, timeout);
|
|
|
release_sock(sk);
|
|
|
- cancel_work_sync(&conn->tx_work);
|
|
|
+ cancel_delayed_work_sync(&conn->tx_work);
|
|
|
lock_sock(sk);
|
|
|
if (sk->sk_err != ECONNABORTED) {
|
|
|
/* confirm close from peer */
|
|
@@ -263,7 +263,9 @@ again:
|
|
|
/* peer sending PeerConnectionClosed will cause transition */
|
|
|
break;
|
|
|
case SMC_PROCESSABORT:
|
|
|
- cancel_work_sync(&conn->tx_work);
|
|
|
+ release_sock(sk);
|
|
|
+ cancel_delayed_work_sync(&conn->tx_work);
|
|
|
+ lock_sock(sk);
|
|
|
smc_close_abort(conn);
|
|
|
sk->sk_state = SMC_CLOSED;
|
|
|
smc_close_wait_tx_pends(smc);
|
|
@@ -411,13 +413,14 @@ void smc_close_sock_put_work(struct work_struct *work)
|
|
|
int smc_close_shutdown_write(struct smc_sock *smc)
|
|
|
{
|
|
|
struct smc_connection *conn = &smc->conn;
|
|
|
- long timeout = SMC_MAX_STREAM_WAIT_TIMEOUT;
|
|
|
struct sock *sk = &smc->sk;
|
|
|
int old_state;
|
|
|
+ long timeout;
|
|
|
int rc = 0;
|
|
|
|
|
|
- if (sock_flag(sk, SOCK_LINGER))
|
|
|
- timeout = sk->sk_lingertime;
|
|
|
+ timeout = current->flags & PF_EXITING ?
|
|
|
+ 0 : sock_flag(sk, SOCK_LINGER) ?
|
|
|
+ sk->sk_lingertime : SMC_MAX_STREAM_WAIT_TIMEOUT;
|
|
|
|
|
|
again:
|
|
|
old_state = sk->sk_state;
|
|
@@ -425,7 +428,7 @@ again:
|
|
|
case SMC_ACTIVE:
|
|
|
smc_close_stream_wait(smc, timeout);
|
|
|
release_sock(sk);
|
|
|
- cancel_work_sync(&conn->tx_work);
|
|
|
+ cancel_delayed_work_sync(&conn->tx_work);
|
|
|
lock_sock(sk);
|
|
|
/* send close wr request */
|
|
|
rc = smc_close_wr(conn);
|
|
@@ -439,7 +442,7 @@ again:
|
|
|
if (!smc_cdc_rxed_any_close(conn))
|
|
|
smc_close_stream_wait(smc, timeout);
|
|
|
release_sock(sk);
|
|
|
- cancel_work_sync(&conn->tx_work);
|
|
|
+ cancel_delayed_work_sync(&conn->tx_work);
|
|
|
lock_sock(sk);
|
|
|
/* confirm close from peer */
|
|
|
rc = smc_close_wr(conn);
|