On Wed, 2008-10-01 at 13:06 -0400, Peter Memishian wrote:
> > > You've deadlocked.  The problem is that ip_join_allmulti() has bumped the
>  > > refcount on the ill and is waiting to enter the IPSQ, while the current
>  > > thread inside the IPSQ is waiting for the ill refcounts to drop
>  > > (ipsq_waitfor is 2 AKA ILL_DOWN).  This is exactly the sort of problem I
>  > > was worried about when I warned about using ipsq_enter() a few weeks 
> back.
>  > > You should use ipsq_try_enter(), which will enqueue the request if it
>  > > cannot immediately complete.
>  > 
>  > This is a major bummer, as the caller of ip_join_allmulti() doesn't have
>  > a STREAMS queue to pass in so that ipsq_try_enter() can work.  It's kind
>  > of silly that the ipsq itself doesn't simply have some utility STREAMS
>  > queue that it can use for this purpose...
> 
> :-(  Another approach would be to acquire a soft reference using
> ill_waiter_inc(), drop the ill reference, and then do an ipsq_enter().
> Note that ipsq_enter() can fail in that case if you race with a teardown
> (ILL_CONDEMNED will be set), in which case you'll want to give up.

That sounds much more feasible.  I was also thinking that I might be
able to use the ill's read queue, which is done when processing STREAMS
messages on the read-side that require exclusive access (calls to
qwriter_ip() for example).

But the ill_waiter_inc() idea sounds much more simple...

-Seb



Reply via email to