Re: [PATCH 1/6] [2.6.29] epoll: fix for epoll_wait sometimes returning events on closed fds

Davide Libenzi
2009-02-24T20:45:28Z

On Tue, 24 Feb 2009, Tony Battersby wrote:

> Ugh. The manpage on Ubuntu 8.04 that I am using doesn't contain this
> lengthy caveat; it just says "A6 Yes." To me it sounds like the
> (newer) manpage is just documenting away a bug/misfeature with "It's
> supposed to do that. Gives it character." rather than expecting the
> kernel developers to make the API behave in a more reasonable way. Just
> my opinion; others may agree or disagree.
>
> If the officially-sanctioned epoll interface is supposed to report
> events on fds that were added, duped, and then the original fd closed,
> then my patch will probably break that behavior. In that case, it will
> be more difficult to fix problem that my patch is trying to fix (which
> doesn't involve dup, dup2, fcntl, fork, etc.). So before I try to think
> of another way, let me ask: do we want to fix the problem that I am
> reporting, or just document it away in the manpage as (apparently) has
> been done before?

No. Like it has been explained, MT applications can report events for
closed files anyway. It is a matter of where the close() happen in time
(pretty easy to figure out if you make a time/thread chart).
As for the other patches, some could be applied, but I didn't look at them
deeply and I need time to review them. Will take time to review them
tomorrow or the day after.

- Davide