Instead of remembering pp->mpp and setting it back after orphan_path(), create a variant orphan_path__() that keeps pp->mpp set. The name of this function is kind of misleading, but keep it as the main caller is still orphan_path(), and we want to keep the well-known message.
Signed-off-by: Martin Wilck <[email protected]> --- libmultipath/structs_vec.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 434b57c..8d4fc69 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -369,13 +369,18 @@ err: return 1; } -void orphan_path(struct path *pp, const char *reason) +static void orphan_path__(struct path *pp, const char *reason) { condlog(3, "%s: orphan path, %s", pp->dev, reason); - pp->mpp = NULL; uninitialize_path(pp); } +void orphan_path(struct path *pp, const char *reason) +{ + pp->mpp = NULL; + orphan_path__(pp, reason); +} + static void orphan_paths(vector pathvec, struct multipath *mpp, const char *reason) { int i; @@ -393,16 +398,13 @@ static void orphan_paths(vector pathvec, struct multipath *mpp, const char *reas void set_path_removed(struct path *pp) { - struct multipath *mpp = pp->mpp; - - orphan_path(pp, "removed"); /* * Keep link to mpp. It will be removed when the path * is successfully removed from the map. */ - if (!mpp) + if (!pp->mpp) condlog(0, "%s: internal error: mpp == NULL", pp->dev); - pp->mpp = mpp; + orphan_path__(pp, "removed"); pp->initialized = INIT_REMOVED; } -- 2.52.0
