Skip to contentSkip to conversation

scsi_error: disable eh_deadline if no host_reset_handler is set

PATCH New Hannes Reinecke 1 participant 1 message Jan 17, 2014 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_error: disable eh_deadline if no host_reset_handler is set

When the host template doesn't declare an eh_host_reset_handler the eh_deadline mechanism is pointless and will set the device to offline. So disable eh_deadline if no eh_host_reset_handler is present.

---
 drivers/scsi/hosts.c      | 2 +-
 drivers/scsi/scsi_sysfs.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/hosts.c +1 -1
index f28ea07..3cbb57a 100644
@@ -398,7 +398,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 	shost->ordered_tag = sht->ordered_tag;
 	shost->no_write_same = sht->no_write_same;
 
-	if (shost_eh_deadline == -1)
+	if (shost_eh_deadline == -1 || !sht->eh_host_reset_handler)
 		shost->eh_deadline = -1;
 	else if ((ulong) shost_eh_deadline * HZ > INT_MAX) {
 		shost_printk(KERN_WARNING, shost,
drivers/scsi/scsi_sysfs.c +3 -1
index 9117d0b..f2151cd 100644
@@ -300,7 +300,9 @@ store_shost_eh_deadline(struct device *dev, struct device_attribute *attr,
 	int ret = -EINVAL;
 	unsigned long deadline, flags;
 
-	if (shost->transportt && shost->transportt->eh_strategy_handler)
+	if (shost->transportt &&
+	    (shost->transportt->eh_strategy_handler ||
+	     !shost->hostt->eh_host_reset_handler))
 		return ret;
 
 	if (!strncmp(buf, "off", strlen("off")))
Signature · 1 line
1.7.12.4