Patch for orabug 10260172: - Bug 10260172 - cell disk failure tests causing kobject_add failed kernel errors The patch have been merged by upstream: commit 32aeef605aa01e1fee45e052eceffb00e72ba2b0 Author: Hannes Reinecke Date: Tue Jan 13 16:50:37 2009 +0100 [SCSI] Skip deleted devices in __scsi_device_lookup_by_target() __scsi_device_lookup_by_target() will always return the first sdev with a matching LUN, regardless of the state. However, when this sdev is in SDEV_DEL scsi_device_lookup_by_target() will ignore this device and so any valid device on the list after the deleted device will never be found. So we have to modify __scsi_device_lookup_by_target() to skip any device in SDEV_DEL. Signed-off-by: Hannes Reinecke Signed-off-by: James Bottomley --- a/drivers/scsi/scsi.c 2011-01-11 16:25:57.000000000 +0800 +++ b/drivers/scsi/scsi.c 2011-01-11 16:31:06.000000000 +0800 @@ -897,7 +897,8 @@ EXPORT_SYMBOL(starget_for_each_device); * Looks up the scsi_device with the specified @lun for a give * @starget. The returned scsi_device does not have an additional * reference. You must hold the host's host_lock over this call and - * any access to the returned scsi_device. + * any access to the returned scsi_device. A scsi_device in state + * SDEV_DEL is skipped. * * Note: The only reason why drivers would want to use this is because * they're need to access the device list in irq context. Otherwise you @@ -909,6 +910,8 @@ struct scsi_device *__scsi_device_lookup struct scsi_device *sdev; list_for_each_entry(sdev, &starget->devices, same_target_siblings) { + if (sdev->sdev_state == SDEV_DEL) + continue; if (sdev->lun ==lun) return sdev; }