From patchwork Mon Dec 10 09:49:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720925 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 C5487112E for ; Mon, 10 Dec 2018 09:50:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2B8229BBD for ; Mon, 10 Dec 2018 09:50:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E8FB29C12; Mon, 10 Dec 2018 09:50:31 +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 346AC29BBD for ; Mon, 10 Dec 2018 09:50:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0B80A81DE5; Mon, 10 Dec 2018 09:50:30 +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 24D35608EF; Mon, 10 Dec 2018 09:50:29 +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 83590181B9E4; Mon, 10 Dec 2018 09:50:26 +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 wBA9oOYS010732 for ; Mon, 10 Dec 2018 04:50:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id D7E3717C4B; Mon, 10 Dec 2018 09:50:24 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC6C017D5D; Mon, 10 Dec 2018 09:50:21 +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 69A18308427E; Mon, 10 Dec 2018 09:50:20 +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); Mon, 10 Dec 2018 02:50:15 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:36 +0100 Message-Id: <20181210094959.11338-2-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.40]); Mon, 10 Dec 2018 09:50:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 10 Dec 2018 09:50:20 +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.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 01/24] tests/hwtable: set multipath_dir in local configuration 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 10 Dec 2018 09:50:30 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP If internal libmultipath APIs change (such as, recently, the checker API), test programs will fail because they'll link with the standard system prioritizer / checker / foreign APIs. Make sure we always link with our own shared libraries. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- tests/Makefile | 7 ++++++- tests/hwtable.c | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index b37b5027..ef900866 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -26,7 +26,11 @@ hwtable-test_LIBDEPS := -ludev -lpthread -ldl blacklist-test_OBJDEPS := ../libmultipath/blacklist.o blacklist-test_LIBDEPS := -ludev -%.out: %-test +lib/libchecktur.so: + mkdir lib + ln -t lib ../libmultipath/{checkers,prioritizers,foreign}/*.so + +%.out: %-test lib/libchecktur.so @echo == running $< == @LD_LIBRARY_PATH=$(multipathdir):$(mpathcmddir) ./$< >$@ @@ -34,6 +38,7 @@ OBJS = $(TESTS:%=%.o) test-lib.o clean: dep_clean $(RM) $(TESTS:%=%-test) $(TESTS:%=%.out) $(OBJS) + $(RM) -rf lib .SECONDARY: $(OBJS) diff --git a/tests/hwtable.c b/tests/hwtable.c index 9146ecc3..1cd788ac 100644 --- a/tests/hwtable.c +++ b/tests/hwtable.c @@ -250,14 +250,19 @@ static void write_defaults(const struct hwt_state *hwt) static struct key_value defaults[] = { { "config_dir", NULL }, { "bindings_file", NULL }, + { "multipath_dir", NULL }, { "detect_prio", "no" }, { "detect_checker", "no" }, }; char buf[sizeof(tmplate) + sizeof(bindings_name)]; + char dirbuf[PATH_MAX]; snprintf(buf, sizeof(buf), "%s/%s", hwt->tmpname, bindings_name); defaults[0].value = hwt->dirname; defaults[1].value = buf; + assert_ptr_not_equal(getcwd(dirbuf, sizeof(dirbuf)), NULL); + strncat(dirbuf, "/lib", sizeof(dirbuf)); + defaults[2].value = dirbuf; write_section(hwt->config_file, "defaults", ARRAY_SIZE(defaults), defaults); } From patchwork Mon Dec 10 09:49:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720935 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 0A6A7109C for ; Mon, 10 Dec 2018 09:50:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA4B629BF5 for ; Mon, 10 Dec 2018 09:50:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DECD629C12; Mon, 10 Dec 2018 09:50:46 +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 ECD4929BF5 for ; Mon, 10 Dec 2018 09:50:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC73EC0495AE; Mon, 10 Dec 2018 09:50:44 +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 81D2F19C7F; Mon, 10 Dec 2018 09:50:44 +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 4A38D181B9F6; Mon, 10 Dec 2018 09:50:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oOTF010733 for ; Mon, 10 Dec 2018 04:50:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id DE8545D75C; Mon, 10 Dec 2018 09:50:24 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9B17C5D738; Mon, 10 Dec 2018 09:50:22 +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 74D28308FB8B; Mon, 10 Dec 2018 09:50:20 +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); Mon, 10 Dec 2018 02:50:17 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:37 +0100 Message-Id: <20181210094959.11338-3-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.43]); Mon, 10 Dec 2018 09:50:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 10 Dec 2018 09:50:20 +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.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 02/24] tests/hwtable: adjust to new checker API 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 10 Dec 2018 09:50:45 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP checker.name doesn't exist any more. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- tests/hwtable.c | 84 ++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/tests/hwtable.c b/tests/hwtable.c index 1cd788ac..789481ff 100644 --- a/tests/hwtable.c +++ b/tests/hwtable.c @@ -570,7 +570,7 @@ static void test_internal_nvme(const struct hwt_state *hwt) pp = mock_path("NVME", "NoName"); mp = mock_multipath(pp); assert_ptr_not_equal(mp, NULL); - TEST_PROP(pp->checker.name, NONE); + TEST_PROP(checker_name(&pp->checker), NONE); TEST_PROP(pp->uid_attribute, "ID_WWN"); assert_int_equal(mp->pgpolicy, DEFAULT_PGPOLICY); assert_int_equal(mp->no_path_retry, DEFAULT_NO_PATH_RETRY); @@ -583,7 +583,7 @@ static void test_internal_nvme(const struct hwt_state *hwt) default_wwid_1); mp = mock_multipath(pp); assert_ptr_not_equal(mp, NULL); - TEST_PROP(pp->checker.name, NONE); + TEST_PROP(checker_name(&pp->checker), NONE); TEST_PROP(pp->uid_attribute, "ID_WWN"); assert_int_equal(mp->pgpolicy, MULTIBUS); assert_int_equal(mp->no_path_retry, NO_PATH_RETRY_QUEUE); @@ -755,31 +755,31 @@ static void test_regex_string_hwe(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* boo:baz matches kv1 */ pp = mock_path(vnd_boo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* .oo:ba. matches kv1 */ pp = mock_path(vnd__oo.value, prd_ba_.value); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* .foo:(bar|baz|ba\.) doesn't match */ pp = mock_path(vnd__oo.value, prd_ba_s.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches kv2 and kv1 */ pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_regex_string_hwe(void **state) @@ -812,32 +812,32 @@ static void test_regex_string_hwe_dir(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* boo:baz matches kv1 */ pp = mock_path(vnd_boo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* .oo:ba. matches kv1 */ pp = mock_path(vnd__oo.value, prd_ba_.value); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* .oo:(bar|baz|ba\.)$ doesn't match */ pp = mock_path(vnd__oo.value, prd_ba_s.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches kv2 */ pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); /* Later match takes prio */ TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_regex_string_hwe_dir(void **state) @@ -868,28 +868,28 @@ static void test_regex_2_strings_hwe_dir(const struct hwt_state *hwt) TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); TEST_PROP(pp->uid_attribute, DEFAULT_UID_ATTRIBUTE); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* boo:baz doesn't match */ pp = mock_path(vnd_boo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); TEST_PROP(pp->uid_attribute, DEFAULT_UID_ATTRIBUTE); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches kv2 and kv1 */ pp = mock_path(vnd_foo.value, prd_bar.value); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, NULL); TEST_PROP(pp->uid_attribute, uid_baz.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* foo:barz matches kv3 and kv2 and kv1 */ pp = mock_path_flags(vnd_foo.value, prd_barz.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_rdac.value); TEST_PROP(pp->getuid, gui_foo.value); TEST_PROP(pp->uid_attribute, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_regex_2_strings_hwe_dir(void **state) @@ -926,31 +926,31 @@ static void test_string_regex_hwe_dir(const struct hwt_state *hwt) pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* foo:baz matches kv1 */ pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* boo:baz matches kv1 */ pp = mock_path(vnd_boo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* .oo:ba. matches kv1 */ pp = mock_path(vnd__oo.value, prd_ba_.value); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* .oo:(bar|baz|ba\.)$ doesn't match */ pp = mock_path(vnd__oo.value, prd_ba_s.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); } static int setup_string_regex_hwe_dir(void **state) @@ -980,13 +980,13 @@ static void test_2_ident_strings_hwe(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches both */ pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_2_ident_strings_hwe(void **state) @@ -1015,13 +1015,13 @@ static void test_2_ident_strings_both_dir(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches both */ pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_2_ident_strings_both_dir(void **state) @@ -1055,13 +1055,13 @@ static void test_2_ident_strings_both_dir_w_prev(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches both */ pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_2_ident_strings_both_dir_w_prev(void **state) @@ -1100,13 +1100,13 @@ static void test_2_ident_strings_hwe_dir(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches both */ pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_2_ident_strings_hwe_dir(void **state) @@ -1134,13 +1134,13 @@ static void test_3_ident_strings_hwe_dir(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches both */ pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_3_ident_strings_hwe_dir(void **state) @@ -1178,13 +1178,13 @@ static void test_2_ident_self_matching_re_hwe_dir(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches both */ pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_2_ident_self_matching_re_hwe_dir(void **state) @@ -1213,13 +1213,13 @@ static void test_2_ident_self_matching_re_hwe(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches */ pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_2_ident_self_matching_re_hwe(void **state) @@ -1250,13 +1250,13 @@ test_2_ident_not_self_matching_re_hwe_dir(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_baz.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); /* foo:bar matches both */ pp = mock_path_flags(vnd_foo.value, prd_bar.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_2_ident_not_self_matching_re_hwe_dir(void **state) @@ -1287,19 +1287,19 @@ static void test_2_matching_res_hwe_dir(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_bar.value); TEST_PROP(prio_name(&pp->prio), prio_emc.value); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* foo:bay matches k1 and k2 */ pp = mock_path_flags(vnd_foo.value, "bay", USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); /* foo:baz matches k2 only. */ pp = mock_path_flags(vnd_foo.value, prd_baz.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); } static int setup_2_matching_res_hwe_dir(void **state) @@ -1328,12 +1328,12 @@ static void test_2_nonmatching_res_hwe_dir(const struct hwt_state *hwt) pp = mock_path(vnd_foo.value, prd_bar.value); TEST_PROP(prio_name(&pp->prio), DEFAULT_PRIO); TEST_PROP(pp->getuid, NULL); - TEST_PROP(pp->checker.name, DEFAULT_CHECKER); + TEST_PROP(checker_name(&pp->checker), DEFAULT_CHECKER); pp = mock_path_flags(vnd_foo.value, prd_baz.value, USE_GETUID); TEST_PROP(prio_name(&pp->prio), prio_hds.value); TEST_PROP(pp->getuid, gui_foo.value); - TEST_PROP(pp->checker.name, chk_hp.value); + TEST_PROP(checker_name(&pp->checker), chk_hp.value); } static int setup_2_nonmatching_res_hwe_dir(void **state) From patchwork Mon Dec 10 09:49:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720937 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 F3FD5109C for ; Mon, 10 Dec 2018 09:50:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E288129C11 for ; Mon, 10 Dec 2018 09:50:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D675229C0B; Mon, 10 Dec 2018 09:50:48 +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 701B829C0B for ; Mon, 10 Dec 2018 09:50:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8710B8830C; Mon, 10 Dec 2018 09:50:47 +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 4892A1974D; Mon, 10 Dec 2018 09:50:47 +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 0FEAF181B9EB; Mon, 10 Dec 2018 09:50:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oV0f010760 for ; Mon, 10 Dec 2018 04:50:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id B4F7F600D7; Mon, 10 Dec 2018 09:50:31 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4E19600D6; Mon, 10 Dec 2018 09:50:31 +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 4DF9C30832C6; Mon, 10 Dec 2018 09:50:30 +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); Mon, 10 Dec 2018 02:50:18 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:38 +0100 Message-Id: <20181210094959.11338-4-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.44]); Mon, 10 Dec 2018 09:50:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 10 Dec 2018 09:50:30 +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.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 03/24] multipath-tools: decrease verbosity of state messages 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 10 Dec 2018 09:50:48 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP With verbosity level 3, thousands of "path state = running" messages are logged, which are pretty much irrelevant, as the checker state takes precedence. Also the "get_state" message is totally useless. With this patch, the path state is reported exactly once per path and check. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 4 +--- multipathd/main.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 63558ad8..f9a59011 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1433,7 +1433,7 @@ path_offline (struct path * pp) } - condlog(3, "%s: path state = %s", pp->dev, buff); + condlog(4, "%s: path state = %s", pp->dev, buff); if (pp->bus == SYSFS_BUS_SCSI) { if (!strncmp(buff, "offline", 7)) { @@ -1552,8 +1552,6 @@ get_state (struct path * pp, struct config *conf, int daemon, int oldstate) struct checker * c = &pp->checker; int state; - condlog(3, "%s: get_state", pp->dev); - if (!checker_selected(c)) { if (daemon) { if (pathinfo(pp, conf, DI_SYSFS) != PATHINFO_OK) { diff --git a/multipathd/main.c b/multipathd/main.c index c781115c..e07ef502 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1904,6 +1904,16 @@ check_path (struct vectors * vecs, struct path * pp, int ticks) pp->tick = checkint; newstate = path_offline(pp); + if (newstate == PATH_UP) { + conf = get_multipath_config(); + pthread_cleanup_push(put_multipath_config, conf); + newstate = get_state(pp, conf, 1, newstate); + pthread_cleanup_pop(1); + } else { + checker_clear_message(&pp->checker); + condlog(3, "%s: state %s, checker not called", + pp->dev, checker_state_name(newstate)); + } /* * Wait for uevent for removed paths; * some LLDDs like zfcp keep paths unavailable @@ -1912,14 +1922,6 @@ check_path (struct vectors * vecs, struct path * pp, int ticks) if (newstate == PATH_REMOVED) newstate = PATH_DOWN; - if (newstate == PATH_UP) { - conf = get_multipath_config(); - pthread_cleanup_push(put_multipath_config, conf); - newstate = get_state(pp, conf, 1, newstate); - pthread_cleanup_pop(1); - } else - checker_clear_message(&pp->checker); - if (pp->wwid_changed) { condlog(2, "%s: path wwid has changed. Refusing to use", pp->dev); From patchwork Mon Dec 10 09:49:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720939 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 863791731 for ; Mon, 10 Dec 2018 09:50:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 749EE29C0B for ; Mon, 10 Dec 2018 09:50:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6935029C24; Mon, 10 Dec 2018 09:50:49 +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 00C7D29C0B for ; Mon, 10 Dec 2018 09:50:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7552A3082138; Mon, 10 Dec 2018 09:50:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4DE081054FD3; Mon, 10 Dec 2018 09:50:47 +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 1535B3F774; Mon, 10 Dec 2018 09:50:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oYmT010781 for ; Mon, 10 Dec 2018 04:50:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 072A060C64; Mon, 10 Dec 2018 09:50:34 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C86AB60BF1; Mon, 10 Dec 2018 09:50:31 +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 81FFE307D91A; Mon, 10 Dec 2018 09:50:30 +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); Mon, 10 Dec 2018 02:50:20 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:39 +0100 Message-Id: <20181210094959.11338-5-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.48]); Mon, 10 Dec 2018 09:50:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 10 Dec 2018 09:50:30 +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.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 04/24] libmultipath: decrease verbosity of pathinfo messages 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 10 Dec 2018 09:50:47 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Reduce the verbosity of pointless messages from pathinfo(), in particular those that are printed on every checker invocation. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index f9a59011..3ad33492 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1382,7 +1382,7 @@ common_sysfs_pathinfo (struct path * pp) devt = udev_device_get_devnum(pp->udev); snprintf(pp->dev_t, BLK_DEV_SIZE, "%d:%d", major(devt), minor(devt)); - condlog(3, "%s: dev_t = %s", pp->dev, pp->dev_t); + condlog(4, "%s: dev_t = %s", pp->dev, pp->dev_t); if (sysfs_get_size(pp, &pp->size)) return PATHINFO_FAILED; @@ -1599,6 +1599,7 @@ get_prio (struct path * pp) struct prio * p; struct config *conf; int checker_timeout; + int old_prio; if (!pp) return 0; @@ -1619,13 +1620,14 @@ get_prio (struct path * pp) conf = get_multipath_config(); checker_timeout = conf->checker_timeout; put_multipath_config(conf); + old_prio = pp->priority; pp->priority = prio_getprio(p, pp, checker_timeout); if (pp->priority < 0) { condlog(3, "%s: %s prio error", pp->dev, prio_name(p)); pp->priority = PRIO_UNDEF; return 1; } - condlog(3, "%s: %s prio = %u", + condlog((old_prio == pp->priority ? 4 : 3), "%s: %s prio = %u", pp->dev, prio_name(p), pp->priority); return 0; } @@ -1863,7 +1865,7 @@ int pathinfo(struct path *pp, struct config *conf, int mask) udev_device_get_sysattr_value(pp->udev, "hidden"); if (hidden && !strcmp(hidden, "1")) { - condlog(3, "%s: hidden", pp->dev); + condlog(4, "%s: hidden", pp->dev); return PATHINFO_SKIPPED; } if (is_claimed_by_foreign(pp->udev) || @@ -1876,7 +1878,7 @@ int pathinfo(struct path *pp, struct config *conf, int mask) pp->dev) > 0) return PATHINFO_SKIPPED; - condlog(3, "%s: mask = 0x%x", pp->dev, mask); + condlog(4, "%s: mask = 0x%x", pp->dev, mask); /* * Sanity check: we need the device number to From patchwork Mon Dec 10 09:49:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720941 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 3F88A109C for ; Mon, 10 Dec 2018 09:50:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EDE329BF8 for ; Mon, 10 Dec 2018 09:50:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 237AA29C39; Mon, 10 Dec 2018 09:50:50 +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 C1D5029BF8 for ; Mon, 10 Dec 2018 09:50:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 85B083082E4C; Mon, 10 Dec 2018 09:50:48 +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 6334119748; Mon, 10 Dec 2018 09:50:47 +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 2DA82181BA1A; Mon, 10 Dec 2018 09:50:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oYaC010791 for ; Mon, 10 Dec 2018 04:50:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 178B6105704D; Mon, 10 Dec 2018 09:50:34 +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 EBA441001947; Mon, 10 Dec 2018 09:50:31 +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 B1DCA8666A; Mon, 10 Dec 2018 09:50:30 +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); Mon, 10 Dec 2018 02:50:21 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:40 +0100 Message-Id: <20181210094959.11338-6-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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]); Mon, 10 Dec 2018 09:50:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 10 Dec 2018 09:50:31 +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.84 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 05/24] libmultipath: decrease verbosity of TUR checker messages 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 10 Dec 2018 09:50:49 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP The thread startup/stop messages aren't very interesting. Decrease their verbosity level to v4. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/checkers/tur.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c index 63b19624..6b08dbbb 100644 --- a/libmultipath/checkers/tur.c +++ b/libmultipath/checkers/tur.c @@ -261,7 +261,7 @@ static void *tur_thread(void *ctx) tur_thread_cleanup_push(ct); rcu_register_thread(); - condlog(3, "%d:%d : tur checker starting up", major(ct->devt), + condlog(4, "%d:%d : tur checker starting up", major(ct->devt), minor(ct->devt)); tur_deep_sleep(ct); @@ -275,7 +275,7 @@ static void *tur_thread(void *ctx) pthread_cond_signal(&ct->active); pthread_mutex_unlock(&ct->lock); - condlog(3, "%d:%d : tur checker finished, state %s", major(ct->devt), + condlog(4, "%d:%d : tur checker finished, state %s", major(ct->devt), minor(ct->devt), checker_state_name(state)); running = uatomic_xchg(&ct->running, 0); @@ -415,7 +415,7 @@ int libcheck_check(struct checker * c) } pthread_mutex_unlock(&ct->lock); if (tur_status == PATH_PENDING) { - condlog(3, "%d:%d : tur checker still running", + condlog(4, "%d:%d : tur checker still running", major(ct->devt), minor(ct->devt)); } else { int running = uatomic_xchg(&ct->running, 0); From patchwork Mon Dec 10 09:49:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720931 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 B641D109C for ; Mon, 10 Dec 2018 09:50:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4BC229BCB for ; Mon, 10 Dec 2018 09:50:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 996F529C19; Mon, 10 Dec 2018 09:50:45 +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 E888C29BF5 for ; Mon, 10 Dec 2018 09:50:44 +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 C12283097027; Mon, 10 Dec 2018 09:50:43 +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 7DF66600D7; Mon, 10 Dec 2018 09:50:43 +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 3AA02181B9EB; Mon, 10 Dec 2018 09:50:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oY8h010780 for ; Mon, 10 Dec 2018 04:50:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 071A160C62; Mon, 10 Dec 2018 09:50:34 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C63A60C45; Mon, 10 Dec 2018 09:50:32 +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 DE19C308624C; Mon, 10 Dec 2018 09:50:30 +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); Mon, 10 Dec 2018 02:50:23 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:41 +0100 Message-Id: <20181210094959.11338-7-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.49]); Mon, 10 Dec 2018 09:50:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 10 Dec 2018 09:50:31 +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.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 06/24] libmultipath: avoid frequent messages from filter_property() 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.43]); Mon, 10 Dec 2018 09:50:44 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Unlike the other filter functions, filter_property() is called on every pathinfo() call, and prints a message with -v3 every time. Avoid that by using a lower log priority for the call from pathinfo(). Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/blacklist.c | 54 ++++++++++++++++++++-------------------- libmultipath/blacklist.h | 2 +- libmultipath/configure.c | 6 ++--- libmultipath/discovery.c | 2 +- tests/blacklist.c | 7 +++--- 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c index 318ec03f..709895e2 100644 --- a/libmultipath/blacklist.c +++ b/libmultipath/blacklist.c @@ -232,24 +232,24 @@ setup_default_blist (struct config * conf) return 0; } -#define LOG_BLIST(M,S) \ +#define LOG_BLIST(M, S, lvl) \ if (vendor && product) \ - condlog(3, "%s: (%s:%s) %s %s", \ + condlog(lvl, "%s: (%s:%s) %s %s", \ dev, vendor, product, (M), (S)); \ else if (wwid && !dev) \ - condlog(3, "%s: %s %s", wwid, (M), (S)); \ + condlog(lvl, "%s: %s %s", wwid, (M), (S)); \ else if (wwid) \ - condlog(3, "%s: %s %s %s", dev, (M), wwid, (S)); \ + condlog(lvl, "%s: %s %s %s", dev, (M), wwid, (S)); \ else if (env) \ - condlog(3, "%s: %s %s %s", dev, (M), env, (S)); \ + condlog(lvl, "%s: %s %s %s", dev, (M), env, (S)); \ else if (protocol) \ - condlog(3, "%s: %s %s %s", dev, (M), protocol, (S)); \ + condlog(lvl, "%s: %s %s %s", dev, (M), protocol, (S)); \ else \ - condlog(3, "%s: %s %s", dev, (M), (S)) + condlog(lvl, "%s: %s %s", dev, (M), (S)) -void +static void log_filter (const char *dev, char *vendor, char *product, char *wwid, - const char *env, const char *protocol, int r) + const char *env, const char *protocol, int r, int lvl) { /* * Try to sort from most likely to least. @@ -258,37 +258,37 @@ log_filter (const char *dev, char *vendor, char *product, char *wwid, case MATCH_NOTHING: break; case MATCH_DEVICE_BLIST: - LOG_BLIST("vendor/product", "blacklisted"); + LOG_BLIST("vendor/product", "blacklisted", lvl); break; case MATCH_WWID_BLIST: - LOG_BLIST("wwid", "blacklisted"); + LOG_BLIST("wwid", "blacklisted", lvl); break; case MATCH_DEVNODE_BLIST: - LOG_BLIST("device node name", "blacklisted"); + LOG_BLIST("device node name", "blacklisted", lvl); break; case MATCH_PROPERTY_BLIST: - LOG_BLIST("udev property", "blacklisted"); + LOG_BLIST("udev property", "blacklisted", lvl); break; case MATCH_PROTOCOL_BLIST: - LOG_BLIST("protocol", "blacklisted"); + LOG_BLIST("protocol", "blacklisted", lvl); break; case MATCH_DEVICE_BLIST_EXCEPT: - LOG_BLIST("vendor/product", "whitelisted"); + LOG_BLIST("vendor/product", "whitelisted", lvl); break; case MATCH_WWID_BLIST_EXCEPT: - LOG_BLIST("wwid", "whitelisted"); + LOG_BLIST("wwid", "whitelisted", lvl); break; case MATCH_DEVNODE_BLIST_EXCEPT: - LOG_BLIST("device node name", "whitelisted"); + LOG_BLIST("device node name", "whitelisted", lvl); break; case MATCH_PROPERTY_BLIST_EXCEPT: - LOG_BLIST("udev property", "whitelisted"); + LOG_BLIST("udev property", "whitelisted", lvl); break; case MATCH_PROPERTY_BLIST_MISSING: - LOG_BLIST("blacklisted,", "udev property missing"); + LOG_BLIST("blacklisted,", "udev property missing", lvl); break; case MATCH_PROTOCOL_BLIST_EXCEPT: - LOG_BLIST("protocol", "whitelisted"); + LOG_BLIST("protocol", "whitelisted", lvl); break; } } @@ -306,7 +306,7 @@ filter_device (vector blist, vector elist, char * vendor, char * product, r = MATCH_DEVICE_BLIST; } - log_filter(dev, vendor, product, NULL, NULL, NULL, r); + log_filter(dev, vendor, product, NULL, NULL, NULL, r, 3); return r; } @@ -322,7 +322,7 @@ filter_devnode (vector blist, vector elist, char * dev) r = MATCH_DEVNODE_BLIST; } - log_filter(dev, NULL, NULL, NULL, NULL, NULL, r); + log_filter(dev, NULL, NULL, NULL, NULL, NULL, r, 3); return r; } @@ -338,7 +338,7 @@ filter_wwid (vector blist, vector elist, char * wwid, char * dev) r = MATCH_WWID_BLIST; } - log_filter(dev, NULL, NULL, wwid, NULL, NULL, r); + log_filter(dev, NULL, NULL, wwid, NULL, NULL, r, 3); return r; } @@ -357,7 +357,7 @@ filter_protocol(vector blist, vector elist, struct path * pp) r = MATCH_PROTOCOL_BLIST; } - log_filter(pp->dev, NULL, NULL, NULL, NULL, buf, r); + log_filter(pp->dev, NULL, NULL, NULL, NULL, buf, r, 3); return r; } @@ -366,7 +366,7 @@ filter_path (struct config * conf, struct path * pp) { int r; - r = filter_property(conf, pp->udev); + r = filter_property(conf, pp->udev, 3); if (r > 0) return r; r = filter_devnode(conf->blist_devnode, conf->elist_devnode, pp->dev); @@ -384,7 +384,7 @@ filter_path (struct config * conf, struct path * pp) } int -filter_property(struct config * conf, struct udev_device * udev) +filter_property(struct config *conf, struct udev_device *udev, int lvl) { const char *devname = udev_device_get_sysname(udev); struct udev_list_entry *list_entry; @@ -415,7 +415,7 @@ filter_property(struct config * conf, struct udev_device * udev) } } - log_filter(devname, NULL, NULL, NULL, env, NULL, r); + log_filter(devname, NULL, NULL, NULL, env, NULL, r, lvl); return r; } diff --git a/libmultipath/blacklist.h b/libmultipath/blacklist.h index 18903b6b..4c8ec99e 100644 --- a/libmultipath/blacklist.h +++ b/libmultipath/blacklist.h @@ -37,7 +37,7 @@ int filter_devnode (vector, vector, char *); int filter_wwid (vector, vector, char *, char *); int filter_device (vector, vector, char *, char *, char *); int filter_path (struct config *, struct path *); -int filter_property(struct config *, struct udev_device *); +int filter_property(struct config *, struct udev_device *, int); int filter_protocol(vector, vector, struct path *); int store_ble (vector, char *, int); int set_ble_device (vector, char *, char *, int); diff --git a/libmultipath/configure.c b/libmultipath/configure.c index ed3e30f5..406cd4c9 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -1289,7 +1289,7 @@ int get_refwwid(enum mpath_cmds cmd, char *dev, enum devtypes dev_type, conf = get_multipath_config(); pthread_cleanup_push(put_multipath_config, conf); if (pp->udev && pp->uid_attribute && - filter_property(conf, pp->udev) > 0) + filter_property(conf, pp->udev, 3) > 0) invalid = 1; pthread_cleanup_pop(1); if (invalid) @@ -1329,7 +1329,7 @@ int get_refwwid(enum mpath_cmds cmd, char *dev, enum devtypes dev_type, conf = get_multipath_config(); pthread_cleanup_push(put_multipath_config, conf); if (pp->udev && pp->uid_attribute && - filter_property(conf, pp->udev) > 0) + filter_property(conf, pp->udev, 3) > 0) invalid = 1; pthread_cleanup_pop(1); if (invalid) @@ -1358,7 +1358,7 @@ int get_refwwid(enum mpath_cmds cmd, char *dev, enum devtypes dev_type, conf = get_multipath_config(); pthread_cleanup_push(put_multipath_config, conf); if (pp->udev && pp->uid_attribute && - filter_property(conf, pp->udev) > 0) + filter_property(conf, pp->udev, 3) > 0) invalid = 1; pthread_cleanup_pop(1); if (invalid) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 3ad33492..1c87277f 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1869,7 +1869,7 @@ int pathinfo(struct path *pp, struct config *conf, int mask) return PATHINFO_SKIPPED; } if (is_claimed_by_foreign(pp->udev) || - filter_property(conf, pp->udev) > 0) + filter_property(conf, pp->udev, 4) > 0) return PATHINFO_SKIPPED; } diff --git a/tests/blacklist.c b/tests/blacklist.c index a55c1c07..54d568f5 100644 --- a/tests/blacklist.c +++ b/tests/blacklist.c @@ -267,7 +267,8 @@ static void test_property_blacklist(void **state) static struct udev_device udev = { "sdb", { "ID_FOO", "ID_WWN", "ID_BAR", NULL } }; conf.blist_property = blist_property_wwn; expect_condlog(3, "sdb: udev property ID_WWN blacklisted\n"); - assert_int_equal(filter_property(&conf, &udev), MATCH_PROPERTY_BLIST); + assert_int_equal(filter_property(&conf, &udev, 3), + MATCH_PROPERTY_BLIST); } /* the property check works different in that you check all the property @@ -280,7 +281,7 @@ static void test_property_whitelist(void **state) static struct udev_device udev = { "sdb", { "ID_FOO", "ID_WWN", "ID_BAR", NULL } }; conf.elist_property = blist_property_wwn; expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n"); - assert_int_equal(filter_property(&conf, &udev), + assert_int_equal(filter_property(&conf, &udev, 3), MATCH_PROPERTY_BLIST_EXCEPT); } @@ -289,7 +290,7 @@ static void test_property_missing(void **state) static struct udev_device udev = { "sdb", { "ID_FOO", "ID_BAZ", "ID_BAR", NULL } }; conf.blist_property = blist_property_wwn; expect_condlog(3, "sdb: blacklisted, udev property missing\n"); - assert_int_equal(filter_property(&conf, &udev), + assert_int_equal(filter_property(&conf, &udev, 3), MATCH_PROPERTY_BLIST_MISSING); } From patchwork Mon Dec 10 09:49:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720933 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 D9C4F1731 for ; Mon, 10 Dec 2018 09:50:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5ECB29BF5 for ; Mon, 10 Dec 2018 09:50:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B956129BCB; Mon, 10 Dec 2018 09:50:45 +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 36F6029C04 for ; Mon, 10 Dec 2018 09:50:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A20083082E4F; Mon, 10 Dec 2018 09:50:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78BDE105704D; Mon, 10 Dec 2018 09:50:43 +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 3EDC83F7CD; Mon, 10 Dec 2018 09:50:43 +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 wBA9oWxs010761 for ; Mon, 10 Dec 2018 04:50:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 395F95DD8A; Mon, 10 Dec 2018 09:50:32 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2BB3417D5D; Mon, 10 Dec 2018 09:50:32 +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 0FFFA81F0E; Mon, 10 Dec 2018 09:50:31 +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); Mon, 10 Dec 2018 02:50:24 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:42 +0100 Message-Id: <20181210094959.11338-8-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.27]); Mon, 10 Dec 2018 09:50:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 10 Dec 2018 09:50:31 +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.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 07/24] libmultipath: decrease log level of "disassembled" messages 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 10 Dec 2018 09:50:44 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP These messages are printed from update_multipath_strings, and thus from check_path(), which is too much for -v3. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/dmparser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c index 620f507d..ac13ec06 100644 --- a/libmultipath/dmparser.c +++ b/libmultipath/dmparser.c @@ -117,7 +117,7 @@ assemble_map (struct multipath * mp, char * params, int len) } FREE(f); - condlog(3, "%s: assembled map [%s]", mp->alias, params); + condlog(4, "%s: assembled map [%s]", mp->alias, params); return 0; err: @@ -145,7 +145,7 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp, p = params; - condlog(3, "%s: disassemble map [%s]", mpp->alias, params); + condlog(4, "%s: disassemble map [%s]", mpp->alias, params); /* * features @@ -410,7 +410,7 @@ int disassemble_status(char *params, struct multipath *mpp) p = params; - condlog(3, "%s: disassemble status [%s]", mpp->alias, params); + condlog(4, "%s: disassemble status [%s]", mpp->alias, params); /* * features From patchwork Mon Dec 10 09:49:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720929 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 DB571112E for ; Mon, 10 Dec 2018 09:50:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8FCF29C00 for ; Mon, 10 Dec 2018 09:50:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDA6829C07; Mon, 10 Dec 2018 09:50:35 +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 74D3A29C06 for ; Mon, 10 Dec 2018 09:50:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D5A43086259; Mon, 10 Dec 2018 09:50:34 +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 234C75D738; Mon, 10 Dec 2018 09:50:34 +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 DECF9181B9E7; Mon, 10 Dec 2018 09:50:33 +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 wBA9oWqk010770 for ; Mon, 10 Dec 2018 04:50:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id B86C817C4B; Mon, 10 Dec 2018 09:50:32 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADA9E5DD6B; Mon, 10 Dec 2018 09:50:32 +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 44092C050E19; Mon, 10 Dec 2018 09:50:31 +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); Mon, 10 Dec 2018 02:50:25 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:43 +0100 Message-Id: <20181210094959.11338-9-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.32]); Mon, 10 Dec 2018 09:50:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 10 Dec 2018 09:50:31 +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.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 08/24] libmultipath: decrease log level of word splitting 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 10 Dec 2018 09:50:34 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP This will make log level 4 actually usable. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/util.c b/libmultipath/util.c index 66c47611..b5d2e706 100644 --- a/libmultipath/util.c +++ b/libmultipath/util.c @@ -104,7 +104,7 @@ get_word (char * sentence, char ** word) } strncpy(*word, sentence, len); strchop(*word); - condlog(4, "*word = %s, len = %i", *word, len); + condlog(5, "*word = %s, len = %i", *word, len); if (*p == '\0') return 0; From patchwork Mon Dec 10 09:49:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720945 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 E4D081731 for ; Mon, 10 Dec 2018 09:50:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4AFC29BFF for ; Mon, 10 Dec 2018 09:50:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C92D729C0B; Mon, 10 Dec 2018 09:50:52 +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 74FCB29C35 for ; Mon, 10 Dec 2018 09:50:52 +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 7013637EEF; Mon, 10 Dec 2018 09:50:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3195F60158; Mon, 10 Dec 2018 09:50:50 +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 E86453F602; Mon, 10 Dec 2018 09:50:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oYdc010790 for ; Mon, 10 Dec 2018 04:50:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 16E5B1054FD3; Mon, 10 Dec 2018 09:50:34 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2FEE1001F5E; Mon, 10 Dec 2018 09:50:32 +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 53DD558E2E; Mon, 10 Dec 2018 09:50:31 +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); Mon, 10 Dec 2018 02:50:27 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:44 +0100 Message-Id: <20181210094959.11338-10-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.39]); Mon, 10 Dec 2018 09:50:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 10 Dec 2018 09:50:31 +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.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 09/24] libmultipath: increase log level of map removal 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.29]); Mon, 10 Dec 2018 09:50:51 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP This is an important event which we want to see with -v3. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/structs_vec.c | 6 +++--- multipathd/main.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index e28a88ac..01391d77 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -113,8 +113,6 @@ remove_map(struct multipath * mpp, struct vectors * vecs, int purge_vec) { int i; - condlog(4, "%s: remove multipath map", mpp->alias); - /* * clear references to this map */ @@ -134,8 +132,10 @@ void remove_map_by_alias(const char *alias, struct vectors * vecs, int purge_vec) { struct multipath * mpp = find_mp_by_alias(vecs->mpvec, alias); - if (mpp) + if (mpp) { + condlog(2, "%s: removing map by alias", alias); remove_map(mpp, vecs, purge_vec); + } } void diff --git a/multipathd/main.c b/multipathd/main.c index e07ef502..85055993 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -334,6 +334,7 @@ remove_map_and_stop_waiter(struct multipath *mpp, struct vectors *vecs) { /* devices are automatically removed by the dmevent polling code, * so they don't need to be manually removed here */ + condlog(3, "%s: removing map from internal tables", mpp->alias); if (!poll_dmevents) stop_waiter_thread(mpp, vecs); remove_map(mpp, vecs, PURGE_VEC); From patchwork Mon Dec 10 09:49:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720955 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 CAB2B109C for ; Mon, 10 Dec 2018 09:50:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9BD429BCB for ; Mon, 10 Dec 2018 09:50:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC26D29C45; Mon, 10 Dec 2018 09:50:57 +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 369BF29C35 for ; Mon, 10 Dec 2018 09:50:57 +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 4D44E58E51; Mon, 10 Dec 2018 09:50:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 202996031B; Mon, 10 Dec 2018 09:50:56 +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 DB5F03F606; Mon, 10 Dec 2018 09:50:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oi3C010853 for ; Mon, 10 Dec 2018 04:50:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5B6E619C7F; Mon, 10 Dec 2018 09:50:44 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 278BB19747; Mon, 10 Dec 2018 09:50:43 +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 86B6B307D91A; Mon, 10 Dec 2018 09:50:40 +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); Mon, 10 Dec 2018 02:50:28 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:45 +0100 Message-Id: <20181210094959.11338-11-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.48]); Mon, 10 Dec 2018 09:50:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 10 Dec 2018 09:50:40 +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.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 10/24] multipathd: decrease log level of checker timing 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.39]); Mon, 10 Dec 2018 09:50:56 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP These messages, printed for every checker invocation, were helpful in the past but they don't make much sense under normal operations. The same information can be derived from journal time stamps on recent Linux distributions. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- multipathd/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 85055993..4d7c2598 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2262,7 +2262,7 @@ checkerloop (void *ap) if (num_paths) { unsigned int max_checkint; - condlog(3, "checked %d path%s in %lu.%06lu secs", + condlog(4, "checked %d path%s in %lu.%06lu secs", num_paths, num_paths > 1 ? "s" : "", diff_time.tv_sec, diff_time.tv_nsec / 1000); From patchwork Mon Dec 10 09:49:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720951 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 228D318B8 for ; Mon, 10 Dec 2018 09:50:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11A0728761 for ; Mon, 10 Dec 2018 09:50:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05FE929C19; Mon, 10 Dec 2018 09:50:55 +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 B0E5C28761 for ; Mon, 10 Dec 2018 09:50:54 +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 5399B37E74; Mon, 10 Dec 2018 09:50:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2046D600D7; Mon, 10 Dec 2018 09:50:53 +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 DEA5A3F605; Mon, 10 Dec 2018 09:50:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oiSR010843 for ; Mon, 10 Dec 2018 04:50:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id F0F551974D; Mon, 10 Dec 2018 09:50:43 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A8EC919C7C; Mon, 10 Dec 2018 09:50:41 +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 A13AC3002F85; Mon, 10 Dec 2018 09:50:40 +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); Mon, 10 Dec 2018 02:50:30 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:46 +0100 Message-Id: <20181210094959.11338-12-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.47]); Mon, 10 Dec 2018 09:50:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 10 Dec 2018 09:50:40 +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.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 11/24] libmultipath: decrease log level of "prioritizer refcount" message 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.29]); Mon, 10 Dec 2018 09:50:54 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP This was important during development of the refcounting code, but now it isn't any more. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/prio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/prio.c b/libmultipath/prio.c index 17acfd05..0590218d 100644 --- a/libmultipath/prio.c +++ b/libmultipath/prio.c @@ -42,7 +42,7 @@ void free_prio (struct prio * p) return; p->refcount--; if (p->refcount) { - condlog(3, "%s prioritizer refcount %d", + condlog(4, "%s prioritizer refcount %d", p->name, p->refcount); return; } From patchwork Mon Dec 10 09:49:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720959 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 E2457112E for ; Mon, 10 Dec 2018 09:51:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D221528736 for ; Mon, 10 Dec 2018 09:51:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C717729C39; Mon, 10 Dec 2018 09:51:00 +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 07F2329C61 for ; Mon, 10 Dec 2018 09:50:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 78AD1811D7; Mon, 10 Dec 2018 09:50:57 +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 3BFE119495; Mon, 10 Dec 2018 09:50:57 +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 EB9D01832E8F; Mon, 10 Dec 2018 09:50:56 +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 wBA9ojI8010873 for ; Mon, 10 Dec 2018 04:50:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id C4BDA17D4D; Mon, 10 Dec 2018 09:50:45 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C401A18171; Mon, 10 Dec 2018 09:50:41 +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 C48A9308A96B; Mon, 10 Dec 2018 09:50:40 +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); Mon, 10 Dec 2018 02:50:31 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:47 +0100 Message-Id: <20181210094959.11338-13-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.41]); Mon, 10 Dec 2018 09:50:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 10 Dec 2018 09:50:41 +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.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 12/24] libmpathpersist/update_map_pr: decrease log level for nop 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 10 Dec 2018 09:50:58 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP No need to log at -v3 if nothing to do. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmpathpersist/mpath_persist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c index 7e8a676c..6505774f 100644 --- a/libmpathpersist/mpath_persist.c +++ b/libmpathpersist/mpath_persist.c @@ -889,7 +889,8 @@ int update_map_pr(struct multipath *mpp) if (!get_be64(mpp->reservation_key)) { /* Nothing to do. Assuming pr mgmt feature is disabled*/ - condlog(3, "%s: reservation_key not set in multipath.conf", mpp->alias); + condlog(4, "%s: reservation_key not set in multipath.conf", + mpp->alias); return MPATH_PR_SUCCESS; } From patchwork Mon Dec 10 09:49: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: 10720953 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 D6A74109C for ; Mon, 10 Dec 2018 09:50:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C666429C11 for ; Mon, 10 Dec 2018 09:50:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BACD529C39; Mon, 10 Dec 2018 09:50:55 +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 508AD29C19 for ; Mon, 10 Dec 2018 09:50:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C651C044CBB; Mon, 10 Dec 2018 09:50:54 +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 4A4A517CE9; Mon, 10 Dec 2018 09:50:54 +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 0CF20181B9F6; Mon, 10 Dec 2018 09:50:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oj7d010868 for ; Mon, 10 Dec 2018 04:50:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7FB22608F6; Mon, 10 Dec 2018 09:50:45 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 245E0608DA; Mon, 10 Dec 2018 09:50:43 +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 E0456C049587; Mon, 10 Dec 2018 09:50:40 +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); Mon, 10 Dec 2018 02:50:33 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:48 +0100 Message-Id: <20181210094959.11338-14-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.31]); Mon, 10 Dec 2018 09:50:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 10 Dec 2018 09:50:41 +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.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 13/24] libmultipath: simplify devt2devname() 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 10 Dec 2018 09:50:54 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Since 1e79548, we don't fallback from /sys/dev/block to /proc/partitions anyway. The strncmp() at "skip_proc" is doomed to fail. So we might as well return immediately. Also, decrease the log level; whether this failure is noteworthy is rather up to the callers to decide. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libmultipath/util.c b/libmultipath/util.c index b5d2e706..28eb7577 100644 --- a/libmultipath/util.c +++ b/libmultipath/util.c @@ -191,7 +191,8 @@ int devt2devname(char *devname, int devname_len, char *devt) return 0; } } - goto skip_proc; + condlog(4, "%s is invalid", block_path); + return 1; } memset(block_path, 0, sizeof(block_path)); @@ -220,7 +221,7 @@ int devt2devname(char *devname, int devname_len, char *devt) } } fclose(fd); -skip_proc: + if (strncmp(block_path,"/sys/block", 10)) { condlog(3, "No device found for %u:%u", major, minor); return 1; From patchwork Mon Dec 10 09:49:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720943 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 787BD109C for ; Mon, 10 Dec 2018 09:50:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6353529C06 for ; Mon, 10 Dec 2018 09:50:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57CCA29C0B; Mon, 10 Dec 2018 09:50:52 +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 EB85429C06 for ; Mon, 10 Dec 2018 09:50:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5FF885A07; Mon, 10 Dec 2018 09:50:50 +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 5222B5C221; Mon, 10 Dec 2018 09:50:50 +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 16697181B9F6; Mon, 10 Dec 2018 09:50:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9og7H010833 for ; Mon, 10 Dec 2018 04:50:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6B93F1054FD3; Mon, 10 Dec 2018 09:50:42 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 613191001947; Mon, 10 Dec 2018 09:50:42 +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 0B175C0624CB; Mon, 10 Dec 2018 09:50:41 +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); Mon, 10 Dec 2018 02:50:34 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:49 +0100 Message-Id: <20181210094959.11338-15-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.32]); Mon, 10 Dec 2018 09:50:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 10 Dec 2018 09:50:41 +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.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 14/24] libmultipath: decrease log level for failed VPD c9 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 10 Dec 2018 09:50:51 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP It's normal that SCSI devices don't support this page. Only RDAC devices need it. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 1c87277f..7f983a63 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1106,7 +1106,9 @@ get_vpd_sgio (int fd, int pg, char * str, int maxlen) memset(buff, 0x0, 4096); if (sgio_get_vpd(buff, 4096, fd, pg) < 0) { - condlog(3, "failed to issue vpd inquiry for pg%02x", + int lvl = pg == 0x80 || pg == 0x83 ? 3 : 4; + + condlog(lvl, "failed to issue vpd inquiry for pg%02x", pg); return -errno; } From patchwork Mon Dec 10 09:49:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720949 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 996A9109C for ; Mon, 10 Dec 2018 09:50:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87F5A29C7C for ; Mon, 10 Dec 2018 09:50:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CAB929C0B; Mon, 10 Dec 2018 09:50:54 +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 187AB29C54 for ; Mon, 10 Dec 2018 09:50:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42A9F8830E; Mon, 10 Dec 2018 09:50:53 +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 16B501054FD3; Mon, 10 Dec 2018 09:50:53 +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 D519E181B9F6; Mon, 10 Dec 2018 09:50:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oiYr010844 for ; Mon, 10 Dec 2018 04:50:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id F12C71974F; Mon, 10 Dec 2018 09:50:43 +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 256F719936; Mon, 10 Dec 2018 09:50:43 +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 1AA1986663; Mon, 10 Dec 2018 09:50:41 +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); Mon, 10 Dec 2018 02:50:36 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:50 +0100 Message-Id: <20181210094959.11338-16-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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]); Mon, 10 Dec 2018 09:50:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 10 Dec 2018 09:50:41 +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.84 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 15/24] libmultipath: adopt_paths: check for size match 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 10 Dec 2018 09:50:53 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP In coalesce_paths() and ev_add_path(), we check for size mismatch. We should do it here, too. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/structs_vec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 01391d77..5305bd31 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -60,6 +60,12 @@ int adopt_paths(vector pathvec, struct multipath *mpp) vector_foreach_slot (pathvec, pp, i) { if (!strncmp(mpp->wwid, pp->wwid, WWID_SIZE)) { + if (pp->size != 0 && mpp->size != 0 && + pp->size != mpp->size) { + condlog(3, "%s: size mismatch for %s, not adding path", + pp->dev, mpp->alias); + continue; + } condlog(3, "%s: ownership set to %s", pp->dev, mpp->alias); pp->mpp = mpp; From patchwork Mon Dec 10 09:49:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720957 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 317BF109C for ; Mon, 10 Dec 2018 09:50:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1ED7329C04 for ; Mon, 10 Dec 2018 09:50:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F5FE29BFF; Mon, 10 Dec 2018 09:50:59 +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 3030A29BFF for ; Mon, 10 Dec 2018 09:50:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2555530001EF; Mon, 10 Dec 2018 09:50:56 +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 F41225D759; Mon, 10 Dec 2018 09:50:55 +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 BF66618327E8; Mon, 10 Dec 2018 09:50:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9oj58010859 for ; Mon, 10 Dec 2018 04:50:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 633F45D75F; Mon, 10 Dec 2018 09:50:45 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04BDD5D738; Mon, 10 Dec 2018 09:50:43 +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 3EC8458E40; Mon, 10 Dec 2018 09:50:41 +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); Mon, 10 Dec 2018 02:50:37 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:51 +0100 Message-Id: <20181210094959.11338-17-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.39]); Mon, 10 Dec 2018 09:50:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 10 Dec 2018 09:50:41 +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.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 16/24] libmultipath: coalesce_paths: fix size mismatch handling 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 10 Dec 2018 09:50:56 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP When there are paths with the same WWID but different sizes, and coalesce_paths() walks the pathvec, it checks paths _after_ the current one for size mismatch and sets ACT_REJECT. However, these paths will be reached in the main loop later, and this time the already handled paths will not be checked for size mismatch; thus a map could be created, possibly even with mismatching devices. Fix that by tracking which paths were already discarded, and skipping them in the main loop later. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/configure.c | 32 ++++++++++++++++++++++++-------- libmultipath/util.h | 16 ++++++++++++++++ 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 406cd4c9..f48664a0 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -1009,6 +1009,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, vector pathvec = vecs->pathvec; struct config *conf; int allow_queueing; + uint64_t *size_mismatch_seen; /* ignore refwwid if it's empty */ if (refwwid && !strlen(refwwid)) @@ -1019,6 +1020,14 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, pp1->mpp = NULL; } } + + if (VECTOR_SIZE(pathvec) == 0) + return 0; + size_mismatch_seen = calloc((VECTOR_SIZE(pathvec) - 1) / 64 + 1, + sizeof(uint64_t)); + if (size_mismatch_seen == NULL) + return 1; + vector_foreach_slot (pathvec, pp1, k) { int invalid; /* skip this path for some reason */ @@ -1038,8 +1047,8 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, continue; } - /* 2. if path already coalesced */ - if (pp1->mpp) + /* 2. if path already coalesced, or seen and discarded */ + if (pp1->mpp || is_bit_set_in_array(k, size_mismatch_seen)) continue; /* 3. if path has disappeared */ @@ -1088,9 +1097,10 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, * ouch, avoid feeding that to the DM */ condlog(0, "%s: size %llu, expected %llu. " - "Discard", pp2->dev_t, pp2->size, + "Discard", pp2->dev, pp2->size, mpp->size); mpp->action = ACT_REJECT; + set_bit_in_array(i, size_mismatch_seen); } } verify_paths(mpp, vecs); @@ -1119,8 +1129,9 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, "ignoring" : "removing"); remove_map(mpp, vecs, 0); continue; - } else /* if (r == DOMAP_RETRY) */ - return r; + } else /* if (r == DOMAP_RETRY && !is_daemon) */ { + goto out; + } } if (r == DOMAP_DRY) continue; @@ -1161,8 +1172,10 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, if (newmp) { if (mpp->action != ACT_REJECT) { - if (!vector_alloc_slot(newmp)) - return 1; + if (!vector_alloc_slot(newmp)) { + r = 1; + goto out; + } vector_set_slot(newmp, mpp); } else @@ -1193,7 +1206,10 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, condlog(2, "%s: remove (dead)", alias); } } - return 0; + r = 0; +out: + free(size_mismatch_seen); + return r; } struct udev_device *get_udev_device(const char *dev, enum devtypes dev_type) diff --git a/libmultipath/util.h b/libmultipath/util.h index a818e29a..1f13c913 100644 --- a/libmultipath/util.h +++ b/libmultipath/util.h @@ -3,6 +3,7 @@ #include #include +#include size_t strchop(char *); int basenamecpy (const char *src, char *dst, size_t size); @@ -39,4 +40,19 @@ struct scandir_result { }; void free_scandir_result(struct scandir_result *); +static inline bool is_bit_set_in_array(unsigned int bit, const uint64_t *arr) +{ + return arr[bit / 64] & (1ULL << (bit % 64)) ? 1 : 0; +} + +static inline void set_bit_in_array(unsigned int bit, uint64_t *arr) +{ + arr[bit / 64] |= (1ULL << (bit % 64)); +} + +static inline void clear_bit_in_array(unsigned int bit, uint64_t *arr) +{ + arr[bit / 64] &= ~(1ULL << (bit % 64)); +} + #endif /* _UTIL_H */ From patchwork Mon Dec 10 09:49:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720947 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 43858109C for ; Mon, 10 Dec 2018 09:50:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 324DD29BFF for ; Mon, 10 Dec 2018 09:50:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26AE429C5D; Mon, 10 Dec 2018 09:50:53 +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 95CD129C11 for ; Mon, 10 Dec 2018 09:50:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 79D4A308A96B; Mon, 10 Dec 2018 09:50:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51684608EF; Mon, 10 Dec 2018 09:50:51 +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 1E8A13F604; Mon, 10 Dec 2018 09:50:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9ojCC010858 for ; Mon, 10 Dec 2018 04:50:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 61E805D75C; Mon, 10 Dec 2018 09:50:45 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C8D35D73F; Mon, 10 Dec 2018 09:50:43 +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 A335E30832CA; Mon, 10 Dec 2018 09:50:41 +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); Mon, 10 Dec 2018 02:50:39 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:52 +0100 Message-Id: <20181210094959.11338-18-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.44]); Mon, 10 Dec 2018 09:50:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 10 Dec 2018 09:50:42 +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.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 17/24] tests: add unit tests for bitmask functions 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 10 Dec 2018 09:50:52 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Add unit tests for the bitmask management functions the previous patch added in util.h. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- tests/util.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/tests/util.c b/tests/util.c index 839effd2..e6d4b9ab 100644 --- a/tests/util.c +++ b/tests/util.c @@ -26,6 +26,8 @@ #include "globals.c" +#define BITARR_SZ 4 + static void test_basenamecpy_good0(void **state) { char dst[10]; @@ -139,6 +141,100 @@ static void test_basenamecpy_bad5(void **state) assert_int_equal(basenamecpy("baz/qux", NULL, sizeof(dst)), 0); } +static void test_bitmask_1(void **state) +{ + uint64_t arr[BITARR_SZ]; + int i, j, k, m, b; + + memset(arr, 0, sizeof(arr)); + + for (j = 0; j < BITARR_SZ; j++) { + for (i = 0; i < 64; i++) { + b = 64 * j + i; + assert(!is_bit_set_in_array(b, arr)); + set_bit_in_array(b, arr); + for (k = 0; k < BITARR_SZ; k++) { + printf("b = %d j = %d k = %d a = %"PRIx64"\n", + b, j, k, arr[k]); + if (k == j) + assert_int_equal(arr[j], 1ULL << i); + else + assert_int_equal(arr[k], 0ULL); + } + for (m = 0; m < 64; m++) + if (i == m) + assert(is_bit_set_in_array(64 * j + m, + arr)); + else + assert(!is_bit_set_in_array(64 * j + m, + arr)); + clear_bit_in_array(b, arr); + assert(!is_bit_set_in_array(b, arr)); + for (k = 0; k < BITARR_SZ; k++) + assert_int_equal(arr[k], 0ULL); + } + } +} + +static void test_bitmask_2(void **state) +{ + uint64_t arr[BITARR_SZ]; + int i, j, k, m, b; + + memset(arr, 0, sizeof(arr)); + + for (j = 0; j < BITARR_SZ; j++) { + for (i = 0; i < 64; i++) { + b = 64 * j + i; + assert(!is_bit_set_in_array(b, arr)); + set_bit_in_array(b, arr); + for (m = 0; m < 64; m++) + if (m <= i) + assert(is_bit_set_in_array(64 * j + m, + arr)); + else + assert(!is_bit_set_in_array(64 * j + m, + arr)); + assert(is_bit_set_in_array(b, arr)); + for (k = 0; k < BITARR_SZ; k++) { + if (k < j || (k == j && i == 63)) + assert_int_equal(arr[k], ~0ULL); + else if (k > j) + assert_int_equal(arr[k], 0ULL); + else + assert_int_equal( + arr[k], + (1ULL << (i + 1)) - 1); + } + } + } + for (j = 0; j < BITARR_SZ; j++) { + for (i = 0; i < 64; i++) { + b = 64 * j + i; + assert(is_bit_set_in_array(b, arr)); + clear_bit_in_array(b, arr); + for (m = 0; m < 64; m++) + if (m <= i) + assert(!is_bit_set_in_array(64 * j + m, + arr)); + else + assert(is_bit_set_in_array(64 * j + m, + arr)); + assert(!is_bit_set_in_array(b, arr)); + for (k = 0; k < BITARR_SZ; k++) { + if (k < j || (k == j && i == 63)) + assert_int_equal(arr[k], 0ULL); + else if (k > j) + assert_int_equal(arr[k], ~0ULL); + else + assert_int_equal( + arr[k], + ~((1ULL << (i + 1)) - 1)); + } + } + } +} + int test_basenamecpy(void) { const struct CMUnitTest tests[] = { @@ -156,6 +252,8 @@ int test_basenamecpy(void) cmocka_unit_test(test_basenamecpy_bad3), cmocka_unit_test(test_basenamecpy_bad4), cmocka_unit_test(test_basenamecpy_bad5), + cmocka_unit_test(test_bitmask_1), + cmocka_unit_test(test_bitmask_2), }; return cmocka_run_group_tests(tests, NULL, NULL); } From patchwork Mon Dec 10 09:49:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720967 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 09FC0112E for ; Mon, 10 Dec 2018 09:51:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED97E29C45 for ; Mon, 10 Dec 2018 09:51:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1F3029C11; Mon, 10 Dec 2018 09:51:04 +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 88E7529CCF for ; Mon, 10 Dec 2018 09:51:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B61A9C049DFC; Mon, 10 Dec 2018 09:51:02 +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 7EE5D60C66; Mon, 10 Dec 2018 09:51:02 +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 3E4051843669; Mon, 10 Dec 2018 09:51:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9osCN010935 for ; Mon, 10 Dec 2018 04:50:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id AEA0B6015E; Mon, 10 Dec 2018 09:50:54 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 960726012B; Mon, 10 Dec 2018 09:50:52 +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 7CE54307D849; Mon, 10 Dec 2018 09:50:51 +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); Mon, 10 Dec 2018 02:50:40 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:53 +0100 Message-Id: <20181210094959.11338-19-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.48]); Mon, 10 Dec 2018 09:50:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 10 Dec 2018 09:50:51 +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.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 18/24] multipathd: uev_remove_path: remove redundant orphan_paths call 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 10 Dec 2018 09:51:04 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP The remove_map_and_stop_waiter() call which follows immediately will do the same thing. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- multipathd/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 4d7c2598..5e6c35d4 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -786,7 +786,6 @@ uev_remove_map (struct uevent * uev, struct vectors * vecs) goto out; } - orphan_paths(vecs->pathvec, mpp); remove_map_and_stop_waiter(mpp, vecs); out: lock_cleanup_pop(vecs->lock); From patchwork Mon Dec 10 09:49:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720961 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 25A4A1731 for ; Mon, 10 Dec 2018 09:51:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1300128736 for ; Mon, 10 Dec 2018 09:51:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 077D829C39; Mon, 10 Dec 2018 09:51:01 +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 9913B29C11 for ; Mon, 10 Dec 2018 09:51:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9AED2308A94E; Mon, 10 Dec 2018 09:50:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 705835D763; Mon, 10 Dec 2018 09:50:59 +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 3654E3F609; Mon, 10 Dec 2018 09:50:59 +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 wBA9orF2010917 for ; Mon, 10 Dec 2018 04:50:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id E1E6E5DD8A; Mon, 10 Dec 2018 09:50:52 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C270B1816C; Mon, 10 Dec 2018 09:50:52 +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 9DE6C308123E; Mon, 10 Dec 2018 09:50:51 +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); Mon, 10 Dec 2018 02:50:41 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:54 +0100 Message-Id: <20181210094959.11338-20-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.49]); Mon, 10 Dec 2018 09:50:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 10 Dec 2018 09:50:51 +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.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 19/24] libmultipath: improve logging from orphan_paths 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 10 Dec 2018 09:51:00 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP It's a big difference if a map is flushed from DM (changing kernel state) or just removed from internal multipathd tables. Convey this information in log messages. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/structs_vec.c | 6 +++--- libmultipath/structs_vec.h | 3 ++- multipathd/main.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 5305bd31..03e2b978 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -102,14 +102,14 @@ void orphan_path(struct path *pp, const char *reason) pp->fd = -1; } -void orphan_paths(vector pathvec, struct multipath *mpp) +void orphan_paths(vector pathvec, struct multipath *mpp, const char *reason) { int i; struct path * pp; vector_foreach_slot (pathvec, pp, i) { if (pp->mpp == mpp) { - orphan_path(pp, "map flushed"); + orphan_path(pp, reason); } } } @@ -122,7 +122,7 @@ remove_map(struct multipath * mpp, struct vectors * vecs, int purge_vec) /* * clear references to this map */ - orphan_paths(vecs->pathvec, mpp); + orphan_paths(vecs->pathvec, mpp, "map removed internally"); if (purge_vec && (i = find_slot(vecs->mpvec, (void *)mpp)) != -1) diff --git a/libmultipath/structs_vec.h b/libmultipath/structs_vec.h index f7777aaf..f8b9f63e 100644 --- a/libmultipath/structs_vec.h +++ b/libmultipath/structs_vec.h @@ -14,7 +14,8 @@ struct vectors { void enter_recovery_mode(struct multipath *mpp); int adopt_paths (vector pathvec, struct multipath * mpp); -void orphan_paths (vector pathvec, struct multipath * mpp); +void orphan_paths(vector pathvec, struct multipath *mpp, + const char *reason); void orphan_path (struct path * pp, const char *reason); int verify_paths(struct multipath * mpp, struct vectors * vecs); diff --git a/multipathd/main.c b/multipathd/main.c index 5e6c35d4..04f02d99 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -654,7 +654,7 @@ flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths) condlog(2, "%s: map flushed", mpp->alias); } - orphan_paths(vecs->pathvec, mpp); + orphan_paths(vecs->pathvec, mpp, "map flushed"); remove_map_and_stop_waiter(mpp, vecs); return 0; From patchwork Mon Dec 10 09:49:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720971 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 0BBF3112E for ; Mon, 10 Dec 2018 09:51:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC0AA29C35 for ; Mon, 10 Dec 2018 09:51:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E113729C7C; Mon, 10 Dec 2018 09:51:08 +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 961D229C54 for ; Mon, 10 Dec 2018 09:51:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 70D4430022E0; Mon, 10 Dec 2018 09:51:07 +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 44FB85D759; Mon, 10 Dec 2018 09:51:07 +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 08817184B54D; Mon, 10 Dec 2018 09:51:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9osGu010938 for ; Mon, 10 Dec 2018 04:50:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id B2A66605C7; Mon, 10 Dec 2018 09:50:54 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2442600D6; Mon, 10 Dec 2018 09:50:52 +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 BE0F388313; Mon, 10 Dec 2018 09:50:51 +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); Mon, 10 Dec 2018 02:50:43 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:55 +0100 Message-Id: <20181210094959.11338-21-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.28]); Mon, 10 Dec 2018 09:50:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 10 Dec 2018 09:50:52 +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.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 20/24] libmultipath: avoid syslog loglevel > LOG_DEBUG 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 10 Dec 2018 09:51:08 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP We use condlog(5, ...) in some places, which doesn't work well with syslog. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/log_pthread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libmultipath/log_pthread.c b/libmultipath/log_pthread.c index bb35dfc7..be57bb1a 100644 --- a/libmultipath/log_pthread.c +++ b/libmultipath/log_pthread.c @@ -25,6 +25,9 @@ static int log_messages_pending; void log_safe (int prio, const char * fmt, va_list ap) { + if (prio > LOG_DEBUG) + prio = LOG_DEBUG; + if (log_thr == (pthread_t)0) { vsyslog(prio, fmt, ap); return; From patchwork Mon Dec 10 09:49:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720973 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 9344D112E for ; Mon, 10 Dec 2018 09:51:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F69E29C24 for ; Mon, 10 Dec 2018 09:51:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 743DA29D19; Mon, 10 Dec 2018 09:51:12 +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 EF38829C24 for ; Mon, 10 Dec 2018 09:51:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 90F5830832CE; Mon, 10 Dec 2018 09:51:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6142019747; Mon, 10 Dec 2018 09:51:10 +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 278A43F609; Mon, 10 Dec 2018 09:51: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 wBA9ostM010954 for ; Mon, 10 Dec 2018 04:50:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id E19B35DD8A; Mon, 10 Dec 2018 09:50:54 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4BA617DE5; Mon, 10 Dec 2018 09:50:54 +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 DF1EE8831A; Mon, 10 Dec 2018 09:50:51 +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); Mon, 10 Dec 2018 02:50:44 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:56 +0100 Message-Id: <20181210094959.11338-22-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.28]); Mon, 10 Dec 2018 09:50:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 10 Dec 2018 09:50:52 +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.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 21/24] coalesce_paths(): use symbolic return value 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 10 Dec 2018 09:51:11 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Use an enum to represent the return value of coalesce_paths() to improve readability of the code. This patch doesn't introduce changes in behavior. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/configure.c | 17 ++++++++--------- libmultipath/configure.h | 10 ++++++++++ multipath/main.c | 5 +++-- multipathd/cli_handlers.c | 3 ++- multipathd/main.c | 2 +- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index f48664a0..5daf0c13 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -998,8 +998,8 @@ out: int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_reload, enum mpath_cmds cmd) { - int r = 1; - int k, i; + int ret = CP_FAIL; + int k, i, r; int is_daemon = (cmd == CMD_NONE) ? 1 : 0; char params[PARAMS_SIZE]; struct multipath * mpp; @@ -1022,11 +1022,11 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, } if (VECTOR_SIZE(pathvec) == 0) - return 0; + return CP_OK; size_mismatch_seen = calloc((VECTOR_SIZE(pathvec) - 1) / 64 + 1, sizeof(uint64_t)); if (size_mismatch_seen == NULL) - return 1; + return CP_FAIL; vector_foreach_slot (pathvec, pp1, k) { int invalid; @@ -1130,6 +1130,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, remove_map(mpp, vecs, 0); continue; } else /* if (r == DOMAP_RETRY && !is_daemon) */ { + ret = CP_RETRY; goto out; } } @@ -1172,10 +1173,8 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, if (newmp) { if (mpp->action != ACT_REJECT) { - if (!vector_alloc_slot(newmp)) { - r = 1; + if (!vector_alloc_slot(newmp)) goto out; - } vector_set_slot(newmp, mpp); } else @@ -1206,10 +1205,10 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, condlog(2, "%s: remove (dead)", alias); } } - r = 0; + ret = CP_OK; out: free(size_mismatch_seen); - return r; + return ret; } struct udev_device *get_udev_device(const char *dev, enum devtypes dev_type) diff --git a/libmultipath/configure.h b/libmultipath/configure.h index 8b56d33a..64520c57 100644 --- a/libmultipath/configure.h +++ b/libmultipath/configure.h @@ -23,6 +23,16 @@ enum actions { ACT_IMPOSSIBLE, }; +/* + * Return value of coalesce_paths() + * CP_RETRY is only used in non-daemon case (multipath). + */ +enum { + CP_OK = 0, + CP_FAIL, + CP_RETRY, +}; + #define FLUSH_ONE 1 #define FLUSH_ALL 2 diff --git a/multipath/main.c b/multipath/main.c index 98fee1c7..1d34b87b 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -537,7 +537,7 @@ configure (struct config *conf, enum mpath_cmds cmd, vector curmp = NULL; vector pathvec = NULL; struct vectors vecs; - int r = 1; + int r = 1, rc; int di_flag = 0; char * refwwid = NULL; char * dev = NULL; @@ -752,8 +752,9 @@ configure (struct config *conf, enum mpath_cmds cmd, /* * core logic entry point */ - r = coalesce_paths(&vecs, NULL, refwwid, + rc = coalesce_paths(&vecs, NULL, refwwid, conf->force_reload, cmd); + r = rc == CP_RETRY ? -1 : rc == CP_OK ? 0 : 1; print_valid: if (cmd == CMD_VALID_PATH) diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index a0d57a53..4fbd8841 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -803,7 +803,8 @@ cli_add_map (void * v, char ** reply, int * len, void * data) vecs->pathvec, &refwwid); if (refwwid) { if (coalesce_paths(vecs, NULL, refwwid, - FORCE_RELOAD_NONE, CMD_NONE)) + FORCE_RELOAD_NONE, CMD_NONE) + != CP_OK) condlog(2, "%s: coalesce_paths failed", param); dm_lib_release(); diff --git a/multipathd/main.c b/multipathd/main.c index 04f02d99..fd1ac8fe 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2366,7 +2366,7 @@ configure (struct vectors * vecs) ret = coalesce_paths(vecs, mpvec, NULL, force_reload, CMD_NONE); if (force_reload == FORCE_RELOAD_WEAK) force_reload = FORCE_RELOAD_YES; - if (ret) { + if (ret != CP_OK) { condlog(0, "configure failed while coalescing paths"); goto fail; } From patchwork Mon Dec 10 09:49:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720963 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 A56B4109C for ; Mon, 10 Dec 2018 09:51:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9452429C00 for ; Mon, 10 Dec 2018 09:51:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82B9229C39; Mon, 10 Dec 2018 09:51:01 +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 1D32129C35 for ; Mon, 10 Dec 2018 09:51:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6CA3430832CA; Mon, 10 Dec 2018 09:50:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3365619747; Mon, 10 Dec 2018 09:50:59 +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 E32AE3F607; Mon, 10 Dec 2018 09:50:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9orI8010922 for ; Mon, 10 Dec 2018 04:50:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id B1DAB19936; Mon, 10 Dec 2018 09:50:53 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A20CA19C7C; Mon, 10 Dec 2018 09:50:53 +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 0ADC081DEB; Mon, 10 Dec 2018 09:50:52 +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); Mon, 10 Dec 2018 02:50:46 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:57 +0100 Message-Id: <20181210094959.11338-23-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.25]); Mon, 10 Dec 2018 09:50:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 10 Dec 2018 09:50:52 +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.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 22/24] domap(): use symbolic return value 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 10 Dec 2018 09:51:00 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Use an enum for the already-symbolic return value of domap(), and avoid the use of "<= 0" for the return value, which is against the spirit of symbolic values. A return value less or equal than 0 means DOMAP_FAIL or DOMAP_RETRY. Use the fact that DOMAP_RETRY is only returned in the ACT_CREATE case for simplification of the logic in those cases where ACT_CREATE is not used. Signed-off-by: Martin Wilck --- libmultipath/configure.c | 9 --------- libmultipath/configure.h | 13 +++++++++++++ multipathd/cli_handlers.c | 2 +- multipathd/main.c | 8 ++++---- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 5daf0c13..84ae5f56 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -788,15 +788,6 @@ fail: return 1; } -/* - * Return value: - */ -#define DOMAP_RETRY -1 -#define DOMAP_FAIL 0 -#define DOMAP_OK 1 -#define DOMAP_EXIST 2 -#define DOMAP_DRY 3 - int domap(struct multipath *mpp, char *params, int is_daemon) { int r = DOMAP_FAIL; diff --git a/libmultipath/configure.h b/libmultipath/configure.h index 64520c57..1b73bf42 100644 --- a/libmultipath/configure.h +++ b/libmultipath/configure.h @@ -23,6 +23,19 @@ enum actions { ACT_IMPOSSIBLE, }; +/* + * Return value of domap() + * DAEMON_RETRY is only used in non-daemon case (multipath), + * and only for ACT_CREATE (see domap()). + */ +enum { + DOMAP_RETRY = -1, + DOMAP_FAIL = 0, + DOMAP_OK = 1, + DOMAP_EXIST = 2, + DOMAP_DRY = 3 +}; + /* * Return value of coalesce_paths() * CP_RETRY is only used in non-daemon case (multipath). diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index 4fbd8841..14aec17b 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -893,7 +893,7 @@ int resize_map(struct multipath *mpp, unsigned long long size, } mpp->action = ACT_RESIZE; mpp->force_udev_reload = 1; - if (domap(mpp, params, 1) <= 0) { + if (domap(mpp, params, 1) == DOMAP_FAIL) { condlog(0, "%s: failed to resize map : %s", mpp->alias, strerror(errno)); mpp->size = orig_size; diff --git a/multipathd/main.c b/multipathd/main.c index fd1ac8fe..fd3459f7 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -497,7 +497,7 @@ retry: retries = -1; goto fail; } - if (domap(mpp, params, 1) <= 0 && retries-- > 0) { + if (domap(mpp, params, 1) == DOMAP_FAIL && retries-- > 0) { condlog(0, "%s: map_udate sleep", mpp->alias); sleep(1); goto retry; @@ -995,8 +995,8 @@ rescan: */ retry: ret = domap(mpp, params, 1); - if (ret <= 0) { - if (ret < 0 && retries-- > 0) { + if (ret == DOMAP_FAIL || ret == DOMAP_RETRY) { + if (ret == DOMAP_RETRY && retries-- > 0) { condlog(0, "%s: retry domap for addition of new " "path %s", mpp->alias, pp->dev); sleep(1); @@ -1152,7 +1152,7 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) * reload the map */ mpp->action = ACT_RELOAD; - if (domap(mpp, params, 1) <= 0) { + if (domap(mpp, params, 1) == DOMAP_FAIL) { condlog(0, "%s: failed in domap for " "removal of path %s", mpp->alias, pp->dev); From patchwork Mon Dec 10 09:49:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720969 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 BF170109C for ; Mon, 10 Dec 2018 09:51:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB51229BF5 for ; Mon, 10 Dec 2018 09:51:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F70F29C54; Mon, 10 Dec 2018 09:51:05 +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 5048429C4D for ; Mon, 10 Dec 2018 09:51:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 50703C056796; Mon, 10 Dec 2018 09:51:04 +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 059F619936; Mon, 10 Dec 2018 09:51:04 +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 B9AF8184B54B; Mon, 10 Dec 2018 09:51:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBA9osdT010934 for ; Mon, 10 Dec 2018 04:50:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id ADB0260158; Mon, 10 Dec 2018 09:50:54 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 438B060151; Mon, 10 Dec 2018 09:50:53 +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 2CD5436887; Mon, 10 Dec 2018 09:50:52 +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); Mon, 10 Dec 2018 02:50:47 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:58 +0100 Message-Id: <20181210094959.11338-24-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.30]); Mon, 10 Dec 2018 09:50:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 10 Dec 2018 09:50:52 +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.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 23/24] multipathd: simplify retry logic in ev_add_path() 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 10 Dec 2018 09:51:04 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Move the retry loop for DOMAP_RETRY out of the redundant outer if conditional, and replace the goto construct with a while loop. Signed-off-by: Martin Wilck --- multipathd/main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index fd3459f7..99145293 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -993,15 +993,14 @@ rescan: /* * reload the map for the multipath mapped device */ -retry: ret = domap(mpp, params, 1); + while (ret == DOMAP_RETRY && retries-- > 0) { + condlog(0, "%s: retry domap for addition of new " + "path %s", mpp->alias, pp->dev); + sleep(1); + ret = domap(mpp, params, 1); + } if (ret == DOMAP_FAIL || ret == DOMAP_RETRY) { - if (ret == DOMAP_RETRY && retries-- > 0) { - condlog(0, "%s: retry domap for addition of new " - "path %s", mpp->alias, pp->dev); - sleep(1); - goto retry; - } condlog(0, "%s: failed in domap for addition of new " "path %s", mpp->alias, pp->dev); /* From patchwork Mon Dec 10 09:49:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10720965 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 8924E112E for ; Mon, 10 Dec 2018 09:51:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7745A29C61 for ; Mon, 10 Dec 2018 09:51:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B5FF29C04; Mon, 10 Dec 2018 09:51:02 +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 92F9429BCB for ; Mon, 10 Dec 2018 09:51:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9BB9C811DD; Mon, 10 Dec 2018 09:51:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 705471054FD3; Mon, 10 Dec 2018 09:51:00 +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 304533F608; Mon, 10 Dec 2018 09:51:00 +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 wBA9osGW010927 for ; Mon, 10 Dec 2018 04:50:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 014775DD8B; Mon, 10 Dec 2018 09:50:54 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E1EC517CE9; Mon, 10 Dec 2018 09:50:53 +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 4B9F4307CDC5; Mon, 10 Dec 2018 09:50:52 +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); Mon, 10 Dec 2018 02:50:49 -0700 From: Martin Wilck To: Christophe Varoqui Date: Mon, 10 Dec 2018 10:49:59 +0100 Message-Id: <20181210094959.11338-25-mwilck@suse.com> In-Reply-To: <20181210094959.11338-1-mwilck@suse.com> References: <20181210094959.11338-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.49]); Mon, 10 Dec 2018 09:50:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 10 Dec 2018 09:50:52 +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.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 24/24] multipath: use symbolic return value and exit code 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 10 Dec 2018 09:51:01 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Use an enum to represent the return code and exit status of multipath and its most important subroutine, configure(). This clarifies the confusing use of booleans and status codes a bit, hopefully. This patch doesn't introduce a change in behavior. Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- multipath/main.c | 120 ++++++++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 54 deletions(-) diff --git a/multipath/main.c b/multipath/main.c index 1d34b87b..f40c179b 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -68,6 +68,19 @@ int logsink; struct udev *udev; struct config *multipath_conf; +/* + * Return values of configure(), print_cmd_valid(), and main(). + * RTVL_{YES,NO} are synonyms for RTVL_{OK,FAIL} for the CMD_VALID_PATH case. + */ +enum { + RTVL_OK = 0, + RTVL_YES = RTVL_OK, + RTVL_FAIL = 1, + RTVL_NO = RTVL_FAIL, + RTVL_MAYBE, /* only used internally, never returned */ + RTVL_RETRY, /* returned by configure(), not by main() */ +}; + struct config *get_multipath_config(void) { return multipath_conf; @@ -475,15 +488,14 @@ retry: static int print_cmd_valid(int k, const vector pathvec, struct config *conf) { - static const int vals[] = { 1, 0, 2 }; int wait = FIND_MULTIPATHS_NEVER; struct timespec until; struct path *pp; - if (k < 0 || k >= (sizeof(vals) / sizeof(int))) - return 1; + if (k != RTVL_YES && k != RTVL_NO && k != RTVL_MAYBE) + return RTVL_NO; - if (k == 2) { + if (k == RTVL_MAYBE) { /* * Caller ensures that pathvec[0] is the path to * examine. @@ -493,7 +505,7 @@ static int print_cmd_valid(int k, const vector pathvec, wait = find_multipaths_check_timeout( pp, pp->find_multipaths_timeout, &until); if (wait != FIND_MULTIPATHS_WAITING) - k = 1; + k = RTVL_NO; } else if (pathvec != NULL && (pp = VECTOR_SLOT(pathvec, 0))) wait = find_multipaths_check_timeout(pp, 0, &until); if (wait == FIND_MULTIPATHS_WAITING) @@ -501,8 +513,10 @@ static int print_cmd_valid(int k, const vector pathvec, until.tv_sec, until.tv_nsec/1000); else if (wait == FIND_MULTIPATHS_WAIT_DONE) printf("FIND_MULTIPATHS_WAIT_UNTIL=\"0\"\n"); - printf("DM_MULTIPATH_DEVICE_PATH=\"%d\"\n", vals[k]); - return k == 1; + printf("DM_MULTIPATH_DEVICE_PATH=\"%d\"\n", + k == RTVL_MAYBE ? 2 : k == RTVL_YES ? 1 : 0); + /* Never return RTVL_MAYBE */ + return k == RTVL_NO ? RTVL_NO : RTVL_YES; } /* @@ -524,12 +538,6 @@ static bool released_to_systemd(void) return ret; } -/* - * Return value: - * -1: Retry - * 0: Success - * 1: Failure - */ static int configure (struct config *conf, enum mpath_cmds cmd, enum devtypes dev_type, char *devpath) @@ -537,7 +545,7 @@ configure (struct config *conf, enum mpath_cmds cmd, vector curmp = NULL; vector pathvec = NULL; struct vectors vecs; - int r = 1, rc; + int r = RTVL_FAIL, rc; int di_flag = 0; char * refwwid = NULL; char * dev = NULL; @@ -585,21 +593,23 @@ configure (struct config *conf, enum mpath_cmds cmd, goto out; } if (cmd == CMD_REMOVE_WWID) { - r = remove_wwid(refwwid); - if (r == 0) + rc = remove_wwid(refwwid); + if (rc == 0) { printf("wwid '%s' removed\n", refwwid); - else if (r == 1) { + r = RTVL_OK; + } else if (rc == 1) { printf("wwid '%s' not in wwids file\n", refwwid); - r = 0; + r = RTVL_OK; } goto out; } if (cmd == CMD_ADD_WWID) { - r = remember_wwid(refwwid); - if (r >= 0) + rc = remember_wwid(refwwid); + if (rc >= 0) { printf("wwid '%s' added\n", refwwid); - else + r = RTVL_OK; + } else printf("failed adding '%s' to wwids file\n", refwwid); goto out; @@ -614,13 +624,13 @@ configure (struct config *conf, enum mpath_cmds cmd, */ if (cmd == CMD_VALID_PATH) { if (is_failed_wwid(refwwid) == WWID_IS_FAILED) { - r = 1; + r = RTVL_NO; goto print_valid; } if ((!find_multipaths_on(conf) && ignore_wwids_on(conf)) || check_wwids_file(refwwid, 0) == 0) - r = 0; + r = RTVL_YES; if (!ignore_wwids_on(conf)) goto print_valid; /* At this point, either r==0 or find_multipaths_on. */ @@ -630,7 +640,7 @@ configure (struct config *conf, enum mpath_cmds cmd, * Quick check if path is already multipathed. */ if (sysfs_is_multipathed(VECTOR_SLOT(pathvec, 0))) { - r = 0; + r = RTVL_YES; goto print_valid; } @@ -644,10 +654,10 @@ configure (struct config *conf, enum mpath_cmds cmd, * Leave DM_MULTIPATH_DEVICE_PATH="0". */ if (released) { - r = 1; + r = RTVL_NO; goto print_valid; } - if (r == 0) + if (r == RTVL_YES) goto print_valid; /* find_multipaths_on: Fall through to path detection */ } @@ -703,13 +713,12 @@ configure (struct config *conf, enum mpath_cmds cmd, * the refwwid, or there is more than one path matching * the refwwid, then the path is valid */ if (VECTOR_SIZE(curmp) != 0) { - r = 0; + r = RTVL_YES; goto print_valid; } else if (VECTOR_SIZE(pathvec) > 1) - r = 0; + r = RTVL_YES; else - /* Use r=2 as an indication for "maybe" */ - r = 2; + r = RTVL_MAYBE; /* * If opening the path with O_EXCL fails, the path @@ -739,13 +748,14 @@ configure (struct config *conf, enum mpath_cmds cmd, /* * Check if we raced with multipathd */ - r = !sysfs_is_multipathed(VECTOR_SLOT(pathvec, 0)); + r = sysfs_is_multipathed(VECTOR_SLOT(pathvec, 0)) ? + RTVL_YES : RTVL_NO; } goto print_valid; } if (cmd != CMD_CREATE && cmd != CMD_DRY_RUN) { - r = 0; + r = RTVL_OK; goto out; } @@ -754,7 +764,7 @@ configure (struct config *conf, enum mpath_cmds cmd, */ rc = coalesce_paths(&vecs, NULL, refwwid, conf->force_reload, cmd); - r = rc == CP_RETRY ? -1 : rc == CP_OK ? 0 : 1; + r = rc == CP_RETRY ? RTVL_RETRY : rc == CP_OK ? RTVL_OK : RTVL_FAIL; print_valid: if (cmd == CMD_VALID_PATH) @@ -855,7 +865,7 @@ main (int argc, char *argv[]) int arg; extern char *optarg; extern int optind; - int r = 1; + int r = RTVL_FAIL; enum mpath_cmds cmd = CMD_CREATE; enum devtypes dev_type = DEV_NONE; char *dev = NULL; @@ -866,7 +876,7 @@ main (int argc, char *argv[]) logsink = 0; conf = load_config(DEFAULT_CONFIGFILE); if (!conf) - exit(1); + exit(RTVL_FAIL); multipath_conf = conf; conf->retrigger_tries = 0; while ((arg = getopt(argc, argv, ":adcChl::FfM:v:p:b:BrR:itTquUwW")) != EOF ) { @@ -877,7 +887,7 @@ main (int argc, char *argv[]) if (sizeof(optarg) > sizeof(char *) || !isdigit(optarg[0])) { usage (argv[0]); - exit(1); + exit(RTVL_FAIL); } conf->verbosity = atoi(optarg); @@ -924,7 +934,7 @@ main (int argc, char *argv[]) if (conf->pgpolicy_flag == IOPOLICY_UNDEF) { printf("'%s' is not a valid policy\n", optarg); usage(argv[0]); - exit(1); + exit(RTVL_FAIL); } break; case 'r': @@ -934,14 +944,14 @@ main (int argc, char *argv[]) conf->find_multipaths |= _FIND_MULTIPATHS_I; break; case 't': - r = dump_config(conf, NULL, NULL); + r = dump_config(conf, NULL, NULL) ? RTVL_FAIL : RTVL_OK; goto out_free_config; case 'T': cmd = CMD_DUMP_CONFIG; break; case 'h': usage(argv[0]); - exit(0); + exit(RTVL_OK); case 'u': cmd = CMD_VALID_PATH; dev_type = DEV_UEVENT; @@ -965,20 +975,20 @@ main (int argc, char *argv[]) case ':': fprintf(stderr, "Missing option argument\n"); usage(argv[0]); - exit(1); + exit(RTVL_FAIL); case '?': fprintf(stderr, "Unknown switch: %s\n", optarg); usage(argv[0]); - exit(1); + exit(RTVL_FAIL); default: usage(argv[0]); - exit(1); + exit(RTVL_FAIL); } } if (getuid() != 0) { fprintf(stderr, "need to be root\n"); - exit(1); + exit(RTVL_FAIL); } if (optind < argc) { @@ -1016,7 +1026,8 @@ main (int argc, char *argv[]) /* Failing here is non-fatal */ init_foreign(conf->multipath_dir); if (cmd == CMD_USABLE_PATHS) { - r = check_usable_paths(conf, dev, dev_type); + r = check_usable_paths(conf, dev, dev_type) ? + RTVL_FAIL : RTVL_OK; goto out; } if (cmd == CMD_VALID_PATH && @@ -1032,7 +1043,7 @@ main (int argc, char *argv[]) if (fd == -1) { condlog(3, "%s: daemon is not running", dev); if (!systemd_service_enabled(dev)) { - r = print_cmd_valid(1, NULL, conf); + r = print_cmd_valid(RTVL_NO, NULL, conf); goto out; } } else @@ -1046,9 +1057,9 @@ main (int argc, char *argv[]) switch(delegate_to_multipathd(cmd, dev, dev_type, conf)) { case DELEGATE_OK: - exit(0); + exit(RTVL_OK); case DELEGATE_ERROR: - exit(1); + exit(RTVL_FAIL); case NOT_DELEGATED: break; } @@ -1064,8 +1075,8 @@ main (int argc, char *argv[]) goto out; } if (dm_get_maps(curmp) == 0) - r = replace_wwids(curmp); - if (r == 0) + r = replace_wwids(curmp) ? RTVL_FAIL : RTVL_OK; + if (r == RTVL_OK) printf("successfully reset wwids\n"); vector_foreach_slot_backwards(curmp, mpp, i) { vector_del_slot(curmp, i); @@ -1078,17 +1089,18 @@ main (int argc, char *argv[]) retries = conf->remove_retries; if (conf->remove == FLUSH_ONE) { if (dev_type == DEV_DEVMAP) { - r = dm_suspend_and_flush_map(dev, retries); + r = dm_suspend_and_flush_map(dev, retries) ? + RTVL_FAIL : RTVL_OK; } else condlog(0, "must provide a map name to remove"); goto out; } else if (conf->remove == FLUSH_ALL) { - r = dm_flush_maps(retries); + r = dm_flush_maps(retries) ? RTVL_FAIL : RTVL_OK; goto out; } - while ((r = configure(conf, cmd, dev_type, dev)) < 0) + while ((r = configure(conf, cmd, dev_type, dev)) == RTVL_RETRY) condlog(3, "restart multipath configuration process"); out: @@ -1103,8 +1115,8 @@ out: * multipath -u must exit with status 0, otherwise udev won't * import its output. */ - if (cmd == CMD_VALID_PATH && dev_type == DEV_UEVENT && r == 1) - r = 0; + if (cmd == CMD_VALID_PATH && dev_type == DEV_UEVENT && r == RTVL_NO) + r = RTVL_OK; if (dev_type == DEV_UEVENT) closelog();