On Wed, 18 Mar 2015, Alan Stern wrote:

> On Tue, 17 Mar 2015, Joe Lawrence wrote:
> 
> > On 03/11/2015 12:25 AM, Stanisław Pitucha wrote:
> > > Hi linux-scsi,
> > > I've got another case of reproducible crash when unplugging western
> > > digital passport drives. This was mentioned before in
> > > http://www.spinics.net/lists/linux-scsi/msg82603.html
> 
> Like it says in that thread, the problem is somehow related to the ses
> driver.  If you remove or blacklist that driver, there won't be any
> more crashes.

Looks like I spoke too soon.  I think the patch below will fix the 
problem.  Let me know what happens.

Alan Stern




Index: usb-4.0/drivers/scsi/scsi_pm.c
===================================================================
--- usb-4.0.orig/drivers/scsi/scsi_pm.c
+++ usb-4.0/drivers/scsi/scsi_pm.c
@@ -217,14 +217,18 @@ static int sdev_runtime_suspend(struct d
 {
        const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        struct scsi_device *sdev = to_scsi_device(dev);
-       int err;
+       struct device *blk_rpm_dev = sdev->request_queue->dev;
+       int err = 0;
 
-       err = blk_pre_runtime_suspend(sdev->request_queue);
-       if (err)
-               return err;
+       if (blk_rpm_dev) {
+               err = blk_pre_runtime_suspend(sdev->request_queue);
+               if (err)
+                       return err;
+       }
        if (pm && pm->runtime_suspend)
                err = pm->runtime_suspend(dev);
-       blk_post_runtime_suspend(sdev->request_queue, err);
+       if (blk_rpm_dev)
+               blk_post_runtime_suspend(sdev->request_queue, err);
 
        return err;
 }
@@ -246,12 +250,15 @@ static int sdev_runtime_resume(struct de
 {
        struct scsi_device *sdev = to_scsi_device(dev);
        const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+       struct device *blk_rpm_dev = sdev->request_queue->dev;
        int err = 0;
 
-       blk_pre_runtime_resume(sdev->request_queue);
+       if (blk_rpm_dev)
+               blk_pre_runtime_resume(sdev->request_queue);
        if (pm && pm->runtime_resume)
                err = pm->runtime_resume(dev);
-       blk_post_runtime_resume(sdev->request_queue, err);
+       if (blk_rpm_dev)
+               blk_post_runtime_resume(sdev->request_queue, err);
 
        return err;
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" 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