The logic in fs/eventpoll.c:ep_insert() checks to see if events are
already present when processing an EP_CTL_ADD operation, and, if any are,
adds them to the list. It does not wake up any waiters, so, e.g., another
thread waiting in epoll_wait() will not be awakened for these events. The
fix is to have ep_insert() do wakeups, just as ep_poll_callback() does when
it adds events.
-J
diff -ur linux-2.5.46.orig/fs/eventpoll.c linux-2.5.46/fs/eventpoll.c
--- linux-2.5.46.orig/fs/eventpoll.c Thu Nov 7 14:31:21 2002
+++ linux-2.5.46/fs/eventpoll.c Thu Nov 7 14:32:16 2002
@@ -838,8 +838,13 @@
list_add(&dpi->llink, ep_hash_entry(ep, ep_hash_index(ep, tfile)));
/* If the file is already "ready" we drop it inside the ready list */
- if ((revents & pfd->events) && !EP_IS_LINKED(&dpi->rdllink))
+ if ((revents & pfd->events) && !EP_IS_LINKED(&dpi->rdllink)) {
list_add(&dpi->rdllink, &ep->rdllist);
+ if (waitqueue_active(&ep->wq))
+ wake_up(&ep->wq);
+ if (waitqueue_active(&ep->poll_wait))
+ wake_up(&ep->poll_wait);
+ }
write_unlock_irqrestore(&ep->lock, flags);
(See attached file: epoll-2.5.46-insert.patch)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Nov 07 2002 - 22:00:50 EST