Re: [PATCH 1/2] epoll: use the waitqueue lock to protect ep->wq

From: Christoph Hellwig
Date: Thu Dec 14 2017 - 08:05:36 EST


On Thu, Dec 07, 2017 at 11:09:11AM -0500, Jason Baron wrote:
> On 12/06/2017 06:52 PM, Christoph Hellwig wrote:
> > The eoll code currently always uses the unlocked waitqueue helpers for
> > ep->wq, but instead of holding the lock inside the waitqueue around these
> > calls, as expected by the epoll code uses its own lock. Given that the
> > waitqueue is not exposed to the rest of the kernel this actually works
> > ok at the moment, but prevents the epoll locking rules from being
> > enforced using lockdep. Remove ep->lock and use the waitqueue lock
> > to not only reduce the size of struct eventpoll but also make sure we
> > can assert locking invariations in the waitqueue code.
> >
> > Signed-off-by: Christoph Hellwig <hch@xxxxxx>
>
> Probably should also fix the locking comments at the top of
> fs/eventpoll.c that refer to ep->lock...

Done. Note that while doing this I noticed that the epoll code
seems to have sketchy workarounds for the fact that it abused ep->poll
as the waitqueue lock that might be able to be removed now.
But I don't really dare to touch the guts of this code.