1 From: James Smart <james.smart@emulex.com>
2 Subject: add missing interim SDEV_DEL state if slave_alloc fails
5 We were running i/o and performing a bunch of hba resets in a loop.
6 This forces a lot of target removes and then rescans. Since the
7 resets are occuring during scan it's causing the scan i/o to timeout,
8 invoking error recovery, etc. We end up getting some nasty crashing
9 in scsi_scan.c due to references to old sdevs that are failing
10 but had some lingering references that kept them around.
12 Fix by setting device state to SDEV_DEL if the LLD's slave_alloc
15 Signed-off-by: Hannes Reinecke <hare@suse.de>
17 diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
18 index e5777e6..262a7ea 100644
19 --- a/drivers/scsi/scsi_scan.c
20 +++ b/drivers/scsi/scsi_scan.c
21 @@ -314,6 +314,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
25 + scsi_device_set_state(sdev, SDEV_DEL);
26 transport_destroy_device(&sdev->sdev_gendev);
27 put_device(&sdev->sdev_gendev);