On Tue, 18 Mar 2014, Andreas Reis wrote:

> [9732.160783] usb-storage 2-1:1.0: Abort srbs: ffff8804255c1980 
> ffff8804255c1980
> [9732.160791] usb-storage 2-1:1.0: Calling stop_transport
> [9732.160836] usb-storage 2-1:1.0: Starting port reset
> [9732.267771] usb 2-1: reset SuperSpeed USB device number 4 using xhci_hcd
> [9732.281100] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with 
> disabled ep ffff880392201b00
> [9732.281108] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with 
> disabled ep ffff880392201b40
> [9732.281736] usb-storage 2-1:1.0: Reset completed: 0
> [9732.281782] usb-storage 2-1:1.0: Abort completed
> [9756.464027] usb 2-2: USB disconnect, device number 2
> [9756.465225] sd 7:0:0:0: [sde] Synchronizing SCSI cache
> [9756.465356] sd 7:0:0:0: [sde]
> [9756.465364] Result: hostbyte=0x01 driverbyte=0x00
> [9763.119860 x100] usb-storage: Error in queuecommand_lck: us->srb = 
> ffff8804255c1980

The debugging information didn't go far enough.  Try the patch below 
instead, which has some additional messages.

There are two apparently separate problems here.  First, why was the
reset necessary?  As far as I can tell, the only explanation seems to
be a failure of Link Power Management.

Second, why the errors in queuecommand_lck?  I suspect the answer to 
that lies somewhere in the SCSI subystem, not USB.  The new debugging 
patch should tell us for sure.

Alan Stern



Index: usb-3.14/drivers/usb/storage/transport.c
===================================================================
--- usb-3.14.orig/drivers/usb/storage/transport.c
+++ usb-3.14/drivers/usb/storage/transport.c
@@ -63,6 +63,8 @@
 #include <linux/blkdev.h>
 #include "../../scsi/sd.h"
 
+extern int alantest;
+
 
 /***********************************************************************
  * Data transfer routines
@@ -1324,6 +1326,8 @@ int usb_stor_port_reset(struct us_data *
 {
        int result;
 
+       dev_info(&us->pusb_intf->dev, "Starting port reset\n");
+
        /*for these devices we must use the class specific method */
        if (us->pusb_dev->quirks & USB_QUIRK_RESET)
                return -EPERM;
@@ -1344,5 +1348,7 @@ int usb_stor_port_reset(struct us_data *
                }
                usb_unlock_device(us->pusb_dev);
        }
+       dev_info(&us->pusb_intf->dev, "Reset completed: %d\n", result);
+       alantest = 1;
        return result;
 }
Index: usb-3.14/drivers/usb/storage/scsiglue.c
===================================================================
--- usb-3.14.orig/drivers/usb/storage/scsiglue.c
+++ usb-3.14/drivers/usb/storage/scsiglue.c
@@ -58,6 +58,8 @@
 #include "transport.h"
 #include "protocol.h"
 
+extern int alantest;
+
 /* Vendor IDs for companies that seem to include the READ CAPACITY bug
  * in all their devices
  */
@@ -322,6 +324,10 @@ static int queuecommand_lck(struct scsi_
 {
        struct us_data *us = host_to_us(srb->device->host);
 
+       if (alantest)
+               dev_info(&us->pusb_intf->dev, "queuecommand srbs: %p %p\n",
+                               srb, us->srb);
+
        /* check for state-transition errors */
        if (us->srb != NULL) {
                printk(KERN_ERR USB_STORAGE "Error in %s: us->srb = %p\n",
@@ -333,6 +339,8 @@ static int queuecommand_lck(struct scsi_
        if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) {
                usb_stor_dbg(us, "Fail command during disconnect\n");
                srb->result = DID_NO_CONNECT << 16;
+               dev_info(&us->pusb_intf->dev, "fail after disconnect %p\n",
+                               srb);
                done(srb);
                return 0;
        }
@@ -357,6 +365,7 @@ static int command_abort(struct scsi_cmn
        struct us_data *us = host_to_us(srb->device->host);
 
        usb_stor_dbg(us, "%s called\n", __func__);
+       dev_info(&us->pusb_intf->dev, "Abort srbs: %p %p\n", srb, us->srb);
 
        /* us->srb together with the TIMED_OUT, RESETTING, and ABORTING
         * bits are protected by the host lock. */
@@ -377,12 +386,15 @@ static int command_abort(struct scsi_cmn
        set_bit(US_FLIDX_TIMED_OUT, &us->dflags);
        if (!test_bit(US_FLIDX_RESETTING, &us->dflags)) {
                set_bit(US_FLIDX_ABORTING, &us->dflags);
+               dev_info(&us->pusb_intf->dev, "Calling stop_transport\n");
                usb_stor_stop_transport(us);
        }
        scsi_unlock(us_to_host(us));
 
        /* Wait for the aborted command to finish */
        wait_for_completion(&us->notify);
+       dev_info(&us->pusb_intf->dev, "Abort completed\n");
+       alantest = 1;
        return SUCCESS;
 }
 
Index: usb-3.14/drivers/usb/storage/usb.c
===================================================================
--- usb-3.14.orig/drivers/usb/storage/usb.c
+++ usb-3.14/drivers/usb/storage/usb.c
@@ -72,6 +72,8 @@
 #include "sierra_ms.h"
 #include "option_ms.h"
 
+int alantest;
+
 /* Some informational data */
 MODULE_AUTHOR("Matthew Dharm <mdharm-...@one-eyed-alien.net>");
 MODULE_DESCRIPTION("USB Mass Storage driver for Linux");
@@ -381,6 +383,10 @@ static int usb_stor_control_thread(void
                if (us->srb->result != DID_ABORT << 16) {
                        usb_stor_dbg(us, "scsi cmd done, result=0x%x\n",
                                     us->srb->result);
+                       if (alantest)
+                               dev_info(&us->pusb_intf->dev,
+                                               "calling scsi_done %p\n",
+                                               us->srb);
                        us->srb->scsi_done(us->srb);
                } else {
 SkipForAbort:
@@ -401,6 +407,9 @@ SkipForAbort:
                }
 
                /* finished working on this command */
+               if (alantest)
+                       dev_info(&us->pusb_intf->dev, "cmd finished %p\n",
+                                       us->srb);
                us->srb = NULL;
                scsi_unlock(host);
 

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

Reply via email to