I'm not sure why we ever did this. We have update_mpp_paths() and sync_paths() now, which make sure that mpp->paths and mpp->pg are as synced as possible.
Signed-off-by: Martin Wilck <[email protected]> --- libmultipath/pgpolicies.c | 2 -- tests/pgpolicy.c | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libmultipath/pgpolicies.c b/libmultipath/pgpolicies.c index 57b7485..92f84c7 100644 --- a/libmultipath/pgpolicies.c +++ b/libmultipath/pgpolicies.c @@ -158,8 +158,6 @@ int group_paths(struct multipath *mp, int marginal_pathgroups) } sort_pathgroups(mp); out: - vector_free(mp->paths); - mp->paths = NULL; return 0; fail_marginal: vector_free(normal); diff --git a/tests/pgpolicy.c b/tests/pgpolicy.c index aec16ec..a37aa8e 100644 --- a/tests/pgpolicy.c +++ b/tests/pgpolicy.c @@ -131,6 +131,8 @@ static int setup_null(void **state) static int teardownX(struct multipath *mp) { + vector_free(mp->paths); + mp->paths = NULL; free_pgvec(mp->pg); mp->pg = NULL; return 0; @@ -165,10 +167,9 @@ static void verify_pathgroups(struct multipath *mp, struct path *pp, int **groups, int *group_size, int *marginal, int size) { - int i, j; + int i, j, sum = 0; struct pathgroup *pgp; - assert_null(mp->paths); assert_non_null(mp->pg); assert_int_equal(VECTOR_SIZE(mp->pg), size); for (i = 0; i < size; i++) { @@ -176,6 +177,7 @@ verify_pathgroups(struct multipath *mp, struct path *pp, int **groups, assert_non_null(pgp); assert_non_null(pgp->paths); assert_int_equal(VECTOR_SIZE(pgp->paths), group_size[i]); + sum += group_size[i]; if (marginal) assert_int_equal(pgp->marginal, marginal[i]); else @@ -192,6 +194,7 @@ verify_pathgroups(struct multipath *mp, struct path *pp, int **groups, assert_ptr_equal(pgp_path, pp_path); } } + assert_int_equal(sum, VECTOR_SIZE(mp->paths)); } static void test_one_group8(void **state) -- 2.52.0
