Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Apr 2012 19:16:00 +0000 (UTC)
From:      Doug Ambrisko <ambrisko@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r234438 - stable/9/sys/kern
Message-ID:  <201204181916.q3IJG0lV046882@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ambrisko
Date: Wed Apr 18 19:15:59 2012
New Revision: 234438
URL: http://svn.freebsd.org/changeset/base/234438

Log:
  MFC r230778
  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.

Modified:
  stable/9/sys/kern/vfs_aio.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/vfs_aio.c
==============================================================================
--- stable/9/sys/kern/vfs_aio.c	Wed Apr 18 19:11:21 2012	(r234437)
+++ stable/9/sys/kern/vfs_aio.c	Wed Apr 18 19:15:59 2012	(r234438)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204181916.q3IJG0lV046882>