Blame SOURCES/0167-RHBZ-1335176-fix-show-cmds.patch

c896fb
---
c896fb
 libmultipath/print.c       |    7 +++++++
c896fb
 libmultipath/structs.h     |    1 +
c896fb
 libmultipath/structs_vec.c |   24 ++++++++++++++----------
c896fb
 multipathd/cli_handlers.c  |   11 ++++++++++-
c896fb
 multipathd/main.c          |    2 ++
c896fb
 5 files changed, 34 insertions(+), 11 deletions(-)
c896fb
c896fb
Index: multipath-tools-130222/libmultipath/print.c
c896fb
===================================================================
c896fb
--- multipath-tools-130222.orig/libmultipath/print.c
c896fb
+++ multipath-tools-130222/libmultipath/print.c
c896fb
@@ -248,6 +248,12 @@ snprint_q_timeouts (char * buff, size_t
c896fb
 }
c896fb
 
c896fb
 static int
c896fb
+snprint_map_failures (char * buff, size_t len, struct multipath * mpp)
c896fb
+{
c896fb
+	return snprint_uint(buff, len, mpp->stat_map_failures);
c896fb
+}
c896fb
+
c896fb
+static int
c896fb
 snprint_multipath_uuid (char * buff, size_t len, struct multipath * mpp)
c896fb
 {
c896fb
 	return snprint_str(buff, len, mpp->wwid);
c896fb
@@ -546,6 +552,7 @@ struct multipath_data mpd[] = {
c896fb
 	{'t', "dm-st",         0, snprint_dm_map_state},
c896fb
 	{'S', "size",          0, snprint_multipath_size},
c896fb
 	{'f', "features",      0, snprint_features},
c896fb
+	{'x', "failures",      0, snprint_map_failures},
c896fb
 	{'h', "hwhandler",     0, snprint_hwhandler},
c896fb
 	{'A', "action",        0, snprint_action},
c896fb
 	{'0', "path_faults",   0, snprint_path_faults},
c896fb
Index: multipath-tools-130222/libmultipath/structs.h
c896fb
===================================================================
c896fb
--- multipath-tools-130222.orig/libmultipath/structs.h
c896fb
+++ multipath-tools-130222/libmultipath/structs.h
c896fb
@@ -270,6 +270,7 @@ struct multipath {
c896fb
 	unsigned int stat_map_loads;
c896fb
 	unsigned int stat_total_queueing_time;
c896fb
 	unsigned int stat_queueing_timeouts;
c896fb
+	unsigned int stat_map_failures;
c896fb
 
c896fb
 	/* checkers shared data */
c896fb
 	void * mpcontext;
c896fb
Index: multipath-tools-130222/libmultipath/structs_vec.c
c896fb
===================================================================
c896fb
--- multipath-tools-130222.orig/libmultipath/structs_vec.c
c896fb
+++ multipath-tools-130222/libmultipath/structs_vec.c
c896fb
@@ -579,16 +579,20 @@ int update_multipath (struct vectors *ve
c896fb
  */
c896fb
 void update_queue_mode_del_path(struct multipath *mpp)
c896fb
 {
c896fb
-	if (--mpp->nr_active == 0 && mpp->no_path_retry > 0) {
c896fb
-		/*
c896fb
-		 * Enter retry mode.
c896fb
-		 * meaning of +1: retry_tick may be decremented in
c896fb
-		 *                checkerloop before starting retry.
c896fb
-		 */
c896fb
-		mpp->stat_queueing_timeouts++;
c896fb
-		mpp->retry_tick = mpp->no_path_retry * conf->checkint + 1;
c896fb
-		condlog(1, "%s: Entering recovery mode: max_retries=%d",
c896fb
-			mpp->alias, mpp->no_path_retry);
c896fb
+	if (--mpp->nr_active == 0) {
c896fb
+		if (mpp->no_path_retry > 0) {
c896fb
+			/*
c896fb
+			 * Enter retry mode.
c896fb
+			 * meaning of +1: retry_tick may be decremented in
c896fb
+			 *                checkerloop before starting retry.
c896fb
+			 */
c896fb
+			mpp->stat_queueing_timeouts++;
c896fb
+			mpp->retry_tick = mpp->no_path_retry *
c896fb
+					  conf->checkint + 1;
c896fb
+			condlog(1, "%s: Entering recovery mode: max_retries=%d",
c896fb
+				mpp->alias, mpp->no_path_retry);
c896fb
+		} else if (mpp->no_path_retry != NO_PATH_RETRY_QUEUE)
c896fb
+			mpp->stat_map_failures++;
c896fb
 	}
c896fb
 	condlog(2, "%s: remaining active paths: %d", mpp->alias, mpp->nr_active);
c896fb
 }
c896fb
Index: multipath-tools-130222/multipathd/cli_handlers.c
c896fb
===================================================================
c896fb
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
c896fb
+++ multipath-tools-130222/multipathd/cli_handlers.c
c896fb
@@ -319,9 +319,14 @@ show_maps (char ** r, int *len, struct v
c896fb
 			c += snprint_multipath_header(c, reply + maxlen - c,
c896fb
 						      style);
c896fb
 
c896fb
-		vector_foreach_slot(vecs->mpvec, mpp, i)
c896fb
+		vector_foreach_slot(vecs->mpvec, mpp, i) {
c896fb
+			if (update_multipath(vecs, mpp->alias, 0)) {
c896fb
+				i--;
c896fb
+				continue;
c896fb
+			}
c896fb
 			c += snprint_multipath(c, reply + maxlen - c,
c896fb
 					       style, mpp, pretty);
c896fb
+		}
c896fb
 
c896fb
 		again = ((c - reply) == (maxlen - 1));
c896fb
 
c896fb
@@ -742,6 +747,8 @@ cli_disable_queueing(void *v, char **rep
c896fb
 		return 1;
c896fb
 	}
c896fb
 
c896fb
+	if (mpp->nr_active == 0)
c896fb
+		mpp->stat_map_failures++;
c896fb
 	mpp->retry_tick = 0;
c896fb
 	dm_queue_if_no_path(mpp->alias, 0);
c896fb
 	return 0;
c896fb
@@ -756,6 +763,8 @@ cli_disable_all_queueing(void *v, char *
c896fb
 
c896fb
 	condlog(2, "disable queueing (operator)");
c896fb
 	vector_foreach_slot(vecs->mpvec, mpp, i) {
c896fb
+		if (mpp->nr_active == 0)
c896fb
+			mpp->stat_map_failures++;
c896fb
 		mpp->retry_tick = 0;
c896fb
 		dm_queue_if_no_path(mpp->alias, 0);
c896fb
 	}
c896fb
Index: multipath-tools-130222/multipathd/main.c
c896fb
===================================================================
c896fb
--- multipath-tools-130222.orig/multipathd/main.c
c896fb
+++ multipath-tools-130222/multipathd/main.c
c896fb
@@ -716,6 +716,7 @@ ev_remove_path (struct path *pp, struct
c896fb
 				mpp->retry_tick = 0;
c896fb
 				mpp->no_path_retry = NO_PATH_RETRY_FAIL;
c896fb
 				mpp->flush_on_last_del = FLUSH_IN_PROGRESS;
c896fb
+				mpp->stat_map_failures++;
c896fb
 				dm_queue_if_no_path(mpp->alias, 0);
c896fb
 			}
c896fb
 			if (!flush_map(mpp, vecs, 1)) {
c896fb
@@ -1197,6 +1198,7 @@ retry_count_tick(vector mpvec)
c896fb
 			mpp->stat_total_queueing_time++;
c896fb
 			condlog(4, "%s: Retrying.. No active path", mpp->alias);
c896fb
 			if(--mpp->retry_tick == 0) {
c896fb
+				mpp->stat_map_failures++;
c896fb
 				dm_queue_if_no_path(mpp->alias, 0);
c896fb
 				condlog(2, "%s: Disable queueing", mpp->alias);
c896fb
 			}