diff options
author | jmg <jmg@FreeBSD.org> | 2004-08-15 06:24:42 +0000 |
---|---|---|
committer | jmg <jmg@FreeBSD.org> | 2004-08-15 06:24:42 +0000 |
commit | bc1805c6e871c178d0b6516c3baa774ffd77224a (patch) | |
tree | 1172b68a7c9e7fa73090ae134eb98825bdab8ad6 /sys/gnu/ext2fs | |
parent | 57da12d01618c3ef2590eab07e71f69d16ead13a (diff) | |
download | FreeBSD-src-bc1805c6e871c178d0b6516c3baa774ffd77224a.zip FreeBSD-src-bc1805c6e871c178d0b6516c3baa774ffd77224a.tar.gz |
Add locking to the kqueue subsystem. This also makes the kqueue subsystem
a more complete subsystem, and removes the knowlege of how things are
implemented from the drivers. Include locking around filter ops, so a
module like aio will know when not to be unloaded if there are outstanding
knotes using it's filter ops.
Currently, it uses the MTX_DUPOK even though it is not always safe to
aquire duplicate locks. Witness currently doesn't support the ability
to discover if a dup lock is ok (in some cases).
Reviewed by: green, rwatson (both earlier versions)
Diffstat (limited to 'sys/gnu/ext2fs')
-rw-r--r-- | sys/gnu/ext2fs/ext2_vnops.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c index 3964632..cf04778 100644 --- a/sys/gnu/ext2fs/ext2_vnops.c +++ b/sys/gnu/ext2fs/ext2_vnops.c @@ -570,7 +570,7 @@ ext2_setattr(ap) return (EROFS); error = ext2_chmod(vp, (int)vap->va_mode, cred, td); } - VN_KNOTE(vp, NOTE_ATTRIB); + VN_KNOTE_UNLOCKED(vp, NOTE_ATTRIB); return (error); } @@ -1894,9 +1894,9 @@ ext2_kqfilter(ap) if (vp->v_pollinfo == NULL) v_addpollinfo(vp); - mtx_lock(&vp->v_pollinfo->vpi_lock); - SLIST_INSERT_HEAD(&vp->v_pollinfo->vpi_selinfo.si_note, kn, kn_selnext); - mtx_unlock(&vp->v_pollinfo->vpi_lock); + if (vp->v_pollinfo == NULL) + return ENOMEM; + knlist_add(&vp->v_pollinfo->vpi_selinfo.si_note, kn, 0); return (0); } @@ -1907,10 +1907,7 @@ filt_ext2detach(struct knote *kn) struct vnode *vp = (struct vnode *)kn->kn_hook; KASSERT(vp->v_pollinfo != NULL, ("Mising v_pollinfo")); - mtx_lock(&vp->v_pollinfo->vpi_lock); - SLIST_REMOVE(&vp->v_pollinfo->vpi_selinfo.si_note, - kn, knote, kn_selnext); - mtx_unlock(&vp->v_pollinfo->vpi_lock); + knlist_remove(&vp->v_pollinfo->vpi_selinfo.si_note, kn, 0); } /*ARGSUSED*/ |