Commit 81d0b759 authored by David S. Miller's avatar David S. Miller

Merge branch 'net-smc-fixes'

Ursula Braun says:

====================
net/smc: fixes 2018-09-18

here are some fixes in different areas of the smc code for the net
tree.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2fe397a3 38189779
...@@ -742,7 +742,10 @@ static void smc_connect_work(struct work_struct *work) ...@@ -742,7 +742,10 @@ static void smc_connect_work(struct work_struct *work)
smc->sk.sk_err = -rc; smc->sk.sk_err = -rc;
out: out:
smc->sk.sk_state_change(&smc->sk); if (smc->sk.sk_err)
smc->sk.sk_state_change(&smc->sk);
else
smc->sk.sk_write_space(&smc->sk);
kfree(smc->connect_info); kfree(smc->connect_info);
smc->connect_info = NULL; smc->connect_info = NULL;
release_sock(&smc->sk); release_sock(&smc->sk);
...@@ -1150,9 +1153,9 @@ static int smc_listen_rdma_reg(struct smc_sock *new_smc, int local_contact) ...@@ -1150,9 +1153,9 @@ static int smc_listen_rdma_reg(struct smc_sock *new_smc, int local_contact)
} }
/* listen worker: finish RDMA setup */ /* listen worker: finish RDMA setup */
static void smc_listen_rdma_finish(struct smc_sock *new_smc, static int smc_listen_rdma_finish(struct smc_sock *new_smc,
struct smc_clc_msg_accept_confirm *cclc, struct smc_clc_msg_accept_confirm *cclc,
int local_contact) int local_contact)
{ {
struct smc_link *link = &new_smc->conn.lgr->lnk[SMC_SINGLE_LINK]; struct smc_link *link = &new_smc->conn.lgr->lnk[SMC_SINGLE_LINK];
int reason_code = 0; int reason_code = 0;
...@@ -1175,11 +1178,12 @@ static void smc_listen_rdma_finish(struct smc_sock *new_smc, ...@@ -1175,11 +1178,12 @@ static void smc_listen_rdma_finish(struct smc_sock *new_smc,
if (reason_code) if (reason_code)
goto decline; goto decline;
} }
return; return 0;
decline: decline:
mutex_unlock(&smc_create_lgr_pending); mutex_unlock(&smc_create_lgr_pending);
smc_listen_decline(new_smc, reason_code, local_contact); smc_listen_decline(new_smc, reason_code, local_contact);
return reason_code;
} }
/* setup for RDMA connection of server */ /* setup for RDMA connection of server */
...@@ -1276,8 +1280,10 @@ static void smc_listen_work(struct work_struct *work) ...@@ -1276,8 +1280,10 @@ static void smc_listen_work(struct work_struct *work)
} }
/* finish worker */ /* finish worker */
if (!ism_supported) if (!ism_supported) {
smc_listen_rdma_finish(new_smc, &cclc, local_contact); if (smc_listen_rdma_finish(new_smc, &cclc, local_contact))
return;
}
smc_conn_save_peer_info(new_smc, &cclc); smc_conn_save_peer_info(new_smc, &cclc);
mutex_unlock(&smc_create_lgr_pending); mutex_unlock(&smc_create_lgr_pending);
smc_listen_out_connected(new_smc); smc_listen_out_connected(new_smc);
...@@ -1529,7 +1535,7 @@ static __poll_t smc_poll(struct file *file, struct socket *sock, ...@@ -1529,7 +1535,7 @@ static __poll_t smc_poll(struct file *file, struct socket *sock,
return EPOLLNVAL; return EPOLLNVAL;
smc = smc_sk(sock->sk); smc = smc_sk(sock->sk);
if ((sk->sk_state == SMC_INIT) || smc->use_fallback) { if (smc->use_fallback) {
/* delegate to CLC child sock */ /* delegate to CLC child sock */
mask = smc->clcsock->ops->poll(file, smc->clcsock, wait); mask = smc->clcsock->ops->poll(file, smc->clcsock, wait);
sk->sk_err = smc->clcsock->sk->sk_err; sk->sk_err = smc->clcsock->sk->sk_err;
...@@ -1560,9 +1566,9 @@ static __poll_t smc_poll(struct file *file, struct socket *sock, ...@@ -1560,9 +1566,9 @@ static __poll_t smc_poll(struct file *file, struct socket *sock,
mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP;
if (sk->sk_state == SMC_APPCLOSEWAIT1) if (sk->sk_state == SMC_APPCLOSEWAIT1)
mask |= EPOLLIN; mask |= EPOLLIN;
if (smc->conn.urg_state == SMC_URG_VALID)
mask |= EPOLLPRI;
} }
if (smc->conn.urg_state == SMC_URG_VALID)
mask |= EPOLLPRI;
} }
return mask; return mask;
......
...@@ -446,14 +446,12 @@ int smc_clc_send_proposal(struct smc_sock *smc, int smc_type, ...@@ -446,14 +446,12 @@ int smc_clc_send_proposal(struct smc_sock *smc, int smc_type,
vec[i++].iov_len = sizeof(trl); vec[i++].iov_len = sizeof(trl);
/* due to the few bytes needed for clc-handshake this cannot block */ /* due to the few bytes needed for clc-handshake this cannot block */
len = kernel_sendmsg(smc->clcsock, &msg, vec, i, plen); len = kernel_sendmsg(smc->clcsock, &msg, vec, i, plen);
if (len < sizeof(pclc)) { if (len < 0) {
if (len >= 0) { smc->sk.sk_err = smc->clcsock->sk->sk_err;
reason_code = -ENETUNREACH; reason_code = -smc->sk.sk_err;
smc->sk.sk_err = -reason_code; } else if (len < (int)sizeof(pclc)) {
} else { reason_code = -ENETUNREACH;
smc->sk.sk_err = smc->clcsock->sk->sk_err; smc->sk.sk_err = -reason_code;
reason_code = -smc->sk.sk_err;
}
} }
return reason_code; return reason_code;
......
...@@ -100,15 +100,14 @@ static void smc_close_active_abort(struct smc_sock *smc) ...@@ -100,15 +100,14 @@ static void smc_close_active_abort(struct smc_sock *smc)
struct smc_cdc_conn_state_flags *txflags = struct smc_cdc_conn_state_flags *txflags =
&smc->conn.local_tx_ctrl.conn_state_flags; &smc->conn.local_tx_ctrl.conn_state_flags;
sk->sk_err = ECONNABORTED; if (sk->sk_state != SMC_INIT && smc->clcsock && smc->clcsock->sk) {
if (smc->clcsock && smc->clcsock->sk) { sk->sk_err = ECONNABORTED;
smc->clcsock->sk->sk_err = ECONNABORTED; if (smc->clcsock && smc->clcsock->sk) {
smc->clcsock->sk->sk_state_change(smc->clcsock->sk); smc->clcsock->sk->sk_err = ECONNABORTED;
smc->clcsock->sk->sk_state_change(smc->clcsock->sk);
}
} }
switch (sk->sk_state) { switch (sk->sk_state) {
case SMC_INIT:
sk->sk_state = SMC_PEERABORTWAIT;
break;
case SMC_ACTIVE: case SMC_ACTIVE:
sk->sk_state = SMC_PEERABORTWAIT; sk->sk_state = SMC_PEERABORTWAIT;
release_sock(sk); release_sock(sk);
...@@ -143,6 +142,7 @@ static void smc_close_active_abort(struct smc_sock *smc) ...@@ -143,6 +142,7 @@ static void smc_close_active_abort(struct smc_sock *smc)
case SMC_PEERFINCLOSEWAIT: case SMC_PEERFINCLOSEWAIT:
sock_put(sk); /* passive closing */ sock_put(sk); /* passive closing */
break; break;
case SMC_INIT:
case SMC_PEERABORTWAIT: case SMC_PEERABORTWAIT:
case SMC_CLOSED: case SMC_CLOSED:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment