Re: [RFC PATCH 27/27] epoll: take epitem list out of struct file
From: Al Viro
Date: Mon Oct 05 2020 - 16:49:48 EST
On Mon, Oct 05, 2020 at 04:37:18PM -0400, Qian Cai wrote:
> On Sun, 2020-10-04 at 03:39 +0100, Al Viro wrote:
> > /*
> > * Must be called with "mtx" held.
> > */
> > @@ -1367,19 +1454,21 @@ static int ep_insert(struct eventpoll *ep, const
> > struct epoll_event *event,
> > epi->event = *event;
> > epi->next = EP_UNACTIVE_PTR;
> >
> > - atomic_long_inc(&ep->user->epoll_watches);
> > -
> > if (tep)
> > mutex_lock(&tep->mtx);
> > /* Add the current item to the list of active epoll hook for this file
> > */
> > - spin_lock(&tfile->f_lock);
> > - hlist_add_head_rcu(&epi->fllink, &tfile->f_ep_links);
> > - spin_unlock(&tfile->f_lock);
> > - if (full_check && !tep) {
> > - get_file(tfile);
> > - list_add(&tfile->f_tfile_llink, &tfile_check_list);
> > + if (unlikely(attach_epitem(tfile, epi) < 0)) {
> > + kmem_cache_free(epi_cache, epi);
> > + if (tep)
> > + mutex_lock(&tep->mtx);
>
> Shouldn't this be mutex_unlock() instead?
It should. Fixed and force-pushed...
> > + return -ENOMEM;
> > }
> >
>