From patchwork Tue Oct 23 22:05:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10653833 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-2.web.codeaurora.org (Postfix) with ESMTP id 4F85714BB for ; Tue, 23 Oct 2018 22:09:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A5C82A20C for ; Tue, 23 Oct 2018 22:09:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EDBA2A295; Tue, 23 Oct 2018 22:09:13 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 BCECB2A20C for ; Tue, 23 Oct 2018 22:09:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EBB7C0270C2; Tue, 23 Oct 2018 22:09:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2377B60191; Tue, 23 Oct 2018 22:09:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 91A23180B5B7; Tue, 23 Oct 2018 22:09:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9NM89PB013437 for ; Tue, 23 Oct 2018 18:08:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5B4B175520; Tue, 23 Oct 2018 22:08:09 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 524B979A27; Tue, 23 Oct 2018 22:08:09 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A8AD806B6; Tue, 23 Oct 2018 22:08:06 +0000 (UTC) Received: from apollon.suse.de.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Tue, 23 Oct 2018 16:08:01 -0600 From: Martin Wilck To: Christophe Varoqui Date: Wed, 24 Oct 2018 00:05:48 +0200 Message-Id: <20181023220552.1306-4-mwilck@suse.com> In-Reply-To: <20181023220552.1306-1-mwilck@suse.com> References: <20181023220552.1306-1-mwilck@suse.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 23 Oct 2018 22:08:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 23 Oct 2018 22:08:06 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'mwilck@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: Martin Wilck , dm-devel@redhat.com Subject: [dm-devel] [PATCH 3/7] multipathd: print error message if checkint is not initialized 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: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 23 Oct 2018 22:09:12 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP This is just a safety measure in case I overlooked something wrt the checkint initialization. It could be reverted once we know the error message isn't triggered. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinsk --- libmultipath/defaults.h | 1 + libmultipath/dict.c | 14 ++++++++++++-- libmultipath/structs.c | 1 + multipathd/main.c | 6 ++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h index 7f3839fc..65769398 100644 --- a/libmultipath/defaults.h +++ b/libmultipath/defaults.h @@ -46,6 +46,7 @@ #define DEFAULT_UNKNOWN_FIND_MULTIPATHS_TIMEOUT 1 #define DEFAULT_ALL_TG_PT ALL_TG_PT_OFF +#define CHECKINT_UNDEF (~0U) #define DEFAULT_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) diff --git a/libmultipath/dict.c b/libmultipath/dict.c index c3f5a6e6..a81c051f 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -264,7 +264,17 @@ snprint_mp_ ## option (struct config *conf, char * buff, int len, \ return function (buff, len, mpe->option); \ } -declare_def_handler(checkint, set_int) +static int checkint_handler(struct config *conf, vector strvec) +{ + int rc = set_int(strvec, &conf->checkint); + + if (rc) + return rc; + if (conf->checkint == CHECKINT_UNDEF) + conf->checkint--; + return 0; +} + declare_def_snprint(checkint, print_int) declare_def_handler(max_checkint, set_int) @@ -1563,7 +1573,7 @@ init_keywords(vector keywords) { install_keyword_root("defaults", NULL); install_keyword("verbosity", &def_verbosity_handler, &snprint_def_verbosity); - install_keyword("polling_interval", &def_checkint_handler, &snprint_def_checkint); + install_keyword("polling_interval", &checkint_handler, &snprint_def_checkint); install_keyword("max_polling_interval", &def_max_checkint_handler, &snprint_def_max_checkint); install_keyword("reassign_maps", &def_reassign_maps_handler, &snprint_def_reassign_maps); install_keyword("multipath_dir", &def_multipath_dir_handler, &snprint_def_multipath_dir); diff --git a/libmultipath/structs.c b/libmultipath/structs.c index caa178a6..fee899bd 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -100,6 +100,7 @@ alloc_path (void) pp->fd = -1; pp->tpgs = TPGS_UNDEF; pp->priority = PRIO_UNDEF; + pp->checkint = CHECKINT_UNDEF; checker_clear(&pp->checker); dm_path_to_gen(pp)->ops = &dm_gen_path_ops; pp->hwe = vector_alloc(); diff --git a/multipathd/main.c b/multipathd/main.c index 3464ebfa..083abf28 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1840,6 +1840,12 @@ check_path (struct vectors * vecs, struct path * pp, int ticks) max_checkint = conf->max_checkint; verbosity = conf->verbosity; put_multipath_config(conf); + + if (pp->checkint == CHECKINT_UNDEF) { + condlog(0, "%s: BUG: checkint is not set", pp->dev); + pp->checkint = checkint; + }; + if (!pp->mpp && pp->initialized == INIT_MISSING_UDEV) { if (pp->retriggers < retrigger_tries) { condlog(2, "%s: triggering change event to reinitialize",