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.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to