58 lines
2.0 KiB
Diff
58 lines
2.0 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Martin Wilck <mwilck@suse.com>
|
||
|
Date: Tue, 2 Feb 2021 11:12:21 +0100
|
||
|
Subject: [PATCH] libmultipath: check if adopt_path() really added current path
|
||
|
|
||
|
The description of 2d32d6f ("libmultipath: adopt_paths(): don't bail out on
|
||
|
single path failure") said "we need to check after successful call to
|
||
|
adopt_paths() if that specific path had been actually added, and fail in the
|
||
|
caller otherwise". But the commit failed to actually implement this check.
|
||
|
Instead, it just checked if the path was member of the pathvec, which will
|
||
|
almost always be the case.
|
||
|
|
||
|
Fix it by checking what actually needs to be checked, membership of the
|
||
|
path to be added in mpp->paths.
|
||
|
|
||
|
Fixes: 2d32d6f ("libmultipath: adopt_paths(): don't bail out on single path failure")
|
||
|
|
||
|
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||
|
---
|
||
|
libmultipath/structs_vec.c | 4 ++--
|
||
|
multipathd/main.c | 4 ++--
|
||
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
|
||
|
index f7f45f11..47b1d03e 100644
|
||
|
--- a/libmultipath/structs_vec.c
|
||
|
+++ b/libmultipath/structs_vec.c
|
||
|
@@ -707,8 +707,8 @@ struct multipath *add_map_with_path(struct vectors *vecs, struct path *pp,
|
||
|
goto out;
|
||
|
mpp->size = pp->size;
|
||
|
|
||
|
- if (adopt_paths(vecs->pathvec, mpp) ||
|
||
|
- find_slot(vecs->pathvec, pp) == -1)
|
||
|
+ if (adopt_paths(vecs->pathvec, mpp) || pp->mpp != mpp ||
|
||
|
+ find_slot(mpp->paths, pp) == -1)
|
||
|
goto out;
|
||
|
|
||
|
if (add_vec) {
|
||
|
diff --git a/multipathd/main.c b/multipathd/main.c
|
||
|
index 6f851ae8..43d77688 100644
|
||
|
--- a/multipathd/main.c
|
||
|
+++ b/multipathd/main.c
|
||
|
@@ -1008,8 +1008,8 @@ rescan:
|
||
|
if (mpp) {
|
||
|
condlog(4,"%s: adopting all paths for path %s",
|
||
|
mpp->alias, pp->dev);
|
||
|
- if (adopt_paths(vecs->pathvec, mpp) ||
|
||
|
- find_slot(vecs->pathvec, pp) == -1)
|
||
|
+ if (adopt_paths(vecs->pathvec, mpp) || pp->mpp != mpp ||
|
||
|
+ find_slot(mpp->paths, pp) == -1)
|
||
|
goto fail; /* leave path added to pathvec */
|
||
|
|
||
|
verify_paths(mpp);
|
||
|
--
|
||
|
2.17.2
|
||
|
|