From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Thu, 22 Jul 2021 17:48:06 -0500 Subject: [PATCH] mpathpersist: fail commands when no usable paths exist "mpathpersist -oCK " will return success if it is run on devices with no usable paths, but nothing is actually done. The -L command will fail, but it should give up sooner, and with a more helpful error message. Signed-off-by: Benjamin Marzinski --- libmpathpersist/mpath_persist.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c index 07a5f17f..d0744773 100644 --- a/libmpathpersist/mpath_persist.c +++ b/libmpathpersist/mpath_persist.c @@ -629,7 +629,8 @@ int mpath_prout_common(struct multipath *mpp,int rq_servact, int rq_scope, return ret ; } } - return MPATH_PR_SUCCESS; + condlog (0, "%s: no path available", mpp->wwid); + return MPATH_PR_DMMP_ERROR; } int send_prout_activepath(char * dev, int rq_servact, int rq_scope, @@ -688,6 +689,11 @@ int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope, active_pathcount = pathcount (mpp, PATH_UP) + pathcount (mpp, PATH_GHOST); + if (active_pathcount == 0) { + condlog (0, "%s: no path available", mpp->wwid); + return MPATH_PR_DMMP_ERROR; + } + struct threadinfo thread[active_pathcount]; memset(thread, 0, sizeof(thread)); for (i = 0; i < active_pathcount; i++){