From: Benjamin Marzinski <bmarzins@xxxxxxxxxx> If a partial path appears and is not fully initialized within 180 seconds, trigger a uevent. If the udev device is not initialized trigger an add event. Otherwise, trigger a change event. Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> Reviewed-by: Martin Wilck <mwilck@xxxxxxxx> Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- libmultipath/libmultipath.version | 2 +- libmultipath/structs.h | 1 + libmultipath/structs_vec.c | 1 + multipathd/main.c | 20 ++++++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version index 4f6fa1d..5a3ba4e 100644 --- a/libmultipath/libmultipath.version +++ b/libmultipath/libmultipath.version @@ -31,7 +31,7 @@ * The new version inherits the previous ones. */ -LIBMULTIPATH_11.0.0 { +LIBMULTIPATH_12.0.0 { global: /* symbols referenced by multipath and multipathd */ add_foreign; diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 69409fd..c21d1ed 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -318,6 +318,7 @@ struct path { int fd; int initialized; int retriggers; + int partial_retrigger_delay; unsigned int path_failures; time_t dis_reinstate_time; int disable_reinstate; diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 1de9175..9b6407b 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -195,6 +195,7 @@ bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, condlog(2, "%s: adding new path %s", mpp->alias, pp->dev); pp->initialized = INIT_PARTIAL; + pp->partial_retrigger_delay = 180; store_path(pathvec, pp); pp->tick = 1; } diff --git a/multipathd/main.c b/multipathd/main.c index 828d229..bffafe9 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1949,6 +1949,25 @@ retry_count_tick(vector mpvec) } } +static void +partial_retrigger_tick(vector pathvec) +{ + struct path *pp; + unsigned int i; + + vector_foreach_slot (pathvec, pp, i) { + if (pp->initialized == INIT_PARTIAL && pp->udev && + pp->partial_retrigger_delay > 0 && + --pp->partial_retrigger_delay == 0) { + const char *msg = udev_device_get_is_initialized(pp->udev) ? + "change" : "add"; + + sysfs_attr_set_value(pp->udev, "uevent", msg, + strlen(msg)); + } + } +} + int update_prio(struct path *pp, int refresh_all) { int oldpriority; @@ -2567,6 +2586,7 @@ checkerloop (void *ap) retry_count_tick(vecs->mpvec); missing_uev_wait_tick(vecs); ghost_delay_tick(vecs); + partial_retrigger_tick(vecs->pathvec); lock_cleanup_pop(vecs->lock); if (count) -- 2.33.1 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel