diff options
author | Holger Smolinski <Holger.Smolinski@de.ibm.com> | 2009-01-09 06:14:51 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-01-09 06:15:05 -0500 |
commit | 13de227bcd80fbdaeebe1f31154487dddb7d5b1e (patch) | |
tree | 3f37f92d9fd5dd3c155544afb06cfe8117ec708c /drivers/s390/block/dasd_devmap.c | |
parent | 1301809bcee33c2153605b4387c57fab75f9800a (diff) |
[S390] dasd: add device attribute to disable blocking on lost paths
When the connection between host and storage server is lost, the
dasd device driver usually blocks all I/O on affected devices and
waits for them to reappear. In some setups however it would be
better if the I/O is returned as error so that device can be
recovered by some other means, eg. in a raid or multipath setup.
Signed-off-by: Holger Smolinski <Holger.Smolinski@de.ibm.com>
Signed-off-by: Stefan Weinhuber <wein@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_devmap.c')
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 2ef25731d197..300e28a531f8 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -206,6 +206,8 @@ dasd_feature_list(char *str, char **endp) | |||
206 | features |= DASD_FEATURE_USEDIAG; | 206 | features |= DASD_FEATURE_USEDIAG; |
207 | else if (len == 6 && !strncmp(str, "erplog", 6)) | 207 | else if (len == 6 && !strncmp(str, "erplog", 6)) |
208 | features |= DASD_FEATURE_ERPLOG; | 208 | features |= DASD_FEATURE_ERPLOG; |
209 | else if (len == 8 && !strncmp(str, "failfast", 8)) | ||
210 | features |= DASD_FEATURE_FAILFAST; | ||
209 | else { | 211 | else { |
210 | MESSAGE(KERN_WARNING, | 212 | MESSAGE(KERN_WARNING, |
211 | "unsupported feature: %*s, " | 213 | "unsupported feature: %*s, " |
@@ -667,6 +669,51 @@ dasd_device_from_cdev(struct ccw_device *cdev) | |||
667 | */ | 669 | */ |
668 | 670 | ||
669 | /* | 671 | /* |
672 | * failfast controls the behaviour, if no path is available | ||
673 | */ | ||
674 | static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr, | ||
675 | char *buf) | ||
676 | { | ||
677 | struct dasd_devmap *devmap; | ||
678 | int ff_flag; | ||
679 | |||
680 | devmap = dasd_find_busid(dev->bus_id); | ||
681 | if (!IS_ERR(devmap)) | ||
682 | ff_flag = (devmap->features & DASD_FEATURE_FAILFAST) != 0; | ||
683 | else | ||
684 | ff_flag = (DASD_FEATURE_DEFAULT & DASD_FEATURE_FAILFAST) != 0; | ||
685 | return snprintf(buf, PAGE_SIZE, ff_flag ? "1\n" : "0\n"); | ||
686 | } | ||
687 | |||
688 | static ssize_t dasd_ff_store(struct device *dev, struct device_attribute *attr, | ||
689 | const char *buf, size_t count) | ||
690 | { | ||
691 | struct dasd_devmap *devmap; | ||
692 | int val; | ||
693 | char *endp; | ||
694 | |||
695 | devmap = dasd_devmap_from_cdev(to_ccwdev(dev)); | ||
696 | if (IS_ERR(devmap)) | ||
697 | return PTR_ERR(devmap); | ||
698 | |||
699 | val = simple_strtoul(buf, &endp, 0); | ||
700 | if (((endp + 1) < (buf + count)) || (val > 1)) | ||
701 | return -EINVAL; | ||
702 | |||
703 | spin_lock(&dasd_devmap_lock); | ||
704 | if (val) | ||
705 | devmap->features |= DASD_FEATURE_FAILFAST; | ||
706 | else | ||
707 | devmap->features &= ~DASD_FEATURE_FAILFAST; | ||
708 | if (devmap->device) | ||
709 | devmap->device->features = devmap->features; | ||
710 | spin_unlock(&dasd_devmap_lock); | ||
711 | return count; | ||
712 | } | ||
713 | |||
714 | static DEVICE_ATTR(failfast, 0644, dasd_ff_show, dasd_ff_store); | ||
715 | |||
716 | /* | ||
670 | * readonly controls the readonly status of a dasd | 717 | * readonly controls the readonly status of a dasd |
671 | */ | 718 | */ |
672 | static ssize_t | 719 | static ssize_t |
@@ -1020,6 +1067,7 @@ static struct attribute * dasd_attrs[] = { | |||
1020 | &dev_attr_use_diag.attr, | 1067 | &dev_attr_use_diag.attr, |
1021 | &dev_attr_eer_enabled.attr, | 1068 | &dev_attr_eer_enabled.attr, |
1022 | &dev_attr_erplog.attr, | 1069 | &dev_attr_erplog.attr, |
1070 | &dev_attr_failfast.attr, | ||
1023 | NULL, | 1071 | NULL, |
1024 | }; | 1072 | }; |
1025 | 1073 | ||