diff options
author | Jason Baron <jbaron@akamai.com> | 2019-08-19 14:36:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-06 10:22:06 +0200 |
commit | 3e79bd1e4f9aad859e3eb4a24463979d47f1fb10 (patch) | |
tree | 298dffb0acd8fdc464ab24a2f7e76283a02a9fe4 /net/smc/smc_tx.c | |
parent | ff129837a5f6837bc10310201d132a66210e4879 (diff) | |
download | linux-stable-3e79bd1e4f9aad859e3eb4a24463979d47f1fb10.tar.gz linux-stable-3e79bd1e4f9aad859e3eb4a24463979d47f1fb10.tar.bz2 linux-stable-3e79bd1e4f9aad859e3eb4a24463979d47f1fb10.zip |
net/smc: make sure EPOLLOUT is raised
[ Upstream commit 4651d1802f7063e4d8c0bcad957f46ece0c04024 ]
Currently, we are only explicitly setting SOCK_NOSPACE on a write timeout
for non-blocking sockets. Epoll() edge-trigger mode relies on SOCK_NOSPACE
being set when -EAGAIN is returned to ensure that EPOLLOUT is raised.
Expand the setting of SOCK_NOSPACE to non-blocking sockets as well that can
use SO_SNDTIMEO to adjust their write timeout. This mirrors the behavior
that Eric Dumazet introduced for tcp sockets.
Signed-off-by: Jason Baron <jbaron@akamai.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Ursula Braun <ubraun@linux.ibm.com>
Cc: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/smc/smc_tx.c')
-rw-r--r-- | net/smc/smc_tx.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c index d8366ed51757..28361aef9982 100644 --- a/net/smc/smc_tx.c +++ b/net/smc/smc_tx.c @@ -75,13 +75,11 @@ static int smc_tx_wait(struct smc_sock *smc, int flags) DEFINE_WAIT_FUNC(wait, woken_wake_function); struct smc_connection *conn = &smc->conn; struct sock *sk = &smc->sk; - bool noblock; long timeo; int rc = 0; /* similar to sk_stream_wait_memory */ timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); - noblock = timeo ? false : true; add_wait_queue(sk_sleep(sk), &wait); while (1) { sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); @@ -96,8 +94,8 @@ static int smc_tx_wait(struct smc_sock *smc, int flags) break; } if (!timeo) { - if (noblock) - set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); + /* ensure EPOLLOUT is subsequently generated */ + set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); rc = -EAGAIN; break; } |