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

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