#define ORIGIN_DEFAULT 0
#define ORIGIN_CONFIG 1
+/*
+ * In kernel, fast_io_fail == 0 means immediate failure on rport delete.
+ * OTOH '0' means not-configured in various places in multipath-tools.
+ */
+#define MP_FAST_IO_FAIL_OFF (-1)
+#define MP_FAST_IO_FAIL_ZERO (-2)
+
enum devtypes {
DEV_NONE,
DEV_DEVT,
buff = set_value(strvec);
if (strlen(buff) == 3 && !strcmp(buff, "off"))
- conf->fast_io_fail = -1;
+ conf->fast_io_fail = MP_FAST_IO_FAIL_OFF;
else if (sscanf(buff, "%d", &conf->fast_io_fail) != 1 ||
- conf->fast_io_fail < -1)
+ conf->fast_io_fail < MP_FAST_IO_FAIL_ZERO)
conf->fast_io_fail = 0;
+ else if (conf->fast_io_fail == 0)
+ conf->fast_io_fail = MP_FAST_IO_FAIL_ZERO;
FREE(buff);
return 0;
buff = set_value(strvec);
if (strlen(buff) == 3 && !strcmp(buff, "off"))
- hwe->fast_io_fail = -1;
+ hwe->fast_io_fail = MP_FAST_IO_FAIL_OFF;
else if (sscanf(buff, "%d", &hwe->fast_io_fail) != 1 ||
- hwe->fast_io_fail < -1)
+ hwe->fast_io_fail < MP_FAST_IO_FAIL_ZERO)
hwe->fast_io_fail = 0;
+ else if (hwe->fast_io_fail == 0)
+ hwe->fast_io_fail = MP_FAST_IO_FAIL_ZERO;
FREE(buff);
return 0;
return 0;
if (hwe->fast_io_fail == conf->fast_io_fail)
return 0;
- if (hwe->fast_io_fail == -1)
+ if (hwe->fast_io_fail == MP_FAST_IO_FAIL_OFF)
return snprintf(buff, len, "off");
+ if (hwe->fast_io_fail == MP_FAST_IO_FAIL_ZERO)
+ return snprintf(buff, len, "0");
return snprintf(buff, len, "%d", hwe->fast_io_fail);
}
{
if (!conf->fast_io_fail)
return 0;
- if (conf->fast_io_fail == -1)
+ if (conf->fast_io_fail == MP_FAST_IO_FAIL_OFF)
return snprintf(buff, len, "off");
+ if (conf->fast_io_fail == MP_FAST_IO_FAIL_ZERO)
+ return snprintf(buff, len, "0");
return snprintf(buff, len, "%d", conf->fast_io_fail);
}
if (sysfs_attr_set_value(attr_path, "dev_loss_tmo",
value, 11) < 0) {
int err = 1;
- if (mpp->fast_io_fail <= 0 && mpp->dev_loss > 600) {
+ if ((!mpp->fast_io_fail || mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF) && mpp->dev_loss > 600) {
strncpy(value, "600", 4);
condlog(3, "%s: limiting dev_loss_tmo to 600, since fast_io_fail is not set", mpp->alias);
if (sysfs_attr_set_value(attr_path, "dev_loss_tmo", value, 11) >= 0)
}
}
if (mpp->fast_io_fail){
- if (mpp->fast_io_fail == -1)
+ if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
sprintf(value, "off");
+ else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO)
+ sprintf(value, "0");
else
snprintf(value, 11, "%u", mpp->fast_io_fail);
if (sysfs_attr_set_value(attr_path, "fast_io_fail_tmo",
{
if (mp->hwe && mp->hwe->fast_io_fail) {
mp->fast_io_fail = mp->hwe->fast_io_fail;
- if (mp->fast_io_fail == -1)
+ if (mp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
condlog(3, "%s: fast_io_fail_tmo = off (controller default)", mp->alias);
else
- condlog(3, "%s: fast_io_fail_tmo = %d (controller default)", mp->alias, mp->fast_io_fail);
+ condlog(3, "%s: fast_io_fail_tmo = %d (controller default)", mp->alias,
+ mp->fast_io_fail == MP_FAST_IO_FAIL_ZERO ? 0 : mp->fast_io_fail);
return 0;
}
if (conf->fast_io_fail) {
mp->fast_io_fail = conf->fast_io_fail;
- if (mp->fast_io_fail == -1)
+ if (mp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
condlog(3, "%s: fast_io_fail_tmo = off (config file default)", mp->alias);
else
- condlog(3, "%s: fast_io_fail_tmo = %d (config file default)", mp->alias, mp->fast_io_fail);
+ condlog(3, "%s: fast_io_fail_tmo = %d (config file default)", mp->alias,
+ mp->fast_io_fail == MP_FAST_IO_FAIL_ZERO ? 0 : mp->fast_io_fail);
return 0;
}
mp->fast_io_fail = 0;