From patchwork Mon Apr 2 19:50: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: 10320287 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 19AAA60532 for ; Mon, 2 Apr 2018 19:53:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07B0820856 for ; Mon, 2 Apr 2018 19:53:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F07AC2882C; Mon, 2 Apr 2018 19:53: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=-6.9 required=2.0 tests=BAYES_00,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 3AF58283C8 for ; Mon, 2 Apr 2018 19:53:11 +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 4EC6E46269; Mon, 2 Apr 2018 19:53:10 +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 2BCEF5D9C9; Mon, 2 Apr 2018 19:53: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 040821805972; Mon, 2 Apr 2018 19:53:10 +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 w32JqeID027647 for ; Mon, 2 Apr 2018 15:52:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id E08635D70B; Mon, 2 Apr 2018 19:52:40 +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 845CE5D6B7; Mon, 2 Apr 2018 19:52:38 +0000 (UTC) Received: from prv3-mh.provo.novell.com (victor.provo.novell.com [137.65.250.26]) (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 69696356CE; Mon, 2 Apr 2018 19:52:37 +0000 (UTC) Received: from apollon.suse.de.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (TLS encrypted); Mon, 02 Apr 2018 13:52:21 -0600 From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Date: Mon, 2 Apr 2018 21:50:46 +0200 Message-Id: <20180402195051.26854-16-mwilck@suse.com> In-Reply-To: <20180402195051.26854-1-mwilck@suse.com> References: <20180402195051.26854-1-mwilck@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 02 Apr 2018 19:52:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 02 Apr 2018 19:52:37 +0000 (UTC) for IP:'137.65.250.26' DOMAIN:'victor.provo.novell.com' HELO:'prv3-mh.provo.novell.com' FROM:'mwilck@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.26 victor.provo.novell.com 137.65.250.26 victor.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: Julian Andres Klode , dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 15/20] libmultipath: implement find_multipaths_timeout X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-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.29]); Mon, 02 Apr 2018 19:53:10 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP This makes the timeout for "find_multipaths smart" configurable. If the timeout has a negative value (default), it's applied only to "known" hardware which is either in the hwtable or in a "device" section in multipath.conf. For typical non-multipath hardware, which is not in the hwtable, a short timeout of 1s is used, so that boot delays caused by pointlessly waiting e.g. for SATA devices will be minimal. It's expected that a "reasonable" timeout value depends less on the storage hardware itself but on other properties of the data center such as network latencies or distances. find_multipaths_timeout is therefore just a "defaults" section setting. Signed-off-by: Martin Wilck --- libmultipath/config.h | 1 + libmultipath/defaults.h | 2 ++ libmultipath/dict.c | 6 ++++++ libmultipath/propsel.c | 25 +++++++++++++++++++++++++ libmultipath/propsel.h | 1 + libmultipath/structs.h | 1 + multipath/multipath.conf.5 | 18 ++++++++++++++++++ 7 files changed, 54 insertions(+) diff --git a/libmultipath/config.h b/libmultipath/config.h index 21d8e72..72d6601 100644 --- a/libmultipath/config.h +++ b/libmultipath/config.h @@ -174,6 +174,7 @@ struct config { int remove_retries; int max_sectors_kb; int ghost_delay; + int find_multipaths_timeout; unsigned int version[3]; char * multipath_dir; diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h index 19ad2bf..d7b87b4 100644 --- a/libmultipath/defaults.h +++ b/libmultipath/defaults.h @@ -41,6 +41,8 @@ #define DEFAULT_DISABLE_CHANGED_WWIDS 1 #define DEFAULT_MAX_SECTORS_KB MAX_SECTORS_KB_UNDEF #define DEFAULT_GHOST_DELAY GHOST_DELAY_OFF +#define DEFAULT_FIND_MULTIPATHS_TIMEOUT -10 +#define DEFAULT_UNKNOWN_FIND_MULTIPATHS_TIMEOUT 1 #define DEFAULT_CHECKINT 5 #define MAX_CHECKINT(a) (a << 2) diff --git a/libmultipath/dict.c b/libmultipath/dict.c index a952c60..d59fdc8 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -484,6 +484,10 @@ declare_hw_snprint(max_sectors_kb, print_nonzero) declare_mp_handler(max_sectors_kb, set_int) declare_mp_snprint(max_sectors_kb, print_nonzero) +declare_def_handler(find_multipaths_timeout, set_int) +declare_def_snprint_defint(find_multipaths_timeout, print_int, + DEFAULT_FIND_MULTIPATHS_TIMEOUT) + static int def_config_dir_handler(struct config *conf, vector strvec) { @@ -1518,6 +1522,8 @@ init_keywords(vector keywords) install_keyword("remove_retries", &def_remove_retries_handler, &snprint_def_remove_retries); install_keyword("max_sectors_kb", &def_max_sectors_kb_handler, &snprint_def_max_sectors_kb); install_keyword("ghost_delay", &def_ghost_delay_handler, &snprint_def_ghost_delay); + install_keyword("find_multipaths_timeout", &def_find_multipaths_timeout_handler, + &snprint_def_find_multipaths_timeout); __deprecated install_keyword("default_selector", &def_selector_handler, NULL); __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index 58a6a42..87d6865 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -911,3 +911,28 @@ out: condlog(3, "%s: ghost_delay = %s %s", mp->alias, buff, origin); return 0; } + +int select_find_multipaths_timeout(struct config *conf, struct path *pp) +{ + char *origin; + + pp_set_conf(find_multipaths_timeout); + pp_set_default(find_multipaths_timeout, + DEFAULT_FIND_MULTIPATHS_TIMEOUT); +out: + /* + * If configured value is negative, and this "unkown" hardware + * (no hwentry), use very small timeout to avoid delays. + */ + if (pp->find_multipaths_timeout < 0) { + pp->find_multipaths_timeout = - pp->find_multipaths_timeout; + if (!pp->hwe) { + pp->find_multipaths_timeout = + DEFAULT_UNKNOWN_FIND_MULTIPATHS_TIMEOUT; + origin = "(default for unkown hardware)"; + } + } + condlog(3, "%s: timeout for find_multipaths \"smart\" = %ds %s", + pp->dev, pp->find_multipaths_timeout, origin); + return 0; +} diff --git a/libmultipath/propsel.h b/libmultipath/propsel.h index 136f906..b6475d0 100644 --- a/libmultipath/propsel.h +++ b/libmultipath/propsel.h @@ -8,6 +8,7 @@ int select_hwhandler (struct config *conf, struct multipath * mp); int select_checker(struct config *conf, struct path *pp); int select_getuid (struct config *conf, struct path * pp); int select_prio (struct config *conf, struct path * pp); +int select_find_multipaths_timeout(struct config *conf, struct path * pp); int select_no_path_retry(struct config *conf, struct multipath *mp); int select_flush_on_last_del(struct config *conf, struct multipath *mp); int select_minio(struct config *conf, struct multipath *mp); diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 32f4b2d..d4e18df 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -281,6 +281,7 @@ struct path { int io_err_disable_reinstate; int io_err_pathfail_cnt; int io_err_pathfail_starttime; + int find_multipaths_timeout; /* configlet pointers */ struct hwentry * hwe; struct gen_path generic_path; diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index 6965dac..94c419a 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -983,6 +983,24 @@ The default is: \fBstrict\fR . . .TP +.B find_multipaths_timeout +Timeout, in seconds, to wait for additional paths after detecting the first +one, if \fIfind_multipaths +"smart"\fR (see above) is set. If the value is \fBpositive\fR, this timeout is used for all +unkown, non-blacklisted devices encountered. If the value is \fBnegative\fR +(recommended), it's only +applied to "known" devices that have an entry in multipath's hardware table, +either in the built-in table or in a \fIdevice\fR section; other ("unknown") devices will +use a timeout of only 1 second to avoid booting delays. The value 0 means +"use the built-in default". If \fIfind_multipath\fR has a value +other than \fIsmart\fR, this option has no effect. +.RS +.TP +The default is: \fB-10\fR (10s for known and 1s for unknown hardware) +.RE +. +. +.TP .B uxsock_timeout CLI receive timeout in milliseconds. For larger systems CLI commands might timeout before the multipathd lock is released and the CLI command