If SCSI commands are submitted while other commands are still processed, the dispatch loop turns, and we stop the work_timer. Then, if URB fails to complete, ub hangs until the device is unplugged.
This does not happen often, becase we only allow one SCSI command per block device, but does happen (on multi-LUN devices, for example). The fix is to stop timer only when we actually going to change the state. The nicest code would be to have the timer stopped in URB callback, but this is impossible, because it can be called from inside a timer, through the urb_unlink. Then we get BUG in timer.c:cascade(). So, we do it a little dirtier. Signed-off-by: Pete Zaitcev <[EMAIL PROTECTED]> --- This is not exactly what DaveJ tested for me, but I found a test case locally, so let's do this instead. This must go on top of "CFQ Oops" fix, or it rejects because of pervasive changes to sc->lock. --- linux-2.6.15-gregkh-bis/drivers/block/ub.c 2006-01-04 23:59:38.000000000 -0800 +++ linux-2.6.15-rc7-lem/drivers/block/ub.c 2006-01-02 19:28:40.000000000 -0800 @@ -1106,7 +1105,8 @@ static void ub_urb_timeout(unsigned long unsigned long flags; spin_lock_irqsave(sc->lock, flags); - usb_unlink_urb(&sc->work_urb); + if (!ub_is_completed(&sc->work_done)) + usb_unlink_urb(&sc->work_urb); spin_unlock_irqrestore(sc->lock, flags); } @@ -1131,7 +1131,6 @@ static void ub_scsi_action(unsigned long unsigned long flags; spin_lock_irqsave(sc->lock, flags); - del_timer(&sc->work_timer); ub_scsi_dispatch(sc); spin_unlock_irqrestore(sc->lock, flags); } @@ -1155,6 +1154,7 @@ static void ub_scsi_dispatch(struct ub_d } else { if (!ub_is_completed(&sc->work_done)) break; + del_timer(&sc->work_timer); ub_scsi_urb_compl(sc, cmd); } } ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel