aboutsummaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2009-06-10 20:59:32 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2009-06-10 20:59:32 +0000
commitd8b0556c6dcaf4c506039f86af2b52b29524f89e (patch)
tree9c12d3a92805f512ad054e2b8fa5618e0bd9cc71 /sys/net
parent5591364265207deced4976e9d4394c403a278fe9 (diff)
downloadsrc-d8b0556c6dcaf4c506039f86af2b52b29524f89e.tar.gz
src-d8b0556c6dcaf4c506039f86af2b52b29524f89e.zip
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
Notes
Notes: svn path=/head/; revision=193951
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.c2
-rw-r--r--sys/net/if.c4
-rw-r--r--sys/net/if_tap.c2
-rw-r--r--sys/net/if_tun.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index c74d09fbf305..6c95fc65c138 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -648,7 +648,7 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td)
#endif
mtx_init(&d->bd_mtx, devtoname(dev), "bpf cdev lock", MTX_DEF);
callout_init(&d->bd_callout, CALLOUT_MPSAFE);
- knlist_init(&d->bd_sel.si_note, &d->bd_mtx, NULL, NULL, NULL);
+ knlist_init_mtx(&d->bd_sel.si_note, &d->bd_mtx);
return (0);
}
diff --git a/sys/net/if.c b/sys/net/if.c
index ba4cb1a8c19b..c95de07b5bb9 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -445,7 +445,7 @@ vnet_net_iattach(const void *unused __unused)
TAILQ_INIT(&V_ifnet);
TAILQ_INIT(&V_ifg_head);
- knlist_init(&V_ifklist, NULL, NULL, NULL, NULL);
+ knlist_init_mtx(&V_ifklist, NULL);
if_grow(); /* create initial table */
return (0);
@@ -548,7 +548,7 @@ if_alloc(u_char type)
TAILQ_INIT(&ifp->if_prefixhead);
TAILQ_INIT(&ifp->if_multiaddrs);
TAILQ_INIT(&ifp->if_groups);
- knlist_init(&ifp->if_klist, NULL, NULL, NULL, NULL);
+ knlist_init_mtx(&ifp->if_klist, NULL);
#ifdef MAC
mac_ifnet_init(ifp);
#endif
diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c
index 92563012c28d..6668d943f31b 100644
--- a/sys/net/if_tap.c
+++ b/sys/net/if_tap.c
@@ -462,7 +462,7 @@ tapcreate(struct cdev *dev)
tp->tap_flags |= TAP_INITED;
mtx_unlock(&tp->tap_mtx);
- knlist_init(&tp->tap_rsel.si_note, NULL, NULL, NULL, NULL);
+ knlist_init_mtx(&tp->tap_rsel.si_note, NULL);
TAPDEBUG("interface %s is created. minor = %#x\n",
ifp->if_xname, dev2unit(dev));
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 6b352e855c6e..03dd4ab8d883 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -391,7 +391,7 @@ tuncreate(const char *name, struct cdev *dev)
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
ifp->if_snd.ifq_drv_maxlen = 0;
IFQ_SET_READY(&ifp->if_snd);
- knlist_init(&sc->tun_rsel.si_note, NULL, NULL, NULL, NULL);
+ knlist_init_mtx(&sc->tun_rsel.si_note, NULL);
if_attach(ifp);
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));