Davide Libenzi 9ce209d64d epoll: avoid double-inserts in case of EFAULT
In commit f337b9c58332bdecde965b436e47ea4c94d30da0 ("epoll: drop
unnecessary test") Thomas found that there is an unnecessary (always
true) test in ep_send_events().  The callback never inserts into
->rdllink while the send loop is performed, and also does the
~EP_PRIVATE_BITS test.  Given we're holding the mutex during this time,
the conditions tested inside the loop are always true.

HOWEVER.

The test "!ep_is_linked(&epi->rdllink)" wasn't there because we insert
into ->rdllink, but because the send-events loop might terminate before
the whole list is scanned (-EFAULT).

In such cases, when the loop terminates early, and when a (leftover)
file received an event while we're performing the lockless loop, we need
such test to avoid to double insert the epoll items.  The list_splice()
done a few steps below, will correctly re-insert the ones that were left
on "txlist".

This should fix the kenrel.org bugzilla entry 11831.

Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-26 12:09:49 -07:00
..
2008-10-22 18:48:45 -05:00
2008-08-20 15:40:32 -07:00
2008-10-13 09:47:43 +11:00
2008-09-05 09:51:30 -05:00
2008-04-29 08:06:00 -07:00
2008-10-23 05:12:58 -04:00
2008-07-25 10:53:34 -07:00
2008-10-17 02:38:36 +11:00
2008-07-25 10:53:34 -07:00
2008-07-26 20:53:40 -04:00
2008-07-26 12:00:08 -07:00
2008-10-16 11:21:38 -07:00
2008-10-09 08:57:05 +02:00
2008-10-20 08:52:32 -07:00
2008-10-23 05:12:59 -04:00
2008-01-30 13:31:46 +01:00
2008-05-01 13:08:16 -04:00
2008-08-01 11:25:24 -04:00
2008-02-06 10:41:07 -08:00
2008-10-23 05:13:00 -04:00
2008-10-16 11:21:51 -07:00
2008-02-14 21:13:33 -08:00
2008-07-25 10:53:35 -07:00