summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2013-05-10 10:36:04 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-06-04 11:16:24 -0700
commit0816c9251a7180383bb7811e1a1545f7b78e5374 (patch)
tree1dffcde9c45f276b264c83511b6168baab4307a4 /drivers/scsi/scsi_sysfs.c
parent0761df9c4b2d966da3af2ac4ee7372afa681ce63 (diff)
downloadlinux-0816c9251a7180383bb7811e1a1545f7b78e5374.tar.gz
linux-0816c9251a7180383bb7811e1a1545f7b78e5374.tar.bz2
linux-0816c9251a7180383bb7811e1a1545f7b78e5374.zip
[SCSI] Allow error handling timeout to be specified
Introduce eh_timeout which can be used for error handling purposes. This was previously hardcoded to 10 seconds in the SCSI error handling code. However, for some fast-fail scenarios it is necessary to be able to tune this as it can take several iterations (bus device, target, bus, controller) before we give up. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 931a7d954203..7e50061e9ef6 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -560,6 +560,35 @@ sdev_store_timeout (struct device *dev, struct device_attribute *attr,
static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout);
static ssize_t
+sdev_show_eh_timeout(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct scsi_device *sdev;
+ sdev = to_scsi_device(dev);
+ return snprintf(buf, 20, "%u\n", sdev->eh_timeout / HZ);
+}
+
+static ssize_t
+sdev_store_eh_timeout(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct scsi_device *sdev;
+ unsigned int eh_timeout;
+ int err;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EACCES;
+
+ sdev = to_scsi_device(dev);
+ err = kstrtouint(buf, 10, &eh_timeout);
+ if (err)
+ return err;
+ sdev->eh_timeout = eh_timeout * HZ;
+
+ return count;
+}
+static DEVICE_ATTR(eh_timeout, S_IRUGO | S_IWUSR, sdev_show_eh_timeout, sdev_store_eh_timeout);
+
+static ssize_t
store_rescan_field (struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
@@ -723,6 +752,7 @@ static struct attribute *scsi_sdev_attrs[] = {
&dev_attr_delete.attr,
&dev_attr_state.attr,
&dev_attr_timeout.attr,
+ &dev_attr_eh_timeout.attr,
&dev_attr_iocounterbits.attr,
&dev_attr_iorequest_cnt.attr,
&dev_attr_iodone_cnt.attr,