Date: Tue, 20 Nov 2018 11:55:54 +0100 From: Sylvain GALLIANO <sg@efficientip.com> To: markj@freebsd.org Cc: freebsd-current@freebsd.org Subject: Re: Panic on kern_event.c Message-ID: <CAHdyrksGBZ-VNaanJFQYDQ1w9RxjiA7SDQgZZJs0Z-KtPitNpA@mail.gmail.com> In-Reply-To: <20181120064500.GA2371@raichu> References: <CAHdyrkvqGp8PGFaCSGgeDFC7wBhjnHK4eL99WM5fMO_yZ_u5KA@mail.gmail.com> <20181107043503.GB30861@raichu> <CAHdyrkt42cn8%2BKqhp-jQ9iZNnreypMT1qybNTcFtx8JivKggZA@mail.gmail.com> <20181115221019.GA2514@raichu> <CAHdyrksHLvzXDkjoy2PpiTgb%2BmEKHJ979rwcW3RJx32qdAyJzg@mail.gmail.com> <20181116154210.GB17379@raichu> <CAHdyrku4OPRr1Ku0WF3XT3vK_dqvNzWN%2BMYz7pXTkiNJakfJGQ@mail.gmail.com> <20181118003554.GC2799@raichu> <CAHdyrksNptg1cMorN9Y5xMdQb2UoZPBLOQRZ7huwMS=Afjt5%2BQ@mail.gmail.com> <20181120064500.GA2371@raichu>
next in thread | previous in thread | raw e-mail | index | archive | help
No issue using patched kernel on 2 servers (under stress test since +2 hours), Thanks ! Le mar. 20 nov. 2018 =C3=A0 07:45, Mark Johnston <markj@freebsd.org> a =C3= =A9crit : > On Mon, Nov 19, 2018 at 10:26:51AM +0100, Sylvain GALLIANO wrote: > > With this latest patch, after stressing syslog-ng few minutes, it do no= t > > log anymore and a simple kill do not work (I have to do kill -9) > > Thanks for your patience. I finally managed to reproduce the problem > and can see the bug now. Please try this patch instead. > > diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c > index d9c670e29d60..0be765a040ed 100644 > --- a/sys/kern/kern_event.c > +++ b/sys/kern/kern_event.c > @@ -1538,6 +1538,10 @@ kqueue_register(struct kqueue *kq, struct kevent > *kev, struct thread *td, int wa > kn_enter_flux(kn); > > error =3D knote_attach(kn, kq); > + if ((kev->flags & EV_ENABLE) !=3D 0) > + kn->kn_status &=3D ~KN_DISABLED; > + else if ((kev->flags & EV_DISABLE) !=3D 0) > + kn->kn_status |=3D KN_DISABLED; > KQ_UNLOCK(kq); > if (error !=3D 0) { > tkn =3D kn; > @@ -1570,6 +1574,11 @@ kqueue_register(struct kqueue *kq, struct kevent > *kev, struct thread *td, int wa > KNOTE_ACTIVATE(kn, 1); > } > > + if ((kev->flags & EV_ENABLE) !=3D 0) > + kn->kn_status &=3D ~KN_DISABLED; > + else if ((kev->flags & EV_DISABLE) !=3D 0) > + kn->kn_status |=3D KN_DISABLED; > + > /* > * The user may change some filter values after the initial EV_AD= D, > * but doing so will not reset any filter which has already been > @@ -1595,11 +1604,9 @@ kqueue_register(struct kqueue *kq, struct kevent > *kev, struct thread *td, int wa > * kn_knlist. > */ > done_ev_add: > - if ((kev->flags & EV_ENABLE) !=3D 0) > - kn->kn_status &=3D ~KN_DISABLED; > - else if ((kev->flags & EV_DISABLE) !=3D 0) > - kn->kn_status |=3D KN_DISABLED; > - > + /* > + * KN_DISABLED will be stable while the knote is in flux. > + */ > if ((kn->kn_status & KN_DISABLED) =3D=3D 0) > event =3D kn->kn_fop->f_event(kn, 0); > else > @@ -1861,6 +1868,8 @@ kqueue_scan(struct kqueue *kq, int maxevents, struc= t > kevent_copyops *k_ops, > } > > TAILQ_REMOVE(&kq->kq_head, kn, kn_tqe); > + KASSERT(kn =3D=3D marker || (kn->kn_status & KN_QUEUED) != =3D 0, > + ("knote %p not queued", kn)); > if ((kn->kn_status & KN_DISABLED) =3D=3D KN_DISABLED) { > kn->kn_status &=3D ~KN_QUEUED; > kq->kq_count--; >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHdyrksGBZ-VNaanJFQYDQ1w9RxjiA7SDQgZZJs0Z-KtPitNpA>