[dm-devel] [PATCH v2 2/4] libmultipath: make checker_timeout a path variable
Benjamin Marzinski
bmarzins at redhat.com
Thu Aug 31 21:57:10 UTC 2023
Factor the code to get the checker_timeout out of select_checker() into
its own select_checker_timeout function, and use that to set a path
variable. This variable will be used by future patches.
Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
---
libmultipath/propsel.c | 33 ++++++++++++++++++++-------------
libmultipath/structs.c | 1 +
libmultipath/structs.h | 1 +
3 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index df10a68f..91a59880 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -628,6 +628,23 @@ out:
return 0;
}
+
+int select_checker_timeout(struct config *conf, struct path *pp)
+{
+ const char *origin;
+
+ pp_set_conf(checker_timeout);
+ if (sysfs_get_timeout(pp, &pp->checker_timeout) > 0) {
+ origin = "(setting: kernel sysfs)";
+ goto out;
+ }
+ pp_set_default(checker_timeout, DEF_TIMEOUT);
+out:
+ condlog(3, "%s checker timeout = %u s %s", pp->dev, pp->checker_timeout,
+ origin);
+ return 0;
+}
+
/*
* Current RDAC (NetApp E/EF Series) firmware relies
* on periodic REPORT TARGET PORT GROUPS for
@@ -664,6 +681,8 @@ int select_checker(struct config *conf, struct path *pp)
char *ckr_name;
struct checker * c = &pp->checker;
+ if (!pp->checker_timeout)
+ select_checker_timeout(conf, pp);
if (pp->detect_checker == DETECT_CHECKER_ON) {
origin = autodetect_origin;
if (check_rdac(pp)) {
@@ -684,19 +703,7 @@ out:
checker_get(c, ckr_name);
condlog(3, "%s: path_checker = %s %s", pp->dev,
checker_name(c), origin);
- if (conf->checker_timeout) {
- c->timeout = conf->checker_timeout;
- condlog(3, "%s: checker timeout = %u s %s",
- pp->dev, c->timeout, conf_origin);
- }
- else if (sysfs_get_timeout(pp, &c->timeout) > 0)
- condlog(3, "%s: checker timeout = %u s (setting: kernel sysfs)",
- pp->dev, c->timeout);
- else {
- c->timeout = DEF_TIMEOUT;
- condlog(3, "%s: checker timeout = %u s %s",
- pp->dev, c->timeout, default_origin);
- }
+ c->timeout = pp->checker_timeout;
return 0;
}
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 39504dca..1b305fd1 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -147,6 +147,7 @@ uninitialize_path(struct path *pp)
pp->dmstate = PSTATE_UNDEF;
pp->uid_attribute = NULL;
+ pp->checker_timeout = 0;
if (checker_selected(&pp->checker))
checker_put(&pp->checker);
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 97f9de5a..17e13ee7 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -383,6 +383,7 @@ struct path {
int eh_deadline;
bool is_checked;
bool can_use_env_uid;
+ unsigned int checker_timeout;
/* configlet pointers */
vector hwe;
struct gen_path generic_path;
--
2.17.2
More information about the dm-devel
mailing list