Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030191AbVKHUDM (ORCPT ); Tue, 8 Nov 2005 15:03:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1030201AbVKHUDM (ORCPT ); Tue, 8 Nov 2005 15:03:12 -0500 Received: from mailhub.lss.emc.com ([168.159.2.31]:20419 "EHLO mailhub.lss.emc.com") by vger.kernel.org with ESMTP id S1030191AbVKHUDK (ORCPT ); Tue, 8 Nov 2005 15:03:10 -0500 Message-ID: From: "goggin, edward" To: "'Rolf Eike Beer'" Cc: "'Andrew Morton'" , Masanari Iida , linux-kernel@vger.kernel.org, linux-usb-devel@lists.sourceforge.net, linux-scsi@vger.kernel.org Subject: RE: oops with USB Storage on 2.6.14 Date: Tue, 8 Nov 2005 15:02:23 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-PMX-Version: 4.7.1.128075, Antispam-Engine: 2.1.0.0, Antispam-Data: 2005.11.8.21 X-PerlMx-Spam: Gauge=, SPAM=1%, Reasons='EMC_FROM_00+ -3, __CT 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __IMS_MSGID 0, __IMS_MUA 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0' Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2476 Lines: 74 Thanks! Here's a better one. --- ../base/linux-2.6.14-rc4/drivers/scsi/scsi_lib.c 2005-10-10 20:19:19.000000000 -0500 +++ drivers/scsi/scsi_lib.c 2005-11-07 04:46:23.000000000 -0600 @@ -592,10 +592,17 @@ static void scsi_requeue_command(struct void scsi_next_command(struct scsi_cmnd *cmd) { - struct request_queue *q = cmd->device->request_queue; + 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 */ + get_device(&sdev->sdev_gendev); scsi_put_command(cmd); scsi_run_queue(q); + + /* ok to remove device now */ + put_device(&sdev->sdev_gendev); } void scsi_run_host_queues(struct Scsi_Host *shost) > -----Original Message----- > From: linux-scsi-owner@vger.kernel.org > [mailto:linux-scsi-owner@vger.kernel.org] On Behalf Of Rolf Eike Beer > Sent: Tuesday, November 08, 2005 11:38 AM > To: goggin, edward > Cc: 'Andrew Morton'; Masanari Iida; > linux-kernel@vger.kernel.org; > linux-usb-devel@lists.sourceforge.net; linux-scsi@vger.kernel.org > Subject: Re: oops with USB Storage on 2.6.14 > > Am Dienstag, 8. November 2005 17:24 schrieb goggin, edward: > >I've run into a bug like this several times using 2.6.14-rc4 while > >testing dm-multipath's reaction to uevents generated by forcing > >fiber channel transport failures -- which leads to the scsi device > >being detached and the queuedata pointer in the device's queue being > >reset in scsi_device_dev_release. The fix I've used is below and > >it seems to work well for me. I was going to place this patch on > >dm-devel today or tomorrow anyway. > > > >drivers/scsi/scsi_lib.c:scsi_next_command() > >Call scsi_device_get and scsi_device_put around the calls to > >scsi_put_command > >and scsi_run_queue so that the scsi host structure will not > be de-allocated > >between scsi_put_command and scsi_run_queue. > > > >*** ../base/linux-2.6.14-rc4/drivers/scsi/scsi_lib.c Mon Oct > 10 20:19:19 > >2005 > >--- drivers/scsi/scsi_lib.c Thu Nov 3 13:30:03 2005 > >*************** > >*** 592,601 **** > > Your patch is linewrapped. Also please use unified diff > format, good choice > for diff options is "-Naurp". > > Eike > - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/