[SCSI] scsi_error: disable eh_deadline if no host_reset_handler is set
authorHannes Reinecke <hare@suse.de>
Fri, 17 Jan 2014 15:05:38 +0000 (16:05 +0100)
committerJames Bottomley <JBottomley@Parallels.com>
Sat, 15 Mar 2014 17:18:59 +0000 (10:18 -0700)
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/hosts.c
drivers/scsi/scsi_sysfs.c

index f28ea070d3df4631306aa3385b854502e7eeef74..3cbb57a8b8468e28cf9057faedcfb4824f52b190 100644 (file)
@@ -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,
index 665acbf83693e78e1b6bc77e54da501b2a847dd5..8dab6ddf822266ceae113c8e43f3f3a90f295821 100644 (file)
@@ -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")))