diff options
author | ambrisko <ambrisko@FreeBSD.org> | 2012-01-30 19:19:22 +0000 |
---|---|---|
committer | ambrisko <ambrisko@FreeBSD.org> | 2012-01-30 19:19:22 +0000 |
commit | 2e6fa9691565d92c5697a2483896442a8a9bdbab (patch) | |
tree | d9f1df801cd0f66ad99342e409281ccbad579487 /sys/kern/vfs_aio.c | |
parent | 085df9f8ba3fa9b410fa1d700c6657993c9aca9f (diff) | |
download | FreeBSD-src-2e6fa9691565d92c5697a2483896442a8a9bdbab.zip FreeBSD-src-2e6fa9691565d92c5697a2483896442a8a9bdbab.tar.gz |
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
Diffstat (limited to 'sys/kern/vfs_aio.c')
-rw-r--r-- | sys/kern/vfs_aio.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index a28b2fa..2d9994f 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -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 */ |