RE: [PATCH] usb: storage: stop all current urbs when device is disconnected

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

 



On Fri, 3 Aug 2012, B, Ravi wrote:

> Alan, I did not understand, if the driver has unbound from the
> device, what is the need to wait for 30seconds timeout to cancel the
> URB.
> Can you explain in detail.

Consider a disk drive with a large cache.  When usb-storage unbinds
from the device, the SCSI layer will want to tell the disk to write out
its cache.  Flushing the cache could take a while, so the SYNCHRONIZE
CACHE command needs to have a long timeout.  Otherwise the contents of 
the cache could get lost.

> > > Why scsi to wait for 30 seconds timeout upon receiving the DEVICE 
> > > DICONNECT Notfication ?
> > 
> > That's the timeout for all the SCSI commands.  The timeout 
> > doesn't change when the disconnect notification is received.
> 
> During disconnect, it is better to cancel all queued and active
> current URB, why to wait for 30sec timeout.

It's not better.  See above for an example where you _want_ to wait for 
the command to finish.

Now, if the device really has been unplugged then you can't tell it to 
flush its cache.  In that situation you really do want to avoid the 
30-second timeout.  But neither usb-storage nor the SCSI layer knows 
whether the device has been unplugged.

However the host controller driver _does_ know (or at least, it 
_should_ know).  It should guarantee that all URBs fail quickly when 
the device is not plugged in.  It should not wait forever for a DMA 
transfer that will never complete.

That's why I suggested you fix the musb driver instead of trying to 
change usb-storage.

Alan Stern

--
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