svn commit: r230778 - head/sys/kern

Doug Ambrisko ambrisko at FreeBSD.org
Mon Jan 30 19:19:23 UTC 2012


Author: ambrisko
Date: Mon Jan 30 19:19:22 2012
New Revision: 230778
URL: http://svn.freebsd.org/changeset/base/230778

Log:
  When detaching an AIO or LIO requests grab the lock and tell knlist_remove
  that we have the lock now.  This cleans up a locking panic ASSERT when
  knlist_empty is called without a lock when INVARIANTS etc. are turned.
  
  Reviewed by:	kib jhb
  MFC after:	1 week

Modified:
  head/sys/kern/vfs_aio.c

Modified: head/sys/kern/vfs_aio.c
==============================================================================
--- head/sys/kern/vfs_aio.c	Mon Jan 30 18:28:56 2012	(r230777)
+++ head/sys/kern/vfs_aio.c	Mon Jan 30 19:19:22 2012	(r230778)
@@ -2535,10 +2535,13 @@ filt_aioattach(struct knote *kn)
 static void
 filt_aiodetach(struct knote *kn)
 {
-	struct aiocblist *aiocbe = kn->kn_ptr.p_aio;
+	struct knlist *knl;
 
-	if (!knlist_empty(&aiocbe->klist))
-		knlist_remove(&aiocbe->klist, kn, 0);
+	knl = &kn->kn_ptr.p_aio->klist;
+	knl->kl_lock(knl->kl_lockarg);
+	if (!knlist_empty(knl))
+		knlist_remove(knl, kn, 1);
+	knl->kl_unlock(knl->kl_lockarg);
 }
 
 /* kqueue filter function */
@@ -2580,10 +2583,13 @@ filt_lioattach(struct knote *kn)
 static void
 filt_liodetach(struct knote *kn)
 {
-	struct aioliojob * lj = kn->kn_ptr.p_lio;
+	struct knlist *knl;
 
-	if (!knlist_empty(&lj->klist))
-		knlist_remove(&lj->klist, kn, 0);
+	knl = &kn->kn_ptr.p_lio->klist;
+	knl->kl_lock(knl->kl_lockarg);
+	if (!knlist_empty(knl))
+		knlist_remove(knl, kn, 1);
+	knl->kl_unlock(knl->kl_lockarg);
 }
 
 /* kqueue filter function */


More information about the svn-src-all mailing list