From 47d81c1b70389d74d905484a28550a29d97529a7 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 10 Oct 2009 14:56:34 +0000 Subject: Postpone dropping fp till both kq_global and kqueue mutexes are unlocked. fdrop() closes file descriptor when reference count goes to zero. Close method for vnodes locks the vnode, resulting in "sleepable after non-sleepable". For pipes, pipe mutex is before kqueue lock, causing LOR. Reported and tested by: pho MFC after: 2 weeks --- sys/kern/kern_event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/kern/kern_event.c') diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 478432e20727..7c405945cdc0 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1025,13 +1025,13 @@ findkn: /* knote is in the process of changing, wait for it to stablize. */ if (kn != NULL && (kn->kn_status & KN_INFLUX) == KN_INFLUX) { + KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); + kq->kq_state |= KQ_FLUXWAIT; + msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqflxwt", 0); if (fp != NULL) { fdrop(fp, td); fp = NULL; } - KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); - kq->kq_state |= KQ_FLUXWAIT; - msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqflxwt", 0); goto findkn; } -- cgit v1.2.3