panic upon kldunload snd_ich (lor # 159)

Pyun YongHyeon pyunyh at
Wed Sep 14 21:34:16 PDT 2005

On Thu, Sep 15, 2005 at 11:46:53AM +0800, Ariff Abdullah wrote:
 > On Thu, 15 Sep 2005 10:45:09 +0900
 > Pyun YongHyeon <pyunyh at> wrote:
 > > 
 > > That would be supposed to fix the LOR message. But I'd like to keep
 > > lock ordering between snd_mutex and sndstat_lock. Since sndstat_read()
 > > could be called at any time there is an implicit lock order.
 > > I think switching to sx lock from mutex in sndstat code was to allow
 > > uiomove with lock held. IMO, it would be even better to rewrite
 > > sndstat_read() without using uiomove such that it can also use
 > > standard mutex rather than sx lock.
 > > 
 > I tend to agree with you. Since that sndstat_busy() isn't enough, how
 > about we acquire the entire sndstat so nobody can monkey with it (as the
 > proposed / attached diff) and at the same time avoiding this LOR
 > message. It seems much better rather than locking sndstat after
 > sndstat_busy() and much of pcm_unregister() procedures, only to find out
 > that somebody acquire it within that moment.

I didn't try the patch but it looks good to me. :-)
If you have more time would you please fix race in sndstat_open()?

Minor note : I think it is better to use sx_xunlock ranther than
sx_unlock as sx_xunlock clearly indicates which type of locks held.
Pyun YongHyeon

More information about the freebsd-current mailing list