From: Tomas Henzl <thenzl@redhat.com> Date: Fri, 17 Apr 2009 12:33:01 +0300 Subject: [scsi] add missing SDEV_DEL state if slave_alloc fails Message-id: 49E84CCD.20009@redhat.com O-Subject: [RHEL5.4 PATCH] scsi add missing interim SDEV_DEL state if slave_alloc fails Bugzilla: 430170 RH-Acked-by: Pete Zaitcev <zaitcev@redhat.com> RH-Acked-by: David Milburn <dmilburn@redhat.com> Resolves bz430170 This patch comes from Emulex Comment from James Smart: "We were running i/o and performing a bunch of hba resets in a loop. This forces a lot of target removes and then rescans. Since the resets are occuring during scan it's causing the scan i/o to timeout, invoking error recovery, etc. We end up getting some nasty crashing in scsi_scan.c due to references to old sdevs that are failing but had some lingering references that kept them around. Fix by setting device state to SDEV_DEL if the LLD's slave_alloc fails." The patch is in upstream - commit c2f9e49f9bbfa2e111ab1e1628b96b560bae7cec Tomas diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 0be62ad..f0c3f5a 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -275,6 +275,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, return sdev; out_device_destroy: + scsi_device_set_state(sdev, SDEV_DEL); transport_destroy_device(&sdev->sdev_gendev); put_device(&sdev->sdev_gendev); out: