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

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