]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
tuntap: correctly set SOCKWQ_ASYNC_NOSPACE
authorJason Wang <jasowang@redhat.com>
Mon, 26 Aug 2019 17:14:00 +0000 (19:14 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 17 Sep 2019 16:02:18 +0000 (18:02 +0200)
commit1475a1b528581c0bf4e8b3ad1fc4a0b4dd4f6182
treef537e1fe67b7475ecaedba2fc940dc43ff755f42
parentdd8cdb395192c4a235547ab65e070f12c10f5d0a
tuntap: correctly set SOCKWQ_ASYNC_NOSPACE

BugLink: https://bugs.launchpad.net/bugs/1830756
When link is down, writes to the device might fail with
-EIO. Userspace needs an indication when the status is resolved.  As a
fix, tun_net_open() attempts to wake up writers - but that is only
effective if SOCKWQ_ASYNC_NOSPACE has been set in the past. This is
not the case of vhost_net which only poll for EPOLLOUT after it meets
errors during sendmsg().

This patch fixes this by making sure SOCKWQ_ASYNC_NOSPACE is set when
socket is not writable or device is down to guarantee EPOLLOUT will be
raised in either tun_chr_poll() or tun_sock_write_space() after device
is up.

Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Eric Dumazet <edumazet@google.com>
Fixes: 1bd4978a88ac2 ("tun: honor IFF_UP in tun_get_user()")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(backported from commit 2f3ab6221e4c87960347d65c7cab9bd917d1f637)
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/net/tun.c