From patchwork Wed Mar 18 14:49:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alan Stern X-Patchwork-Id: 6040661 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 59C2F9F399 for ; Wed, 18 Mar 2015 14:49:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7244320431 for ; Wed, 18 Mar 2015 14:49:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9366A2024F for ; Wed, 18 Mar 2015 14:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752010AbbCROtP (ORCPT ); Wed, 18 Mar 2015 10:49:15 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:50755 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751074AbbCROtP (ORCPT ); Wed, 18 Mar 2015 10:49:15 -0400 Received: (qmail 3051 invoked by uid 2102); 18 Mar 2015 10:49:14 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 18 Mar 2015 10:49:14 -0400 Date: Wed, 18 Mar 2015 10:49:14 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Joe Lawrence cc: =?UTF-8?B?U3RhbmlzxYJhdyBQaXR1Y2hh?= , SCSI development list Subject: Re: OOPS: unplugging western digital passport drive In-Reply-To: <5508D6B0.3010806@stratus.com> Message-ID: MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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; }