fix breakage in the SCSI generic tag code
PATCH 1/1 fix breakage in the SCSI generic tag code
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 =====
drivers/scsi/scsi_sysfs.c +8 -8
@@ -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)