On Mon, Nov 25, 2024 at 03:32:23PM +0100, Martin Wilck wrote:
> pathcmp() makes sure that all paths in pgp have a match in cpgp, but not
> vice-versa. Check the number of paths, too.
This looks fine. But looking at it made we a nervous about cpgp->id. We
only calculate that in pgcmp() (and just for mpp, not cmpp) and in
disassemble_map(). But we clearly can have pathgroup changes after that,
as the last patch has shown. To be safe, we should either skip the whole
pgp->id thing (it's not a huge time savings) or recalculate it for all
of cmpp's path groups before we start the loops in pgcmp().
-Ben
>
> Fixes: 90773ba ("libmultipath: resolve hash collisions in pgcmp()")
> Signed-off-by: Martin Wilck <[email protected]>
> ---
> libmultipath/configure.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/libmultipath/configure.c b/libmultipath/configure.c
> index d0e9c95..55140d0 100644
> --- a/libmultipath/configure.c
> +++ b/libmultipath/configure.c
> @@ -442,6 +442,7 @@ pgcmp (struct multipath * mpp, struct multipath * cmpp)
>
> vector_foreach_slot (cmpp->pg, cpgp, j) {
> if (pgp->id == cpgp->id &&
> + VECTOR_SIZE(pgp->paths) == VECTOR_SIZE(cpgp->paths)
> &&
> !pathcmp(pgp, cpgp)) {
> r = 0;
> break;
> --
> 2.47.0