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

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