libmultipath: restore PG prio in update_multipath_strings
authorMartin Wilck <mwilck@suse.com>
Sun, 23 Dec 2018 22:21:16 +0000 (23:21 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Mon, 7 Jan 2019 10:46:29 +0000 (11:46 +0100)
update_multipath_strings() destroys and recreates the
pathgroup vector. This wipes information previously
stored. Restore the path group priorities.

Fixes: efc7407bed65 "libmultipath: don't update path groups when
 printing"
Signed-off-by: Martin Wilck <mwilck@suse.com>
libmultipath/structs_vec.c

index 03e2b97..db5d19d 100644 (file)
@@ -18,6 +18,7 @@
 #include "configure.h"
 #include "libdevmapper.h"
 #include "io_err_stat.h"
+#include "switchgroup.h"
 
 /*
  * creates or updates mpp->paths reading mpp->pg
@@ -261,6 +262,9 @@ void sync_paths(struct multipath *mpp, vector pathvec)
 int
 update_multipath_strings(struct multipath *mpp, vector pathvec, int is_daemon)
 {
+       struct pathgroup *pgp;
+       int i;
+
        if (!mpp)
                return 1;
 
@@ -278,6 +282,10 @@ update_multipath_strings(struct multipath *mpp, vector pathvec, int is_daemon)
        if (update_multipath_status(mpp))
                return 1;
 
+       vector_foreach_slot(mpp->pg, pgp, i)
+               if (pgp->paths)
+                       path_group_prio_update(pgp);
+
        return 0;
 }