]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
af_unix: fix unix_dgram_poll() behavior for EPOLLOUT event
authorEric Dumazet <eric.dumazet@gmail.com>
Sun, 31 Oct 2010 05:36:23 +0000 (05:36 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Nov 2010 21:50:09 +0000 (13:50 -0800)
commit5456f09aaf88731e16dbcea7522cb330b6846415
treeeac95420f5da87dc95342aa23d9a97653544863d
parent67426b756c4d52c511c4b22b269accea171692a8
af_unix: fix unix_dgram_poll() behavior for EPOLLOUT event

Alban Crequy reported a problem with connected dgram af_unix sockets and
provided a test program. epoll() would miss to send an EPOLLOUT event
when a thread unqueues a packet from the other peer, making its receive
queue not full.

This is because unix_dgram_poll() fails to call sock_poll_wait(file,
&unix_sk(other)->peer_wait, wait);
if the socket is not writeable at the time epoll_ctl(ADD) is called.

We must call sock_poll_wait(), regardless of 'writable' status, so that
epoll can be notified later of states changes.

Misc: avoids testing twice (sk->sk_shutdown & RCV_SHUTDOWN)

Reported-by: Alban Crequy <alban.crequy@collabora.co.uk>
Cc: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/unix/af_unix.c