From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Bottomley Subject: RE: oops with USB Storage on 2.6.14 Date: Tue, 08 Nov 2005 12:01:45 -0500 Message-ID: <1131469305.3270.21.camel@mulgrave> References: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-usb-devel-admin@lists.sourceforge.net Errors-To: linux-usb-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: "goggin, edward" Cc: 'Andrew Morton' , Masanari Iida , linux-kernel@vger.kernel.org, linux-usb-devel@lists.sourceforge.net, linux-scsi@vger.kernel.org List-Id: linux-scsi@vger.kernel.org On Tue, 2005-11-08 at 11:24 -0500, goggin, edward wrote: > ! struct scsi_device *sdev = cmd->device; > ! struct request_queue *q = sdev->request_queue; > ! > ! // need to hold a reference on the device before we let go of the > cmd > ! if (scsi_device_get(sdev)) { > ! scsi_put_command(cmd); > ! return; // maybe sdev_state == SDEV_CANCEL, SDEV_DEL > ! } > > scsi_put_command(cmd); > scsi_run_queue(q); > + > + // ok to remove device now > + scsi_device_put(sdev); This is the right idea, I think, but not necessarily the right fix. scsi_device_get() will fail if the device is going offline, but we would still need to run the queues. try this sequence instead: get_device(&sdev->sdev_gendev); scsi_put_command(cmd); scsi_run_queue(q); put_device(&sdev->sdev_gendev); James ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030258AbVKHRD1 (ORCPT ); Tue, 8 Nov 2005 12:03:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1030260AbVKHRD0 (ORCPT ); Tue, 8 Nov 2005 12:03:26 -0500 Received: from stat9.steeleye.com ([209.192.50.41]:29613 "EHLO hancock.sc.steeleye.com") by vger.kernel.org with ESMTP id S1030258AbVKHRDZ (ORCPT ); Tue, 8 Nov 2005 12:03:25 -0500 Subject: RE: oops with USB Storage on 2.6.14 From: James Bottomley To: "goggin, edward" Cc: "'Andrew Morton'" , Masanari Iida , linux-kernel@vger.kernel.org, linux-usb-devel@lists.sourceforge.net, linux-scsi@vger.kernel.org In-Reply-To: References: Content-Type: text/plain Date: Tue, 08 Nov 2005 12:01:45 -0500 Message-Id: <1131469305.3270.21.camel@mulgrave> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2005-11-08 at 11:24 -0500, goggin, edward wrote: > ! struct scsi_device *sdev = cmd->device; > ! struct request_queue *q = sdev->request_queue; > ! > ! // need to hold a reference on the device before we let go of the > cmd > ! if (scsi_device_get(sdev)) { > ! scsi_put_command(cmd); > ! return; // maybe sdev_state == SDEV_CANCEL, SDEV_DEL > ! } > > scsi_put_command(cmd); > scsi_run_queue(q); > + > + // ok to remove device now > + scsi_device_put(sdev); This is the right idea, I think, but not necessarily the right fix. scsi_device_get() will fail if the device is going offline, but we would still need to run the queues. try this sequence instead: get_device(&sdev->sdev_gendev); scsi_put_command(cmd); scsi_run_queue(q); put_device(&sdev->sdev_gendev); James