diff mbox

OOPS: unplugging western digital passport drive

Message ID Pine.LNX.4.44L0.1503181045230.1497-100000@iolanthe.rowland.org (mailing list archive)
State New, archived
Headers show

Commit Message

Alan Stern March 18, 2015, 2:49 p.m. UTC
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





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

Comments

Alan Stern June 17, 2015, 7:09 p.m. UTC | #1
Joe or Stanis?^?aw:

I never heard anything back about this.  Does the patch fix the crash?

Alan Stern


On Wed, 18 Mar 2015, Alan Stern wrote:

> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joe Lawrence June 22, 2015, 1:14 p.m. UTC | #2
Hi Alan -- last I heard from Stan on this bug was April 14 -- he was on
"long holidays" at that time :)

-- Joe

On 06/17/2015 03:09 PM, Alan Stern wrote:
> Joe or Stanis?^?aw:
> 
> I never heard anything back about this.  Does the patch fix the crash?
> 
> Alan Stern
> 
> 
> On Wed, 18 Mar 2015, Alan Stern wrote:
> 
>> 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
Alan Stern June 22, 2015, 2:43 p.m. UTC | #3
On Mon, 22 Jun 2015, Joe Lawrence wrote:

> Hi Alan -- last I heard from Stan on this bug was April 14 -- he was on
> "long holidays" at that time :)
> 
> -- Joe

Without knowing whether the patch really fixes the problem, I can't 
tell whether it should be submitted!

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
diff mbox

Patch

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