* [PATCH] fix breakage in the SCSI generic tag code
@ 2005-03-19 19:09 James Bottomley
0 siblings, 0 replies; only message in thread
From: James Bottomley @ 2005-03-19 19:09 UTC (permalink / raw)
To: SCSI Mailing List
When I redid the target allocation routines, I inadvertently broke the
generic tag code. The problem is that the device is added to the host
list after slave_configure in the new code. This is too late since if
any command disconnects during the initial inquiry phase, we now cannot
find the device for the reconnect. The fix is to add the device to the
lists earlier.
James
===== drivers/scsi/scsi_sysfs.c 1.69 vs edited =====
--- 1.69/drivers/scsi/scsi_sysfs.c 2005-02-16 19:05:37 -06:00
+++ edited/drivers/scsi/scsi_sysfs.c 2005-03-19 12:56:31 -06:00
@@ -561,15 +561,7 @@
**/
int scsi_sysfs_add_sdev(struct scsi_device *sdev)
{
- struct Scsi_Host *shost = sdev->host;
- struct scsi_target *starget = scsi_target(sdev);
int error, i;
- unsigned long flags;
-
- spin_lock_irqsave(shost->host_lock, flags);
- list_add_tail(&sdev->same_target_siblings, &starget->devices);
- list_add_tail(&sdev->siblings, &shost->__devices);
- spin_unlock_irqrestore(shost->host_lock, flags);
if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
return error;
@@ -786,6 +778,10 @@
void scsi_sysfs_device_initialize(struct scsi_device *sdev)
{
+ unsigned long flags;
+ struct Scsi_Host *shost = sdev->host;
+ struct scsi_target *starget = sdev->sdev_target;
+
device_initialize(&sdev->sdev_gendev);
sdev->sdev_gendev.bus = &scsi_bus_type;
sdev->sdev_gendev.release = scsi_device_dev_release;
@@ -801,6 +797,10 @@
sdev->channel, sdev->id, sdev->lun);
sdev->scsi_level = SCSI_2;
transport_setup_device(&sdev->sdev_gendev);
+ spin_lock_irqsave(shost->host_lock, flags);
+ list_add_tail(&sdev->same_target_siblings, &starget->devices);
+ list_add_tail(&sdev->siblings, &shost->__devices);
+ spin_unlock_irqrestore(shost->host_lock, flags);
}
int scsi_is_sdev_device(const struct device *dev)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-03-19 19:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-19 19:09 [PATCH] fix breakage in the SCSI generic tag code James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox