hold the list lock over the f_event and KNOTE_ACTIVATE calls... This closes

a race where data could come in before we clear the INFLUX flag, and get
skipped over by knote (and hence never be activated, though it should of
been)...

Found by:	glebius & co.
Reviewed by:	glebius
MFC after:	3 days
This commit is contained in:
John-Mark Gurney 2006-03-29 18:15:30 +00:00
parent 029c3cdf55
commit 4e095bc045
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157267

View File

@ -923,11 +923,11 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct thread *td, int wa
* which will remove it from the list, and NULL kn_knlist.
*/
event = kn->kn_fop->f_event(kn, 0);
KN_LIST_UNLOCK(kn);
KQ_LOCK(kq);
if (event)
KNOTE_ACTIVATE(kn, 1);
kn->kn_status &= ~KN_INFLUX;
KN_LIST_UNLOCK(kn);
} else if (kev->flags & EV_DELETE) {
kn->kn_status |= KN_INFLUX;
KQ_UNLOCK(kq);