Lawrence Stewart <[EMAIL PROTECTED]> writes:
> After further investigation, it turns out that the pfil input hook I'm
> using, which catches packets as they traverse up the network stack,
> has no problems, and will happily write to the file using the
> kio_write function. However, in the pfil output hook, a call to
> kio_write causes a hard reset, with the following text shown on tty0:
>
> Sleeping thread (tid 100069, pid 613) owns a non-sleepable lock
> panic: sleeping thread

This is a panic, not a hard reset.

Since you are writing kernel code, I assume you have KDB/DDB in your
kernel and know how to use it.

> If I comment out the kio_write code and put a printf instead, there
> are no such problems, so it seems the kio_write function is doing
> something that is upsetting the kernel, but only when called from a
> function that is acting as a pfil output hook? Strikes me as odd
> behaviour. I don't understand which thread the error is in relation
> to, why that thread is sleeping or which lock it is referring to.

kio_write probably blocks waiting for the write to complete.  You can't
do that while holding a non-sleepable lock.

> I tried wrapping the call to kio_write in a mutex, in case there was a
> race condition caused by multiple threads trying to write to the file
> at the one time, but that hasn't made a difference at all.

It complains about sleeping with a non-sleepable lock held, and your
solution is to add another non-sleepable lock?

DES
-- 
Dag-Erling Smørgrav - [EMAIL PROTECTED]
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to