[linux-dvb] down_interruptible usage

Kenneth Aafløy kenneth at linuxtv.org
Sat Aug 6 22:36:50 CEST 2005

lørdag 06 august 2005, 21:08, skrev Johannes Stezenbach:
> Kenneth Aafløy wrote:
> > I've been searching for the reason why I was _loosing_ filters
> > in the demuxer, and I've found out the subtle reason.
> >
> > In dmxdev.c, the dvb_dmxdev_release is calling dvb_dmxdev_filter_free.
> > This function uses down_interruptible to wait for two mutexes, but
> > if those are interrupted by a signal, the filter will be _lost_.
> > This is easily reproducible with a program that creates a few threads,
> > which open and close the filters regulary, and then running/interrupting
> > this program some number of times.
> >
> > Is changing all down_interruptible (that protects freeing a structure)
> > to down(), or will this have other unseen side-effects?
> Generally speaking, a driver should only sleep uninterruptibly
> if you can make absolutely sure it won't sleep forever, even
> in an obscure error case. If you can guarantee that from
> reading the code, then it's best to change the down() to
> down_interruptible(), otherwise it's better to handle the
> error from down_interruptible() correctly.
> (If a process is stuck in uninterruptible sleep you usually
> have to reboot to get rid of it, which is bad.)

Ok, but do you think it is better interrupt freeing a resource
that can't be reclaimed later, or _maybe_ break some other part
because of deadlocks?


More information about the linux-dvb mailing list