2 libmultipath/pgpolicies.c | 23 +++++++++++++++++++----
3 1 file changed, 19 insertions(+), 4 deletions(-)
5 Index: multipath-tools/libmultipath/pgpolicies.c
6 ===================================================================
7 --- multipath-tools.orig/libmultipath/pgpolicies.c
8 +++ multipath-tools/libmultipath/pgpolicies.c
9 @@ -205,7 +205,8 @@ out:
11 one_path_per_group (struct multipath * mp)
17 struct pathgroup * pgp;
19 @@ -217,16 +218,30 @@ one_path_per_group (struct multipath * m
21 for (i = 0; i < VECTOR_SIZE(mp->paths); i++) {
22 pp = VECTOR_SLOT(mp->paths, i);
23 + prio = pp->priority;
25 + vector_foreach_slot(mp->pg, pgp, j) {
26 + pp = VECTOR_SLOT(pgp->paths, 0);
28 + if (prio > pp->priority)
32 pgp = alloc_pathgroup();
37 - if (store_pathgroup(mp->pg, pgp))
38 + if (store_path(pgp->paths, VECTOR_SLOT(mp->paths, i)))
41 - if (store_path(pgp->paths, pp))
43 + if (j < VECTOR_SIZE(mp->pg)) {
44 + if (!vector_insert_slot(mp->pg, j, pgp))
47 + if (store_pathgroup(mp->pg, pgp))
51 free_pathvec(mp->paths, KEEP_PATHS);