Blame SOURCES/0074-mpathpersist-fail-commands-when-no-usable-paths-exis.patch

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