Re: [PATCH 3/3] USB: cdc-wdm: timeout blocking reads to allow driver to shutdown on device removal

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

 



Oliver Neukum <oliver@xxxxxxxxxx> writes:
> Am Montag, 16. Januar 2012, 12:41:49 schrieb Bjørn Mork:
>> Setting the WDM_READ bit in wdm_disconnect() is useless, as wdm_disconnect()
>> won't be called at all as long as wdm_read() is blocking waiting for this bit.
>
> Yes, and this shows that wdm_read() must be woken at this point.

>> Use wait_event_interruptible_timeout for blocking reads to allow the USB
>> subsystem to call wdm_disconnect, and thereby allow a blocking read to
>> complete on device removal.
>
> No, playing around with timeout is evil.
> This shows that there's a wake_up_all() missing in disconnect()
> between setting the flags and taking the mutex.

right you are.  There is a wake_up_all() after taking the mutex, but
that seems pointless as noone should be waiting for anything if we
can get the mutex with the WDM_DISCONNECTING set.

I'll send a new version as soon as I've tested that it works.


Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux