diff options
author | csjp <csjp@FreeBSD.org> | 2006-07-03 20:02:06 +0000 |
---|---|---|
committer | csjp <csjp@FreeBSD.org> | 2006-07-03 20:02:06 +0000 |
commit | 55246068270ab478aad9b7a2cd946354e3861034 (patch) | |
tree | d0c3c868fa34067b3708618c4418b16cb5427083 /sys | |
parent | 981c1cc4c81e29d3d6d4d5e2969b5cb584e427e9 (diff) | |
download | FreeBSD-src-55246068270ab478aad9b7a2cd946354e3861034.zip FreeBSD-src-55246068270ab478aad9b7a2cd946354e3861034.tar.gz |
Adjust descriptor locking to tell the kqueue subsystem that our descriptor is
already locked. The reason to do this is to avoid two lock+unlock operations
in a row. We need the lock here to serialize access to bd_pid for stats
collection purposes.
Drop the locks all together on detach, as they will be picked up by
knlist_remove.
This should fix a failed locking assertion when kqueue is being used with bpf
descriptors.
Discussed with: jmg
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/bpf.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index d50a72d..4d8f93f 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1152,7 +1152,7 @@ bpfkqfilter(struct cdev *dev, struct knote *kn) d->bd_pid = curthread->td_proc->p_pid; kn->kn_fop = &bpfread_filtops; kn->kn_hook = d; - knlist_add(&d->bd_sel.si_note, kn, 0); + knlist_add(&d->bd_sel.si_note, kn, 1); BPFD_UNLOCK(d); return (0); @@ -1163,9 +1163,7 @@ filt_bpfdetach(struct knote *kn) { struct bpf_d *d = (struct bpf_d *)kn->kn_hook; - BPFD_LOCK(d); knlist_remove(&d->bd_sel.si_note, kn, 0); - BPFD_UNLOCK(d); } static int |