Date: Wed, 10 Jun 2009 21:42:19 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: Konstantin Belousov <kib@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r193951 - in head/sys: cam/scsi i386/acpica kern net security/audit sys Message-ID: <20090610214134.R22887@maildrop.int.zabbadoz.net> In-Reply-To: <200906102059.n5AKxXx0025758@svn.freebsd.org> References: <200906102059.n5AKxXx0025758@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 10 Jun 2009, Konstantin Belousov wrote: > Author: kib > Date: Wed Jun 10 20:59:32 2009 > New Revision: 193951 > URL: http://svn.freebsd.org/changeset/base/193951 > > Log: > Adapt vfs kqfilter to the shared vnode lock used by zfs write vop. Use > vnode interlock to protect the knote fields [1]. The locking assumes > that shared vnode lock is held, thus we get exclusive access to knote > either by exclusive vnode lock protection, or by shared vnode lock + > vnode interlock. > > Do not use kl_locked() method to assert either lock ownership or the > fact that curthread does not own the lock. For shared locks, ownership > is not recorded, e.g. VOP_ISLOCKED can return LK_SHARED for the shared > lock not owned by curthread, causing false positives in kqueue subsystem > assertions about knlist lock. > > Remove kl_locked method from knlist lock vector, and add two separate > assertion methods kl_assert_locked and kl_assert_unlocked, that are > supposed to use proper asserts. Change knlist_init accordingly. > > Add convenience function knlist_init_mtx to reduce number of arguments > for typical knlist initialization. > > Submitted by: jhb [1] > Noted by: jhb [2] > Reviewed by: jhb > Tested by: rnoland > > Modified: > head/sys/cam/scsi/scsi_target.c > head/sys/i386/acpica/acpi_machdep.c > head/sys/kern/init_main.c > head/sys/kern/kern_event.c > head/sys/kern/kern_fork.c > head/sys/kern/sys_pipe.c > head/sys/kern/tty.c > head/sys/kern/tty_pts.c > head/sys/kern/uipc_mqueue.c > head/sys/kern/uipc_socket.c > head/sys/kern/vfs_aio.c > head/sys/kern/vfs_subr.c > head/sys/net/bpf.c > head/sys/net/if.c > head/sys/net/if_tap.c > head/sys/net/if_tun.c > head/sys/security/audit/audit_pipe.c > head/sys/sys/event.h This change, changes the size of struct vnet; all (network) modules need to be recompiled. > Modified: head/sys/sys/event.h > ============================================================================== > --- head/sys/sys/event.h Wed Jun 10 20:57:06 2009 (r193950) > +++ head/sys/sys/event.h Wed Jun 10 20:59:32 2009 (r193951) > @@ -124,7 +124,8 @@ struct knlist { > struct klist kl_list; > void (*kl_lock)(void *); /* lock function */ > void (*kl_unlock)(void *); > - int (*kl_locked)(void *); > + void (*kl_assert_locked)(void *); > + void (*kl_assert_unlocked)(void *); > void *kl_lockarg; /* argument passed to kl_lockf() */ > }; > > @@ -203,6 +204,7 @@ struct kevent_copyops { > struct thread; > struct proc; > struct knlist; > +struct mtx; > > extern void knote(struct knlist *list, long hint, int islocked); > extern void knote_fork(struct knlist *list, int pid); > @@ -212,7 +214,8 @@ extern void knlist_remove_inevent(struct > extern int knlist_empty(struct knlist *knl); > extern void knlist_init(struct knlist *knl, void *lock, > void (*kl_lock)(void *), void (*kl_unlock)(void *), > - int (*kl_locked)(void *)); > + void (*kl_assert_locked)(void *), void (*kl_assert_unlocked)(void *)); > +extern void knlist_init_mtx(struct knlist *knl, struct mtx *lock); > extern void knlist_destroy(struct knlist *knl); > extern void knlist_cleardel(struct knlist *knl, struct thread *td, > int islocked, int killkn); > -- Bjoern A. Zeeb The greatest risk is not taking one.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090610214134.R22887>