Skip to content

Commit 648a5a7

Browse files
Ursula Braundavem330
authored andcommitted
net/smc: fix non-blocking connect problem
In state SMC_INIT smc_poll() delegates polling to the internal CLC socket. This means, once the connect worker has finished its kernel_connect() step, the poll wake-up may occur. This is not intended. The wake-up should occur from the wake up call in smc_connect_work() after __smc_connect() has finished. Thus in state SMC_INIT this patch now calls sock_poll_wait() on the main SMC socket. Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2fe397a commit 648a5a7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/smc/af_smc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,10 @@ static void smc_connect_work(struct work_struct *work)
742742
smc->sk.sk_err = -rc;
743743

744744
out:
745-
smc->sk.sk_state_change(&smc->sk);
745+
if (smc->sk.sk_err)
746+
smc->sk.sk_state_change(&smc->sk);
747+
else
748+
smc->sk.sk_write_space(&smc->sk);
746749
kfree(smc->connect_info);
747750
smc->connect_info = NULL;
748751
release_sock(&smc->sk);
@@ -1529,7 +1532,7 @@ static __poll_t smc_poll(struct file *file, struct socket *sock,
15291532
return EPOLLNVAL;
15301533

15311534
smc = smc_sk(sock->sk);
1532-
if ((sk->sk_state == SMC_INIT) || smc->use_fallback) {
1535+
if (smc->use_fallback) {
15331536
/* delegate to CLC child sock */
15341537
mask = smc->clcsock->ops->poll(file, smc->clcsock, wait);
15351538
sk->sk_err = smc->clcsock->sk->sk_err;

0 commit comments

Comments
 (0)