diff options
author | kib <kib@FreeBSD.org> | 2009-06-10 20:59:32 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2009-06-10 20:59:32 +0000 |
commit | e1cb2941d4424de90eb68716d6c4d95f4c0af0ba (patch) | |
tree | 9c12d3a92805f512ad054e2b8fa5618e0bd9cc71 /sys/sys/event.h | |
parent | a9806592196870f6605860715c0edac4deb6a55d (diff) | |
download | FreeBSD-src-e1cb2941d4424de90eb68716d6c4d95f4c0af0ba.zip FreeBSD-src-e1cb2941d4424de90eb68716d6c4d95f4c0af0ba.tar.gz |
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
Diffstat (limited to 'sys/sys/event.h')
-rw-r--r-- | sys/sys/event.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/sys/event.h b/sys/sys/event.h index 37b0a77..824f084 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -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 knlist *knl, struct knote *kn); 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); |