From: Martin Wilck <mwilck@xxxxxxxx> Make sure that pp->mpp is only set for paths that have been successfully added to mpp->paths. Suggested-by: Benjamin Marzinki <bmarzins@xxxxxxxxxx> Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- libmultipath/structs_vec.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 2d85df9..cc2dafa 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -248,14 +248,10 @@ int adopt_paths(vector pathvec, struct multipath *mpp) pp->dev, mpp->alias); continue; } - pp->mpp = mpp; if (pp->initialized == INIT_REMOVED) continue; - condlog(3, "%s: ownership set to %s", - pp->dev, mpp->alias); - if (!mpp->paths && !(mpp->paths = vector_alloc())) - return 1; + goto err; conf = get_multipath_config(); pthread_cleanup_push(put_multipath_config, conf); @@ -270,10 +266,17 @@ int adopt_paths(vector pathvec, struct multipath *mpp) if (!find_path_by_devt(mpp->paths, pp->dev_t) && store_path(mpp->paths, pp)) - return 1; + goto err; + + pp->mpp = mpp; + condlog(3, "%s: ownership set to %s", + pp->dev, mpp->alias); } } return 0; +err: + condlog(1, "error setting ownership of %s to %s", pp->dev, mpp->alias); + return 1; } void orphan_path(struct path *pp, const char *reason) -- 2.28.0 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel