Hello,
This diff looks good to me. Though I still have some
doubts about accuracy of comment here:
</snip>
> return (kn->kn_data > 0);
> @@ -1510,6 +1599,15 @@ bpf_catchpacket(struct bpf_d *d, u_char
> ++d->bd_dcount;
> return;
> }
> +
> + /*
> + * there's a small chance bpf_wait_cb is running
> + * concurrently with this and two wakeups will be
> + * generated.
> + */
> + if (timeout_del(&d->bd_wait_tmo))
> + bpf_put(d);
> +
> ROTATE_BUFFERS(d);
> do_wakeup = 1;
> curlen = 0;
> @@ -1530,12 +1628,27 @@ bpf_catchpacket(struct bpf_d *d, u_char
I'm still failing to spot the race the comment is talking
about. code in bpf_wait_cb() grabs `d->bd_mtx` mutex, the
same mutex which is held by bpf_catchpacket() caller.
However my doubts about comment should not prevent you
committing code which solves the issue and looks good.
OK sashan