--- multipathd/main.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) Index: multipath-tools/multipathd/main.c =================================================================== --- multipath-tools.orig/multipathd/main.c +++ multipath-tools/multipathd/main.c @@ -48,6 +48,7 @@ #include #include #include +#include #include "main.h" #include "pidfile.h" @@ -911,10 +912,33 @@ retry_count_tick(vector mpvec) } } +int update_path_groups(struct multipath *mpp, struct vectors *vecs) +{ + int i; + struct path * pp; + + update_mpp_paths(mpp, vecs->pathvec); + vector_foreach_slot (mpp->paths, pp, i) + pathinfo(pp, conf->hwtable, DI_PRIO); + setup_map(mpp); + mpp->action = ACT_RELOAD; + if (domap(mpp) <= 0) { + condlog(0, "%s: failed to update map : %s", mpp->alias, + strerror(errno)); + return 1; + } + dm_lib_release(); + setup_multipath(vecs, mpp); + sync_map_state(mpp); + + return 0; +} + void check_path (struct vectors * vecs, struct path * pp) { int newstate; + int oldpriority; if (!pp->mpp) return; @@ -1024,12 +1048,12 @@ check_path (struct vectors * vecs, struc * path prio refreshing */ condlog(4, "path prio refresh"); + oldpriority = pp->priority; pathinfo(pp, conf->hwtable, DI_PRIO); - - /* - * pathgroup failback policy - */ - if (need_switch_pathgroup(pp->mpp, 0)) { + if (pp->priority != oldpriority && + pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio) + update_path_groups(pp->mpp, vecs); + else if (need_switch_pathgroup(pp->mpp, 0)) { if (pp->mpp->pgfailback > 0 && pp->mpp->failback_tick <= 0) pp->mpp->failback_tick =