svn commit: r197930 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Sat Oct 10 14:56:35 UTC 2009


Author: kib
Date: Sat Oct 10 14:56:34 2009
New Revision: 197930
URL: http://svn.freebsd.org/changeset/base/197930

Log:
  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

Modified:
  head/sys/kern/kern_event.c

Modified: head/sys/kern/kern_event.c
==============================================================================
--- head/sys/kern/kern_event.c	Sat Oct 10 13:59:18 2009	(r197929)
+++ head/sys/kern/kern_event.c	Sat Oct 10 14:56:34 2009	(r197930)
@@ -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;
 	}
 


More information about the svn-src-head mailing list