aboutsummaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorChristian S.J. Peron <csjp@FreeBSD.org>2006-07-03 20:02:06 +0000
committerChristian S.J. Peron <csjp@FreeBSD.org>2006-07-03 20:02:06 +0000
commit4b19419ee741c3ef44d64d23572af858c87cf1f6 (patch)
treed0c3c868fa34067b3708618c4418b16cb5427083 /sys/net
parent814fe9e98ea5d20b99741dd46456e75d134dc017 (diff)
downloadsrc-4b19419ee741c3ef44d64d23572af858c87cf1f6.tar.gz
src-4b19419ee741c3ef44d64d23572af858c87cf1f6.zip
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
Notes
Notes: svn path=/head/; revision=160087
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index d50a72d675df..4d8f93f36c89 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