On Tue, Apr 03, 2018 at 17:00 +0200, Lukas Larsson wrote: > On Fri, Mar 30, 2018 at 1:51 AM, Mike Belopuhov <m...@belopuhov.com> wrote: > > > On Fri, Mar 30, 2018 at 01:21 +0200, Mike Belopuhov wrote: > > > > > > Hi, > > > > > > This appears to be an issue with reactivating disabled event sources > > > in kqueue_register. Something along the lines of FreeBSD commits: > > > > > > https://svnweb.freebsd.org/base?view=revision&revision=274560 and > > > https://reviews.freebsd.org/rS295786 where parent differential review > > > https://reviews.freebsd.org/D5307 has some additional comments. > > > > > > In any case, by either porting their code (#else branch) or slightly > > > adjusting our own (I think that should be enough), I can no longer > > > reproduce the issue you've reported. Please test and report back if > > > that solves your original issue. Either variants will require > > > rigorous testing and a thorough review. > > > > > > Cheers, > > > Mike > > > > > > > After a bit of tinkering, I think I can minimize the change even > > further. Basically we just need to call the filter once and if > > there's some data available, it'll return true and we'll mark the > > knote as active. > > > > diff --git sys/kern/kern_event.c sys/kern/kern_event.c > > index fb9cad360b1..4e0949645cb 100644 > > --- sys/kern/kern_event.c > > +++ sys/kern/kern_event.c > > @@ -671,10 +671,12 @@ kqueue_register(struct kqueue *kq, struct kevent > > *kev, struct proc *p) > > } > > > > if ((kev->flags & EV_ENABLE) && (kn->kn_status & KN_DISABLED)) { > > s = splhigh(); > > kn->kn_status &= ~KN_DISABLED; > > + if (kn->kn_fop->f_event(kn, 0)) > > + kn->kn_status |= KN_ACTIVE; > > if ((kn->kn_status & KN_ACTIVE) && > > ((kn->kn_status & KN_QUEUED) == 0)) > > knote_enqueue(kn); > > splx(s); > > } > > > > Hello, > > Thank you for your help and the patch. I've applied the smaller patch to > one of our test machines > and the small testcase I sent here on the list has been fixed. I also ran > our larger test suites where > I first found the issue and those work as well. > > Lukas
Thanks a lot for a great bug report and testing, I've checked in the diff. Cheers, Mike