Re: [PATCH] thread wakeup fix for 2.4.0-test7

From: Rusty Russell (rusty@linuxcare.com.au)
Date: Fri Aug 25 2000 - 22:25:55 EST


In message <Pine.LNX.4.10.10008251011290.9381-100000@penguin.transmeta.com> you
 write:
> On Fri, 25 Aug 2000, Rusty Russell wrote:
> >
> > BUG: thread 1 is doing poll() on an fd, thread 2 closes it,
> > and thread 1 doesn't wake up. Included is a small test program and
> > Makefile.
>
> Why do you call this a bug?
>
> Thread 1 still has the fd open (it's used by the poll()).
>
> The fact that thread 2 removed it from the fd table is immaterial.

Your implementation disagrees with you: poll already returns POLLNVAL.
With the patch it just returns it immediately, rather than returning
it when/if it times out.

Single Unix Specification also disagrees with you:

        The close() function will deallocate the file descriptor
        indicated by fildes. To deallocate means to make the file
        descriptor available for return by subsequent calls to open()
        or other functions that allocate file descriptors.

So we could sleep in close (forever, maybe) until the polls are
finished if you prefer.

close doesn't close. This would be a ``bug'', Linus.

Rusty.

--
Hacking time.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:17 EST