From patchwork Sat Oct 29 02:55:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 9404371 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 134C760586 for ; Sun, 30 Oct 2016 08:38:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 018482903D for ; Sun, 30 Oct 2016 08:38:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA0B52903F; Sun, 30 Oct 2016 08:38:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7EE8F2903D for ; Sun, 30 Oct 2016 08:38:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9U8aIMe019316; Sun, 30 Oct 2016 04:36:18 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9T2tZ8F026562 for ; Fri, 28 Oct 2016 22:55:35 -0400 Received: from redhat.com (octiron.msp.redhat.com [10.15.80.209]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u9T2tXD2031782; Fri, 28 Oct 2016 22:55:34 -0400 Received: by redhat.com (sSMTP sendmail emulation); Fri, 28 Oct 2016 21:55:33 -0500 From: "Benjamin Marzinski" To: device-mapper development Date: Fri, 28 Oct 2016 21:55:20 -0500 Message-Id: <1477709726-5442-5-git-send-email-bmarzins@redhat.com> In-Reply-To: <1477709726-5442-1-git-send-email-bmarzins@redhat.com> References: <1477709726-5442-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 04/10] multipathd: add "map failures" format wildcard X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a new wildcard, 'x', for the "show maps format" command. This wildcard show the number of map failures that have occurred. A map failure is any time that the multipath device enters a state where it has no paths and is not set to queue_if_no_paths. It can be used to see if a multipath device was ever in a state were it could fail IO errors up. Signed-off-by: Benjamin Marzinski Reviewed-by: Hannes Reinecke --- libmultipath/print.c | 7 +++++++ libmultipath/structs.h | 1 + libmultipath/structs_vec.c | 28 ++++++++++++++++------------ multipathd/cli_handlers.c | 11 ++++++++++- multipathd/main.c | 2 ++ 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/libmultipath/print.c b/libmultipath/print.c index 9aa41ad..f626dc5 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -245,6 +245,12 @@ snprint_q_timeouts (char * buff, size_t len, struct multipath * mpp) } static int +snprint_map_failures (char * buff, size_t len, struct multipath * mpp) +{ + return snprint_uint(buff, len, mpp->stat_map_failures); +} + +static int snprint_multipath_uuid (char * buff, size_t len, struct multipath * mpp) { return snprint_str(buff, len, mpp->wwid); @@ -619,6 +625,7 @@ struct multipath_data mpd[] = { {'t', "dm-st", 0, snprint_dm_map_state}, {'S', "size", 0, snprint_multipath_size}, {'f', "features", 0, snprint_features}, + {'x', "failures", 0, snprint_map_failures}, {'h', "hwhandler", 0, snprint_hwhandler}, {'A', "action", 0, snprint_action}, {'0', "path_faults", 0, snprint_path_faults}, diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 2078413..3a716d8 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -277,6 +277,7 @@ struct multipath { unsigned int stat_map_loads; unsigned int stat_total_queueing_time; unsigned int stat_queueing_timeouts; + unsigned int stat_map_failures; /* checkers shared data */ void * mpcontext; diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index a0c8869..e898528 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -610,19 +610,23 @@ int update_multipath (struct vectors *vecs, char *mapname, int reset) */ void update_queue_mode_del_path(struct multipath *mpp) { - if (--mpp->nr_active == 0 && mpp->no_path_retry > 0) { - struct config *conf = get_multipath_config(); + if (--mpp->nr_active == 0) { + if (mpp->no_path_retry > 0) { + struct config *conf = get_multipath_config(); - /* - * Enter retry mode. - * meaning of +1: retry_tick may be decremented in - * checkerloop before starting retry. - */ - mpp->stat_queueing_timeouts++; - mpp->retry_tick = mpp->no_path_retry * conf->checkint + 1; - condlog(1, "%s: Entering recovery mode: max_retries=%d", - mpp->alias, mpp->no_path_retry); - put_multipath_config(conf); + /* + * Enter retry mode. + * meaning of +1: retry_tick may be decremented in + * checkerloop before starting retry. + */ + mpp->stat_queueing_timeouts++; + mpp->retry_tick = mpp->no_path_retry * + conf->checkint + 1; + condlog(1, "%s: Entering recovery mode: max_retries=%d", + mpp->alias, mpp->no_path_retry); + put_multipath_config(conf); + } else if (mpp->no_path_retry != NO_PATH_RETRY_QUEUE) + mpp->stat_map_failures++; } condlog(2, "%s: remaining active paths: %d", mpp->alias, mpp->nr_active); } diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index 181b2b8..b0eeca6 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -498,9 +498,14 @@ show_maps (char ** r, int *len, struct vectors * vecs, char * style, c += snprint_multipath_header(c, reply + maxlen - c, style); - vector_foreach_slot(vecs->mpvec, mpp, i) + vector_foreach_slot(vecs->mpvec, mpp, i) { + if (update_multipath(vecs, mpp->alias, 0)) { + i--; + continue; + } c += snprint_multipath(c, reply + maxlen - c, style, mpp, pretty); + } again = ((c - reply) == (maxlen - 1)); @@ -997,6 +1002,8 @@ cli_disable_queueing(void *v, char **reply, int *len, void *data) return 1; } + if (mpp->nr_active == 0) + mpp->stat_map_failures++; mpp->retry_tick = -1; dm_queue_if_no_path(mpp->alias, 0); return 0; @@ -1011,6 +1018,8 @@ cli_disable_all_queueing(void *v, char **reply, int *len, void *data) condlog(2, "disable queueing (operator)"); vector_foreach_slot(vecs->mpvec, mpp, i) { + if (mpp->nr_active == 0) + mpp->stat_map_failures++; mpp->retry_tick = -1; dm_queue_if_no_path(mpp->alias, 0); } diff --git a/multipathd/main.c b/multipathd/main.c index 03c2dd9..dbcaa03 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -889,6 +889,7 @@ ev_remove_path (struct path *pp, struct vectors * vecs) mpp->retry_tick = 0; mpp->no_path_retry = NO_PATH_RETRY_FAIL; mpp->flush_on_last_del = FLUSH_IN_PROGRESS; + mpp->stat_map_failures++; dm_queue_if_no_path(mpp->alias, 0); } if (!flush_map(mpp, vecs, 1)) { @@ -1397,6 +1398,7 @@ retry_count_tick(vector mpvec) mpp->stat_total_queueing_time++; condlog(4, "%s: Retrying.. No active path", mpp->alias); if(--mpp->retry_tick == 0) { + mpp->stat_map_failures++; dm_queue_if_no_path(mpp->alias, 0); condlog(2, "%s: Disable queueing", mpp->alias); }