David:
This patch fixes the bug you ran across in the scatter-gather library.
(It includes my earlier change to suppress incorrect error messages as
well).
The problem turned out to be the way io->count was handled. I'm assuming
that field was meant to be a count of outstanding URBs. If it wasn't...
well, it is now. It was initialized before the URBs were submitted and
the code tried to adjust for that when a submission failed, but it failed
to adjust when submissions didn't take place for any other reason. As a
result the struct completion was never signalled, causing a hang.
The patch increments io->count every time a submission succeeds, so no
adjustments are needed. This fixes the bug (as determined by inserting an
msleep() call after usb_submit_urb() to force the race to occur).
Take a look and send it on to Greg if it's okay.
Alan Stern
Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
===== drivers/usb/core/message.c 1.92 vs edited =====
--- 1.92/drivers/usb/core/message.c Fri Jun 11 07:49:33 2004
+++ edited/drivers/usb/core/message.c Tue Jun 15 16:54:00 2004
@@ -248,7 +248,7 @@
* unlink pending urbs so they won't rx/tx bad data.
*/
for (i = 0, found = 0; i < io->entries; i++) {
- if (!io->urbs [i])
+ if (!io->urbs [i] || !io->urbs [i]->dev)
continue;
if (found) {
status = usb_unlink_urb (io->urbs [i]);
@@ -347,7 +347,7 @@
if (usb_pipein (pipe))
urb_flags |= URB_SHORT_NOT_OK;
- for (i = 0; i < io->entries; i++, io->count = i) {
+ for (i = 0; i < io->entries; i++) {
unsigned len;
io->urbs [i] = usb_alloc_urb (0, mem_flags);
@@ -449,6 +449,8 @@
io->urbs [i]->dev = io->dev;
retval = usb_submit_urb (io->urbs [i], SLAB_ATOMIC);
+ if (retval == 0)
+ ++io->count;
/* after we submit, let completions or cancelations fire;
* we handshake using io->status.
@@ -478,7 +480,6 @@
/* fail any uncompleted urbs */
default:
spin_lock_irq (&io->lock);
- io->count -= entries - i;
if (io->status == -EINPROGRESS)
io->status = retval;
if (io->count == 0)
-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel