From 31580e6817ead1f0ce9d7186b69b9a06ef75675b Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Tue, 14 Sep 2004 18:38:16 +0000 Subject: [PATCH] unlock global lock in kqueue_scan before msleep'ing to prevent dead lock.. we didn't unlock global lock earlier to prevent just having to reaquire it again.. Found by: peter Reviewed by: ps MFC after: 3 days --- sys/kern/kern_event.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 8c98538c2901..59a00ee07ef0 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1104,6 +1104,7 @@ kqueue_scan(struct kqueue *kq, int maxevents, struct kevent *ulistp, if (timeout < 0) { error = EWOULDBLOCK; } else { + KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); kq->kq_state |= KQ_SLEEP; error = msleep(kq, &kq->kq_lock, PSOCK | PCATCH, "kqread", timeout); @@ -1125,6 +1126,7 @@ kqueue_scan(struct kqueue *kq, int maxevents, struct kevent *ulistp, if ((kn->kn_status == KN_MARKER && kn != marker) || (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); kq->kq_state |= KQ_FLUXWAIT; error = msleep(kq, &kq->kq_lock, PSOCK, "kqflxwt", 0);