Skip to contentSkip to conversation

scsi_scan.c : add missing interim SDEV_DEL state if slave_alloc fails

PATCH New James Smart 1 participant 1 message Jan 27, 2009 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_scan.c : add missing interim SDEV_DEL state if slave_alloc fails

Reworked per James's suggestion
----

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.

-- james s

---

 scsi_scan.c |    1 +
 1 file changed, 1 insertion(+)
drivers/scsi/scsi_scan.c +1 -0
diff -upNr a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
@@ -317,6 +317,7 @@ static struct scsi_device *scsi_alloc_sd
 	return sdev;
 
 out_device_destroy:
+	scsi_device_set_state(sdev, SDEV_DEL);
 	transport_destroy_device(&sdev->sdev_gendev);
 	put_device(&sdev->sdev_gendev);
 out: