Re: [PATCH 3/3] media: check status of dmxdev->exit in poll functions of demux&dvr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Tue, 02 Sep 2014 02:58:50 +0300
Antti Palosaari <crope@xxxxxx> escreveu:

> Moikka Changbing and thanks to working that.
> 
> I reviewed the first patch and tested all these patches. It does not 
> deadlock USB device anymore because of patch #1 so it is improvement. 
> However, what I expect that patch, it should force device unregister but 
> when I use tzap and unplug running device, it does not stop tzap, but 
> continues zapping until app is killed using ctrl-c.
> I used same(?) WinTV Aero for my tests.

...

> Is there any change to close all those /dev file handles when device 
> disappears?

Well, we may start returning -ENODEV when such event happens. 

At the frontend, we could use fe->exit = DVB_FE_DEVICE_REMOVED to
signalize it. I don't think that the demod frontend has something
similar.

Yet, it should be up to the userspace application to properly handle 
the error codes and close the devices on fatal non-recovery errors like
ENODEV. 

So, what we can do, at Kernel level, is to always return -ENODEV when
the device is known to be removed, and double check libdvbv5 if it
handles such error properly.

Regards,
Mauro

> 
> regards
> Antti
> 
> 
> On 08/21/2014 05:05 AM, Changbing Xiong wrote:
> > when usb-type tuner is pulled out, user applications did not close device's FD,
> > and go on polling the device, we should return POLLERR directly.
> >
> > Signed-off-by: Changbing Xiong <cb.xiong@xxxxxxxxxxx>
> > ---
> >   drivers/media/dvb-core/dmxdev.c |    6 +++++-
> >   1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
> > index 7a5c070..42b5e70 100755
> > --- a/drivers/media/dvb-core/dmxdev.c
> > +++ b/drivers/media/dvb-core/dmxdev.c
> > @@ -1085,9 +1085,10 @@ static long dvb_demux_ioctl(struct file *file, unsigned int cmd,
> >   static unsigned int dvb_demux_poll(struct file *file, poll_table *wait)
> >   {
> >   	struct dmxdev_filter *dmxdevfilter = file->private_data;
> > +	struct dmxdev *dmxdev = dmxdevfilter->dev;
> >   	unsigned int mask = 0;
> >
> > -	if (!dmxdevfilter)
> > +	if ((!dmxdevfilter) || (dmxdev->exit))
> >   		return POLLERR;
> >
> >   	poll_wait(file, &dmxdevfilter->buffer.queue, wait);
> > @@ -1181,6 +1182,9 @@ static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait)
> >
> >   	dprintk("function : %s\n", __func__);
> >
> > +	if (dmxdev->exit)
> > +		return POLLERR;
> > +
> >   	poll_wait(file, &dmxdev->dvr_buffer.queue, wait);
> >
> >   	if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
> > --
> > 1.7.9.5
> >
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux