On Tue, Dec 15, 2020 at 09:58:16AM -0300, Martin Pieuchot wrote:
> On 11/12/20(Fri) 17:37, Visa Hankala wrote:
> > Index: kern/kern_event.c
> > ===================================================================
> > RCS file: src/sys/kern/kern_event.c,v
> > retrieving revision 1.147
> > diff -u -p -r1.147 kern_event.c
> > --- kern/kern_event.c 9 Dec 2020 18:58:19 -0000 1.147
> > +++ kern/kern_event.c 11 Dec 2020 17:05:09 -0000
> > @@ -1539,9 +1576,14 @@ klist_invalidate(struct klist *list)
> > NET_ASSERT_UNLOCKED();
> >
> > s = splhigh();
> > + ls = klist_lock(list);
>
> Isn't splhigh() redundant with klist_lock() now? If a subsystem
> provides its own lock/unlock routine shouldn't it ensure that the
> necessary SPL is used? Or is this protecting something else? Or is
> it just paranoia and we should try to remove it in a later step?
splhigh() is needed by knote_acquire(). The code will change when
a mutex is added to it.
> > while ((kn = SLIST_FIRST(&list->kl_list)) != NULL) {
> > - if (!knote_acquire(kn))
> > + if (!knote_acquire(kn, list, ls)) {
> > + /* knote_acquire() has unlocked list. */
> > + ls = klist_lock(list);
> > continue;
> > + }
> > + klist_unlock(list, ls);
> > splx(s);
> > kn->kn_fop->f_detach(kn);
> > if (kn->kn_fop->f_flags & FILTEROP_ISFD) {
>