|
|
ca7c20 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
ca7c20 |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
ca7c20 |
Date: Wed, 13 Apr 2022 23:27:38 -0500
|
|
|
ca7c20 |
Subject: [PATCH] libmultipath: Set the scsi timeout parameters by path
|
|
|
ca7c20 |
|
|
|
ca7c20 |
Instead of dev_loss, fast_io_fail, and eh_deadline belonging to the
|
|
|
ca7c20 |
multipath structure, have them belong to the path structure. This means
|
|
|
ca7c20 |
that they are selected per path, and that sysfs_set_scsi_tmo() doesn't
|
|
|
ca7c20 |
assume that all paths of a multipath device will have the same value.
|
|
|
ca7c20 |
Currently they will all be the same, but a future patch will make it
|
|
|
ca7c20 |
possible for paths to have different values based on their protocol.
|
|
|
ca7c20 |
|
|
|
ca7c20 |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
ca7c20 |
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
|
|
ca7c20 |
---
|
|
|
ca7c20 |
libmultipath/configure.c | 5 +-
|
|
|
ca7c20 |
libmultipath/discovery.c | 158 ++++++++++++++++++++-------------------
|
|
|
ca7c20 |
libmultipath/discovery.h | 2 +-
|
|
|
ca7c20 |
libmultipath/propsel.c | 42 +++++------
|
|
|
ca7c20 |
libmultipath/propsel.h | 6 +-
|
|
|
ca7c20 |
libmultipath/structs.c | 1 -
|
|
|
ca7c20 |
libmultipath/structs.h | 6 +-
|
|
|
ca7c20 |
7 files changed, 112 insertions(+), 108 deletions(-)
|
|
|
ca7c20 |
|
|
|
ca7c20 |
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
|
|
|
ca7c20 |
index 043e4232..70049f47 100644
|
|
|
ca7c20 |
--- a/libmultipath/configure.c
|
|
|
ca7c20 |
+++ b/libmultipath/configure.c
|
|
|
ca7c20 |
@@ -365,9 +365,6 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs)
|
|
|
ca7c20 |
select_mode(conf, mpp);
|
|
|
ca7c20 |
select_uid(conf, mpp);
|
|
|
ca7c20 |
select_gid(conf, mpp);
|
|
|
ca7c20 |
- select_fast_io_fail(conf, mpp);
|
|
|
ca7c20 |
- select_dev_loss(conf, mpp);
|
|
|
ca7c20 |
- select_eh_deadline(conf, mpp);
|
|
|
ca7c20 |
select_reservation_key(conf, mpp);
|
|
|
ca7c20 |
select_deferred_remove(conf, mpp);
|
|
|
ca7c20 |
select_marginal_path_err_sample_time(conf, mpp);
|
|
|
ca7c20 |
@@ -383,7 +380,7 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs)
|
|
|
ca7c20 |
select_ghost_delay(conf, mpp);
|
|
|
ca7c20 |
select_flush_on_last_del(conf, mpp);
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- sysfs_set_scsi_tmo(mpp, conf->checkint);
|
|
|
ca7c20 |
+ sysfs_set_scsi_tmo(conf, mpp);
|
|
|
ca7c20 |
marginal_pathgroups = conf->marginal_pathgroups;
|
|
|
ca7c20 |
pthread_cleanup_pop(1);
|
|
|
ca7c20 |
|
|
|
ca7c20 |
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
|
|
|
ca7c20 |
index 6fb81c28..bcda8b09 100644
|
|
|
ca7c20 |
--- a/libmultipath/discovery.c
|
|
|
ca7c20 |
+++ b/libmultipath/discovery.c
|
|
|
ca7c20 |
@@ -596,13 +596,13 @@ sysfs_get_asymmetric_access_state(struct path *pp, char *buff, int buflen)
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
|
|
|
ca7c20 |
static int
|
|
|
ca7c20 |
-sysfs_set_eh_deadline(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
+sysfs_set_eh_deadline(struct path *pp)
|
|
|
ca7c20 |
{
|
|
|
ca7c20 |
struct udev_device *hostdev;
|
|
|
ca7c20 |
char host_name[HOST_NAME_LEN], value[16];
|
|
|
ca7c20 |
int ret, len;
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- if (mpp->eh_deadline == EH_DEADLINE_UNSET)
|
|
|
ca7c20 |
+ if (pp->eh_deadline == EH_DEADLINE_UNSET)
|
|
|
ca7c20 |
return 0;
|
|
|
ca7c20 |
|
|
|
ca7c20 |
sprintf(host_name, "host%d", pp->sg_id.host_no);
|
|
|
ca7c20 |
@@ -611,12 +611,12 @@ sysfs_set_eh_deadline(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
if (!hostdev)
|
|
|
ca7c20 |
return 1;
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- if (mpp->eh_deadline == EH_DEADLINE_OFF)
|
|
|
ca7c20 |
+ if (pp->eh_deadline == EH_DEADLINE_OFF)
|
|
|
ca7c20 |
len = sprintf(value, "off");
|
|
|
ca7c20 |
- else if (mpp->eh_deadline == EH_DEADLINE_ZERO)
|
|
|
ca7c20 |
+ else if (pp->eh_deadline == EH_DEADLINE_ZERO)
|
|
|
ca7c20 |
len = sprintf(value, "0");
|
|
|
ca7c20 |
else
|
|
|
ca7c20 |
- len = sprintf(value, "%d", mpp->eh_deadline);
|
|
|
ca7c20 |
+ len = sprintf(value, "%d", pp->eh_deadline);
|
|
|
ca7c20 |
|
|
|
ca7c20 |
ret = sysfs_attr_set_value(hostdev, "eh_deadline",
|
|
|
ca7c20 |
value, len + 1);
|
|
|
ca7c20 |
@@ -640,8 +640,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
unsigned int tmo;
|
|
|
ca7c20 |
int ret;
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- if (mpp->dev_loss == DEV_LOSS_TMO_UNSET &&
|
|
|
ca7c20 |
- mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
|
|
|
ca7c20 |
+ if (pp->dev_loss == DEV_LOSS_TMO_UNSET &&
|
|
|
ca7c20 |
+ pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
|
|
|
ca7c20 |
return;
|
|
|
ca7c20 |
|
|
|
ca7c20 |
sprintf(rport_id, "rport-%d:%d-%d",
|
|
|
ca7c20 |
@@ -683,14 +683,14 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
* then set fast_io_fail, and _then_ set dev_loss_tmo
|
|
|
ca7c20 |
* to the correct value.
|
|
|
ca7c20 |
*/
|
|
|
ca7c20 |
- if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET &&
|
|
|
ca7c20 |
- mpp->fast_io_fail != MP_FAST_IO_FAIL_ZERO &&
|
|
|
ca7c20 |
- mpp->fast_io_fail != MP_FAST_IO_FAIL_OFF) {
|
|
|
ca7c20 |
+ if (pp->fast_io_fail != MP_FAST_IO_FAIL_UNSET &&
|
|
|
ca7c20 |
+ pp->fast_io_fail != MP_FAST_IO_FAIL_ZERO &&
|
|
|
ca7c20 |
+ pp->fast_io_fail != MP_FAST_IO_FAIL_OFF) {
|
|
|
ca7c20 |
/* Check if we need to temporarily increase dev_loss_tmo */
|
|
|
ca7c20 |
- if ((unsigned int)mpp->fast_io_fail >= tmo) {
|
|
|
ca7c20 |
+ if ((unsigned int)pp->fast_io_fail >= tmo) {
|
|
|
ca7c20 |
/* Increase dev_loss_tmo temporarily */
|
|
|
ca7c20 |
snprintf(value, sizeof(value), "%u",
|
|
|
ca7c20 |
- (unsigned int)mpp->fast_io_fail + 1);
|
|
|
ca7c20 |
+ (unsigned int)pp->fast_io_fail + 1);
|
|
|
ca7c20 |
ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
|
|
|
ca7c20 |
value, strlen(value));
|
|
|
ca7c20 |
if (ret <= 0) {
|
|
|
ca7c20 |
@@ -704,20 +704,20 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
goto out;
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
- } else if (mpp->dev_loss > DEFAULT_DEV_LOSS_TMO &&
|
|
|
ca7c20 |
- mpp->no_path_retry != NO_PATH_RETRY_QUEUE) {
|
|
|
ca7c20 |
+ } else if (pp->dev_loss > DEFAULT_DEV_LOSS_TMO &&
|
|
|
ca7c20 |
+ mpp->no_path_retry != NO_PATH_RETRY_QUEUE) {
|
|
|
ca7c20 |
condlog(2, "%s: limiting dev_loss_tmo to %d, since "
|
|
|
ca7c20 |
"fast_io_fail is not set",
|
|
|
ca7c20 |
rport_id, DEFAULT_DEV_LOSS_TMO);
|
|
|
ca7c20 |
- mpp->dev_loss = DEFAULT_DEV_LOSS_TMO;
|
|
|
ca7c20 |
+ pp->dev_loss = DEFAULT_DEV_LOSS_TMO;
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
- if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
|
|
|
ca7c20 |
- if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
|
|
|
ca7c20 |
+ if (pp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
|
|
|
ca7c20 |
+ if (pp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
|
|
|
ca7c20 |
sprintf(value, "off");
|
|
|
ca7c20 |
- else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO)
|
|
|
ca7c20 |
+ else if (pp->fast_io_fail == MP_FAST_IO_FAIL_ZERO)
|
|
|
ca7c20 |
sprintf(value, "0");
|
|
|
ca7c20 |
else
|
|
|
ca7c20 |
- snprintf(value, 16, "%u", mpp->fast_io_fail);
|
|
|
ca7c20 |
+ snprintf(value, 16, "%u", pp->fast_io_fail);
|
|
|
ca7c20 |
ret = sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo",
|
|
|
ca7c20 |
value, strlen(value));
|
|
|
ca7c20 |
if (ret <= 0) {
|
|
|
ca7c20 |
@@ -728,8 +728,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
rport_id, value, -ret);
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
- if (mpp->dev_loss != DEV_LOSS_TMO_UNSET) {
|
|
|
ca7c20 |
- snprintf(value, 16, "%u", mpp->dev_loss);
|
|
|
ca7c20 |
+ if (pp->dev_loss != DEV_LOSS_TMO_UNSET) {
|
|
|
ca7c20 |
+ snprintf(value, 16, "%u", pp->dev_loss);
|
|
|
ca7c20 |
ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
|
|
|
ca7c20 |
value, strlen(value));
|
|
|
ca7c20 |
if (ret <= 0) {
|
|
|
ca7c20 |
@@ -745,15 +745,15 @@ out:
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
|
|
|
ca7c20 |
static void
|
|
|
ca7c20 |
-sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
+sysfs_set_session_tmo(struct path *pp)
|
|
|
ca7c20 |
{
|
|
|
ca7c20 |
struct udev_device *session_dev = NULL;
|
|
|
ca7c20 |
char session_id[64];
|
|
|
ca7c20 |
char value[11];
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- if (mpp->dev_loss != DEV_LOSS_TMO_UNSET)
|
|
|
ca7c20 |
+ if (pp->dev_loss != DEV_LOSS_TMO_UNSET)
|
|
|
ca7c20 |
condlog(3, "%s: ignoring dev_loss_tmo on iSCSI", pp->dev);
|
|
|
ca7c20 |
- if (mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
|
|
|
ca7c20 |
+ if (pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
|
|
|
ca7c20 |
return;
|
|
|
ca7c20 |
|
|
|
ca7c20 |
sprintf(session_id, "session%d", pp->sg_id.transport_id);
|
|
|
ca7c20 |
@@ -767,15 +767,15 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no,
|
|
|
ca7c20 |
pp->sg_id.channel, pp->sg_id.scsi_id, session_id);
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
|
|
|
ca7c20 |
- if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF) {
|
|
|
ca7c20 |
+ if (pp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
|
|
|
ca7c20 |
+ if (pp->fast_io_fail == MP_FAST_IO_FAIL_OFF) {
|
|
|
ca7c20 |
condlog(3, "%s: can't switch off fast_io_fail_tmo "
|
|
|
ca7c20 |
"on iSCSI", pp->dev);
|
|
|
ca7c20 |
- } else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO) {
|
|
|
ca7c20 |
+ } else if (pp->fast_io_fail == MP_FAST_IO_FAIL_ZERO) {
|
|
|
ca7c20 |
condlog(3, "%s: can't set fast_io_fail_tmo to '0'"
|
|
|
ca7c20 |
"on iSCSI", pp->dev);
|
|
|
ca7c20 |
} else {
|
|
|
ca7c20 |
- snprintf(value, 11, "%u", mpp->fast_io_fail);
|
|
|
ca7c20 |
+ snprintf(value, 11, "%u", pp->fast_io_fail);
|
|
|
ca7c20 |
if (sysfs_attr_set_value(session_dev, "recovery_tmo",
|
|
|
ca7c20 |
value, strlen(value)) <= 0) {
|
|
|
ca7c20 |
condlog(3, "%s: Failed to set recovery_tmo, "
|
|
|
ca7c20 |
@@ -788,14 +788,14 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
|
|
|
ca7c20 |
static void
|
|
|
ca7c20 |
-sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
+sysfs_set_nexus_loss_tmo(struct path *pp)
|
|
|
ca7c20 |
{
|
|
|
ca7c20 |
struct udev_device *parent, *sas_dev = NULL;
|
|
|
ca7c20 |
const char *end_dev_id = NULL;
|
|
|
ca7c20 |
char value[11];
|
|
|
ca7c20 |
static const char ed_str[] = "end_device-";
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- if (!pp->udev || mpp->dev_loss == DEV_LOSS_TMO_UNSET)
|
|
|
ca7c20 |
+ if (!pp->udev || pp->dev_loss == DEV_LOSS_TMO_UNSET)
|
|
|
ca7c20 |
return;
|
|
|
ca7c20 |
|
|
|
ca7c20 |
for (parent = udev_device_get_parent(pp->udev);
|
|
|
ca7c20 |
@@ -822,8 +822,8 @@ sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no,
|
|
|
ca7c20 |
pp->sg_id.channel, pp->sg_id.scsi_id, end_dev_id);
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- if (mpp->dev_loss != DEV_LOSS_TMO_UNSET) {
|
|
|
ca7c20 |
- snprintf(value, 11, "%u", mpp->dev_loss);
|
|
|
ca7c20 |
+ if (pp->dev_loss != DEV_LOSS_TMO_UNSET) {
|
|
|
ca7c20 |
+ snprintf(value, 11, "%u", pp->dev_loss);
|
|
|
ca7c20 |
if (sysfs_attr_set_value(sas_dev, "I_T_nexus_loss_timeout",
|
|
|
ca7c20 |
value, strlen(value)) <= 0)
|
|
|
ca7c20 |
condlog(3, "%s: failed to update "
|
|
|
ca7c20 |
@@ -835,47 +835,59 @@ sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
|
|
|
ca7c20 |
int
|
|
|
ca7c20 |
-sysfs_set_scsi_tmo (struct multipath *mpp, unsigned int checkint)
|
|
|
ca7c20 |
+sysfs_set_scsi_tmo (struct config *conf, struct multipath *mpp)
|
|
|
ca7c20 |
{
|
|
|
ca7c20 |
struct path *pp;
|
|
|
ca7c20 |
int i;
|
|
|
ca7c20 |
- unsigned int dev_loss_tmo = mpp->dev_loss;
|
|
|
ca7c20 |
- struct path *err_path = NULL;
|
|
|
ca7c20 |
+ unsigned int min_dev_loss = 0;
|
|
|
ca7c20 |
+ bool warn_dev_loss = false;
|
|
|
ca7c20 |
+ bool warn_fast_io_fail = false;
|
|
|
ca7c20 |
|
|
|
ca7c20 |
if (mpp->no_path_retry > 0) {
|
|
|
ca7c20 |
uint64_t no_path_retry_tmo =
|
|
|
ca7c20 |
- (uint64_t)mpp->no_path_retry * checkint;
|
|
|
ca7c20 |
+ (uint64_t)mpp->no_path_retry * conf->checkint;
|
|
|
ca7c20 |
|
|
|
ca7c20 |
if (no_path_retry_tmo > MAX_DEV_LOSS_TMO)
|
|
|
ca7c20 |
- no_path_retry_tmo = MAX_DEV_LOSS_TMO;
|
|
|
ca7c20 |
- if (no_path_retry_tmo > dev_loss_tmo)
|
|
|
ca7c20 |
- dev_loss_tmo = no_path_retry_tmo;
|
|
|
ca7c20 |
- } else if (mpp->no_path_retry == NO_PATH_RETRY_QUEUE) {
|
|
|
ca7c20 |
- dev_loss_tmo = MAX_DEV_LOSS_TMO;
|
|
|
ca7c20 |
- }
|
|
|
ca7c20 |
- if (mpp->dev_loss != DEV_LOSS_TMO_UNSET &&
|
|
|
ca7c20 |
- mpp->dev_loss != dev_loss_tmo) {
|
|
|
ca7c20 |
- condlog(2, "%s: Using dev_loss_tmo=%u instead of %u because of no_path_retry setting",
|
|
|
ca7c20 |
- mpp->alias, dev_loss_tmo, mpp->dev_loss);
|
|
|
ca7c20 |
- mpp->dev_loss = dev_loss_tmo;
|
|
|
ca7c20 |
- }
|
|
|
ca7c20 |
- if (mpp->dev_loss != DEV_LOSS_TMO_UNSET &&
|
|
|
ca7c20 |
- mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET &&
|
|
|
ca7c20 |
- (unsigned int)mpp->fast_io_fail >= mpp->dev_loss) {
|
|
|
ca7c20 |
- condlog(3, "%s: turning off fast_io_fail (%d is not smaller than dev_loss_tmo)",
|
|
|
ca7c20 |
- mpp->alias, mpp->fast_io_fail);
|
|
|
ca7c20 |
- mpp->fast_io_fail = MP_FAST_IO_FAIL_OFF;
|
|
|
ca7c20 |
- }
|
|
|
ca7c20 |
- if (mpp->dev_loss == DEV_LOSS_TMO_UNSET &&
|
|
|
ca7c20 |
- mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET &&
|
|
|
ca7c20 |
- mpp->eh_deadline == EH_DEADLINE_UNSET)
|
|
|
ca7c20 |
- return 0;
|
|
|
ca7c20 |
+ min_dev_loss = MAX_DEV_LOSS_TMO;
|
|
|
ca7c20 |
+ else
|
|
|
ca7c20 |
+ min_dev_loss = no_path_retry_tmo;
|
|
|
ca7c20 |
+ } else if (mpp->no_path_retry == NO_PATH_RETRY_QUEUE)
|
|
|
ca7c20 |
+ min_dev_loss = MAX_DEV_LOSS_TMO;
|
|
|
ca7c20 |
|
|
|
ca7c20 |
vector_foreach_slot(mpp->paths, pp, i) {
|
|
|
ca7c20 |
- if (pp->bus != SYSFS_BUS_SCSI) {
|
|
|
ca7c20 |
- if (!err_path)
|
|
|
ca7c20 |
- err_path = pp;
|
|
|
ca7c20 |
+ select_fast_io_fail(conf, pp);
|
|
|
ca7c20 |
+ select_dev_loss(conf, pp);
|
|
|
ca7c20 |
+ select_eh_deadline(conf, pp);
|
|
|
ca7c20 |
+
|
|
|
ca7c20 |
+ if (pp->dev_loss == DEV_LOSS_TMO_UNSET &&
|
|
|
ca7c20 |
+ pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET &&
|
|
|
ca7c20 |
+ pp->eh_deadline == EH_DEADLINE_UNSET)
|
|
|
ca7c20 |
+ continue;
|
|
|
ca7c20 |
+
|
|
|
ca7c20 |
+ if (pp->bus != SYSFS_BUS_SCSI)
|
|
|
ca7c20 |
+ continue;
|
|
|
ca7c20 |
+
|
|
|
ca7c20 |
+ sysfs_set_eh_deadline(pp);
|
|
|
ca7c20 |
+
|
|
|
ca7c20 |
+ if (pp->dev_loss == DEV_LOSS_TMO_UNSET &&
|
|
|
ca7c20 |
+ pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
|
|
|
ca7c20 |
continue;
|
|
|
ca7c20 |
+
|
|
|
ca7c20 |
+ if (pp->sg_id.proto_id != SCSI_PROTOCOL_FCP &&
|
|
|
ca7c20 |
+ pp->sg_id.proto_id != SCSI_PROTOCOL_ISCSI &&
|
|
|
ca7c20 |
+ pp->sg_id.proto_id != SCSI_PROTOCOL_SAS)
|
|
|
ca7c20 |
+ continue;
|
|
|
ca7c20 |
+
|
|
|
ca7c20 |
+ if (pp->dev_loss != DEV_LOSS_TMO_UNSET &&
|
|
|
ca7c20 |
+ pp->dev_loss < min_dev_loss) {
|
|
|
ca7c20 |
+ warn_dev_loss = true;
|
|
|
ca7c20 |
+ pp->dev_loss = min_dev_loss;
|
|
|
ca7c20 |
+ }
|
|
|
ca7c20 |
+ if (pp->dev_loss != DEV_LOSS_TMO_UNSET &&
|
|
|
ca7c20 |
+ pp->fast_io_fail > 0 &&
|
|
|
ca7c20 |
+ (unsigned int)pp->fast_io_fail >= pp->dev_loss) {
|
|
|
ca7c20 |
+ warn_fast_io_fail = true;
|
|
|
ca7c20 |
+ pp->fast_io_fail = MP_FAST_IO_FAIL_OFF;
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
|
|
|
ca7c20 |
switch (pp->sg_id.proto_id) {
|
|
|
ca7c20 |
@@ -883,25 +895,21 @@ sysfs_set_scsi_tmo (struct multipath *mpp, unsigned int checkint)
|
|
|
ca7c20 |
sysfs_set_rport_tmo(mpp, pp);
|
|
|
ca7c20 |
break;
|
|
|
ca7c20 |
case SCSI_PROTOCOL_ISCSI:
|
|
|
ca7c20 |
- sysfs_set_session_tmo(mpp, pp);
|
|
|
ca7c20 |
+ sysfs_set_session_tmo(pp);
|
|
|
ca7c20 |
break;
|
|
|
ca7c20 |
case SCSI_PROTOCOL_SAS:
|
|
|
ca7c20 |
- sysfs_set_nexus_loss_tmo(mpp, pp);
|
|
|
ca7c20 |
+ sysfs_set_nexus_loss_tmo(pp);
|
|
|
ca7c20 |
break;
|
|
|
ca7c20 |
default:
|
|
|
ca7c20 |
- if (!err_path)
|
|
|
ca7c20 |
- err_path = pp;
|
|
|
ca7c20 |
+ break;
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
- sysfs_set_eh_deadline(mpp, pp);
|
|
|
ca7c20 |
- }
|
|
|
ca7c20 |
-
|
|
|
ca7c20 |
- if (err_path) {
|
|
|
ca7c20 |
- STRBUF_ON_STACK(proto_buf);
|
|
|
ca7c20 |
-
|
|
|
ca7c20 |
- snprint_path_protocol(&proto_buf, err_path);
|
|
|
ca7c20 |
- condlog(2, "%s: setting dev_loss_tmo is unsupported for protocol %s",
|
|
|
ca7c20 |
- mpp->alias, get_strbuf_str(&proto_buf));
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
+ if (warn_dev_loss)
|
|
|
ca7c20 |
+ condlog(2, "%s: Raising dev_loss_tmo to %u because of no_path_retry setting",
|
|
|
ca7c20 |
+ mpp->alias, min_dev_loss);
|
|
|
ca7c20 |
+ if (warn_fast_io_fail)
|
|
|
ca7c20 |
+ condlog(3, "%s: turning off fast_io_fail (not smaller than dev_loss_tmo)",
|
|
|
ca7c20 |
+ mpp->alias);
|
|
|
ca7c20 |
return 0;
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
|
|
|
ca7c20 |
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
|
|
|
ca7c20 |
index a5446b4d..b6eea258 100644
|
|
|
ca7c20 |
--- a/libmultipath/discovery.h
|
|
|
ca7c20 |
+++ b/libmultipath/discovery.h
|
|
|
ca7c20 |
@@ -42,7 +42,7 @@ int alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice,
|
|
|
ca7c20 |
int store_pathinfo (vector pathvec, struct config *conf,
|
|
|
ca7c20 |
struct udev_device *udevice, int flag,
|
|
|
ca7c20 |
struct path **pp_ptr);
|
|
|
ca7c20 |
-int sysfs_set_scsi_tmo (struct multipath *mpp, unsigned int checkint);
|
|
|
ca7c20 |
+int sysfs_set_scsi_tmo (struct config *conf, struct multipath *mpp);
|
|
|
ca7c20 |
int sysfs_get_timeout(const struct path *pp, unsigned int *timeout);
|
|
|
ca7c20 |
int sysfs_get_host_pci_name(const struct path *pp, char *pci_name);
|
|
|
ca7c20 |
int sysfs_get_iscsi_ip_address(const struct path *pp, char *ip_address);
|
|
|
ca7c20 |
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
|
|
|
ca7c20 |
index 677ab9e1..f146fe64 100644
|
|
|
ca7c20 |
--- a/libmultipath/propsel.c
|
|
|
ca7c20 |
+++ b/libmultipath/propsel.c
|
|
|
ca7c20 |
@@ -770,53 +770,53 @@ int select_minio(struct config *conf, struct multipath *mp)
|
|
|
ca7c20 |
return select_minio_bio(conf, mp);
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
|
|
|
ca7c20 |
-int select_fast_io_fail(struct config *conf, struct multipath *mp)
|
|
|
ca7c20 |
+int select_fast_io_fail(struct config *conf, struct path *pp)
|
|
|
ca7c20 |
{
|
|
|
ca7c20 |
const char *origin;
|
|
|
ca7c20 |
STRBUF_ON_STACK(buff);
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- mp_set_ovr(fast_io_fail);
|
|
|
ca7c20 |
- mp_set_hwe(fast_io_fail);
|
|
|
ca7c20 |
- mp_set_conf(fast_io_fail);
|
|
|
ca7c20 |
- mp_set_default(fast_io_fail, DEFAULT_FAST_IO_FAIL);
|
|
|
ca7c20 |
+ pp_set_ovr(fast_io_fail);
|
|
|
ca7c20 |
+ pp_set_hwe(fast_io_fail);
|
|
|
ca7c20 |
+ pp_set_conf(fast_io_fail);
|
|
|
ca7c20 |
+ pp_set_default(fast_io_fail, DEFAULT_FAST_IO_FAIL);
|
|
|
ca7c20 |
out:
|
|
|
ca7c20 |
- print_undef_off_zero(&buff, mp->fast_io_fail);
|
|
|
ca7c20 |
- condlog(3, "%s: fast_io_fail_tmo = %s %s", mp->alias,
|
|
|
ca7c20 |
+ print_undef_off_zero(&buff, pp->fast_io_fail);
|
|
|
ca7c20 |
+ condlog(3, "%s: fast_io_fail_tmo = %s %s", pp->dev,
|
|
|
ca7c20 |
get_strbuf_str(&buff), origin);
|
|
|
ca7c20 |
return 0;
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
|
|
|
ca7c20 |
-int select_dev_loss(struct config *conf, struct multipath *mp)
|
|
|
ca7c20 |
+int select_dev_loss(struct config *conf, struct path *pp)
|
|
|
ca7c20 |
{
|
|
|
ca7c20 |
const char *origin;
|
|
|
ca7c20 |
STRBUF_ON_STACK(buff);
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- mp_set_ovr(dev_loss);
|
|
|
ca7c20 |
- mp_set_hwe(dev_loss);
|
|
|
ca7c20 |
- mp_set_conf(dev_loss);
|
|
|
ca7c20 |
- mp->dev_loss = DEV_LOSS_TMO_UNSET;
|
|
|
ca7c20 |
+ pp_set_ovr(dev_loss);
|
|
|
ca7c20 |
+ pp_set_hwe(dev_loss);
|
|
|
ca7c20 |
+ pp_set_conf(dev_loss);
|
|
|
ca7c20 |
+ pp->dev_loss = DEV_LOSS_TMO_UNSET;
|
|
|
ca7c20 |
return 0;
|
|
|
ca7c20 |
out:
|
|
|
ca7c20 |
- print_dev_loss(&buff, mp->dev_loss);
|
|
|
ca7c20 |
- condlog(3, "%s: dev_loss_tmo = %s %s", mp->alias,
|
|
|
ca7c20 |
+ print_dev_loss(&buff, pp->dev_loss);
|
|
|
ca7c20 |
+ condlog(3, "%s: dev_loss_tmo = %s %s", pp->dev,
|
|
|
ca7c20 |
get_strbuf_str(&buff), origin);
|
|
|
ca7c20 |
return 0;
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
|
|
|
ca7c20 |
-int select_eh_deadline(struct config *conf, struct multipath *mp)
|
|
|
ca7c20 |
+int select_eh_deadline(struct config *conf, struct path *pp)
|
|
|
ca7c20 |
{
|
|
|
ca7c20 |
const char *origin;
|
|
|
ca7c20 |
STRBUF_ON_STACK(buff);
|
|
|
ca7c20 |
|
|
|
ca7c20 |
- mp_set_ovr(eh_deadline);
|
|
|
ca7c20 |
- mp_set_hwe(eh_deadline);
|
|
|
ca7c20 |
- mp_set_conf(eh_deadline);
|
|
|
ca7c20 |
- mp->eh_deadline = EH_DEADLINE_UNSET;
|
|
|
ca7c20 |
+ pp_set_ovr(eh_deadline);
|
|
|
ca7c20 |
+ pp_set_hwe(eh_deadline);
|
|
|
ca7c20 |
+ pp_set_conf(eh_deadline);
|
|
|
ca7c20 |
+ pp->eh_deadline = EH_DEADLINE_UNSET;
|
|
|
ca7c20 |
/* not changing sysfs in default cause, so don't print anything */
|
|
|
ca7c20 |
return 0;
|
|
|
ca7c20 |
out:
|
|
|
ca7c20 |
- print_undef_off_zero(&buff, mp->eh_deadline);
|
|
|
ca7c20 |
- condlog(3, "%s: eh_deadline = %s %s", mp->alias,
|
|
|
ca7c20 |
+ print_undef_off_zero(&buff, pp->eh_deadline);
|
|
|
ca7c20 |
+ condlog(3, "%s: eh_deadline = %s %s", pp->dev,
|
|
|
ca7c20 |
get_strbuf_str(&buff), origin);
|
|
|
ca7c20 |
return 0;
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
diff --git a/libmultipath/propsel.h b/libmultipath/propsel.h
|
|
|
ca7c20 |
index 72a7e33c..152ca44c 100644
|
|
|
ca7c20 |
--- a/libmultipath/propsel.h
|
|
|
ca7c20 |
+++ b/libmultipath/propsel.h
|
|
|
ca7c20 |
@@ -16,9 +16,9 @@ int select_minio(struct config *conf, struct multipath *mp);
|
|
|
ca7c20 |
int select_mode(struct config *conf, struct multipath *mp);
|
|
|
ca7c20 |
int select_uid(struct config *conf, struct multipath *mp);
|
|
|
ca7c20 |
int select_gid(struct config *conf, struct multipath *mp);
|
|
|
ca7c20 |
-int select_fast_io_fail(struct config *conf, struct multipath *mp);
|
|
|
ca7c20 |
-int select_dev_loss(struct config *conf, struct multipath *mp);
|
|
|
ca7c20 |
-int select_eh_deadline(struct config *conf, struct multipath *mp);
|
|
|
ca7c20 |
+int select_fast_io_fail(struct config *conf, struct path *pp);
|
|
|
ca7c20 |
+int select_dev_loss(struct config *conf, struct path *pp);
|
|
|
ca7c20 |
+int select_eh_deadline(struct config *conf, struct path *pp);
|
|
|
ca7c20 |
int select_reservation_key(struct config *conf, struct multipath *mp);
|
|
|
ca7c20 |
int select_retain_hwhandler (struct config *conf, struct multipath * mp);
|
|
|
ca7c20 |
int select_detect_prio(struct config *conf, struct path * pp);
|
|
|
ca7c20 |
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
|
|
|
ca7c20 |
index d20e1eea..acd4cbeb 100644
|
|
|
ca7c20 |
--- a/libmultipath/structs.c
|
|
|
ca7c20 |
+++ b/libmultipath/structs.c
|
|
|
ca7c20 |
@@ -246,7 +246,6 @@ alloc_multipath (void)
|
|
|
ca7c20 |
mpp->bestpg = 1;
|
|
|
ca7c20 |
mpp->mpcontext = NULL;
|
|
|
ca7c20 |
mpp->no_path_retry = NO_PATH_RETRY_UNDEF;
|
|
|
ca7c20 |
- mpp->fast_io_fail = MP_FAST_IO_FAIL_UNSET;
|
|
|
ca7c20 |
dm_multipath_to_gen(mpp)->ops = &dm_gen_multipath_ops;
|
|
|
ca7c20 |
}
|
|
|
ca7c20 |
return mpp;
|
|
|
ca7c20 |
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
|
|
|
ca7c20 |
index 618ff4fb..8a07d470 100644
|
|
|
ca7c20 |
--- a/libmultipath/structs.h
|
|
|
ca7c20 |
+++ b/libmultipath/structs.h
|
|
|
ca7c20 |
@@ -340,6 +340,9 @@ struct path {
|
|
|
ca7c20 |
int marginal;
|
|
|
ca7c20 |
int vpd_vendor_id;
|
|
|
ca7c20 |
int recheck_wwid;
|
|
|
ca7c20 |
+ int fast_io_fail;
|
|
|
ca7c20 |
+ unsigned int dev_loss;
|
|
|
ca7c20 |
+ int eh_deadline;
|
|
|
ca7c20 |
/* configlet pointers */
|
|
|
ca7c20 |
vector hwe;
|
|
|
ca7c20 |
struct gen_path generic_path;
|
|
|
ca7c20 |
@@ -367,7 +370,6 @@ struct multipath {
|
|
|
ca7c20 |
int minio;
|
|
|
ca7c20 |
int flush_on_last_del;
|
|
|
ca7c20 |
int attribute_flags;
|
|
|
ca7c20 |
- int fast_io_fail;
|
|
|
ca7c20 |
int retain_hwhandler;
|
|
|
ca7c20 |
int deferred_remove;
|
|
|
ca7c20 |
bool in_recovery;
|
|
|
ca7c20 |
@@ -385,8 +387,6 @@ struct multipath {
|
|
|
ca7c20 |
int needs_paths_uevent;
|
|
|
ca7c20 |
int ghost_delay;
|
|
|
ca7c20 |
int ghost_delay_tick;
|
|
|
ca7c20 |
- unsigned int dev_loss;
|
|
|
ca7c20 |
- int eh_deadline;
|
|
|
ca7c20 |
uid_t uid;
|
|
|
ca7c20 |
gid_t gid;
|
|
|
ca7c20 |
mode_t mode;
|