Skip to contentSkip to conversation

Don't online offlined devices in scsi_target_quiesce()

PATCH New Bernd Schubert 1 participant 1 message Feb 6, 2009 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 Don't online offlined devices in scsi_target_quiesce()

Don't online offlined devices in scsi_target_quiesce(), it often onlines devices which just have been take offline due to an error on the host.

---
 drivers/scsi/scsi_lib.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +9 -1
Index: linux-2.6/drivers/scsi/scsi_lib.c
===================================================================
@@ -2487,7 +2487,15 @@ device_quiesce_fn(struct scsi_device *sd
 void
 scsi_target_quiesce(struct scsi_target *starget)
 {
-	starget_for_each_device(starget, NULL, device_quiesce_fn);
+	struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
+	struct scsi_device *sdev;
+
+	shost_for_each_device(sdev, shost) {
+		if ((sdev->channel == starget->channel) &&
+		    (sdev->id == starget->id) &&
+		    (sdev->sdev_state != SDEV_OFFLINE))
+			device_quiesce_fn(sdev, NULL);
+	}
 }
 EXPORT_SYMBOL(scsi_target_quiesce);