scsi_error: disable eh_deadline if no host_reset_handler is set
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
@@ -396,7 +396,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->unchecked_isa_dma = sht->unchecked_isa_dma; shost->use_clustering = sht->use_clustering; shost->ordered_tag = sht->ordered_tag; -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
@@ -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->transportt->eh_host_reset_handler))return ret;if (!strncmp (buf,"off" ,strlen ("off" )))
Signature · 1 line
1.7.12.4
Quoted 30 lines · Hannes Reinecke
When the host template doesn't declare an
eh_host_reset_handlertheeh_deadlinemechanism is pointless and will set the device to offline. So disableeh_deadlineif noeh_host_reset_handleris present.Cc Ewan Milne <[email protected]>Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/hosts.c | 2 +- drivers/scsi/scsi_sysfs.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)drivers/scsi/hosts.c +1
-1@@ -396,7 +396,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->unchecked_isa_dma = sht->unchecked_isa_dma; shost->use_clustering = sht->use_clustering; shost->ordered_tag = sht->ordered_tag; -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 +0
-0
drivers/scsi/scsi_sysfs.c store_shost_eh_deadline(struct device *dev, struct device_attribute *attr, · line 305
Quoted 7 lines
drivers/scsi/scsi_sysfs.c +3
-1@@ -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->transportt->eh_host_reset_handler))
I think this bit is supposed to be:
if ((shost->transportt &&
shost->transportt->eh_strategy_handler) ||
!shost->hostt->eh_host_reset_handler)
return ret;because the field is in the scsi_host_template structure, right?
But, otherwise, this patch is necessary because some drivers don't implement host reset (e.g. hpsa).
-Ewan
Quoted 3 lines
drivers/scsi/scsi_sysfs.c +0
-0return ret;if (!strncmp (buf,"off" ,strlen ("off" )))
Quoted 41 lines · Ewan Milne
Quoted 30 lines · Hannes Reinecke
When the host template doesn't declare an
eh_host_reset_handlertheeh_deadlinemechanism is pointless and will set the device to offline. So disableeh_deadlineif noeh_host_reset_handleris present.Cc Ewan Milne <[email protected]>Signed-off-by Hannes Reinecke <[email protected]>--- drivers/scsi/hosts.c | 2 +- drivers/scsi/scsi_sysfs.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)drivers/scsi/hosts.c +1
-1@@ -396,7 +396,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) shost->unchecked_isa_dma = sht->unchecked_isa_dma; shost->use_clustering = sht->use_clustering; shost->ordered_tag = sht->ordered_tag; -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 +0
-0drivers/scsi/scsi_sysfs.c store_shost_eh_deadline(struct device *dev, struct device_attribute *attr, · line 305
Quoted 7 lines
drivers/scsi/scsi_sysfs.c +3
-1@@ -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->transportt->eh_host_reset_handler))I think this bit is supposed to be:
Quoted 7 lines
if ((shost->transportt && shost->transportt->eh_strategy_handler) || !shost->hostt->eh_host_reset_handler) return ret;because the field is in the
scsi_host_templatestructure, right?
Right. Obviously.
I'll be sending an updated patch.
Cheers,
Hannes
Signature · 8 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html