From patchwork Wed Apr 4 16:16:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10322845 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 0EB5F60318 for ; Wed, 4 Apr 2018 16:18:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F01AE28F26 for ; Wed, 4 Apr 2018 16:18:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4F2B28F56; Wed, 4 Apr 2018 16:18:26 +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 6EBA028F26 for ; Wed, 4 Apr 2018 16:18:26 +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 B54CFC059725; Wed, 4 Apr 2018 16:18:25 +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 4171A6A23F; Wed, 4 Apr 2018 16:18:25 +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 087DB1800C9F; Wed, 4 Apr 2018 16:18:25 +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 w34GIOf9012502 for ; Wed, 4 Apr 2018 12:18:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4C07E7D646; Wed, 4 Apr 2018 16:18:24 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B34637C445; Wed, 4 Apr 2018 16:18:21 +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 6FDC13A9EC; Wed, 4 Apr 2018 16:18:20 +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); Wed, 04 Apr 2018 10:18:04 -0600 From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Date: Wed, 4 Apr 2018 18:16:26 +0200 Message-Id: <20180404161627.6244-20-mwilck@suse.com> In-Reply-To: <20180404161627.6244-1-mwilck@suse.com> References: <20180404161627.6244-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.38]); Wed, 04 Apr 2018 16:18:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 04 Apr 2018 16:18:20 +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.38 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 v4 19/20] libmultipath: enable find_multipaths "smart" 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 04 Apr 2018 16:18:26 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP This activates "smart" path detection. This is similar to "find_multipaths yes", but doesn't generally ignore single paths that are not listed in the WWIDs file. Rather, such paths are temporarily treated like multipath members. If no additional paths are detected after a certain time, the paths are re-added to the system as non-multipath. This needs support by the udev rules, to be added in a follow-up patch. If a multipath map is successfully successfully created, and paths are in waiting state, trigger path uevents to update their status. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- libmultipath/configure.c | 15 ++++++++++++--- libmultipath/dict.c | 1 + multipath/multipath.conf.5 | 13 +++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 9aa3d21..17c2fa1 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include "mpath_cmd.h" @@ -476,9 +477,17 @@ trigger_paths_udev_change(struct multipath *mpp, bool is_mpath) env = udev_device_get_property_value( pp->udev, "DM_MULTIPATH_DEVICE_PATH"); - if (is_mpath && env != NULL && !strcmp(env, "1")) - continue; - else if (!is_mpath && + if (is_mpath && env != NULL && !strcmp(env, "1")) { + /* + * If FIND_MULTIPATHS_WAIT_UNTIL is not "0", + * path is in "maybe" state and timer is running + * Send uevent now (see multipath.rules). + */ + env = udev_device_get_property_value( + pp->udev, "FIND_MULTIPATHS_WAIT_UNTIL"); + if (env == NULL || !strcmp(env, "0")) + continue; + } else if (!is_mpath && (env == NULL || !strcmp(env, "0"))) continue; diff --git a/libmultipath/dict.c b/libmultipath/dict.c index 4be808d..8a18b1f 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -239,6 +239,7 @@ static const char *find_multipaths_optvals[] = { [FIND_MULTIPATHS_ON] = "on", [FIND_MULTIPATHS_STRICT] = "strict", [FIND_MULTIPATHS_GREEDY] = "greedy", + [FIND_MULTIPATHS_SMART] = "smart", }; static int diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index 94c419a..641ba43 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -978,6 +978,19 @@ with the same WWID have been detected. Both multipathd and multipath treat every non-blacklisted device as multipath device path. .TP +.I smart +This differs from \fIfind_multipaths yes\fR only in +the way it treats new devices for which only one path has been +detected yet. When such a device is first encounted in udev rules, it is +treated as a multipath device. multipathd waits whether additional paths with +the same WWID appears. If that happens, it sets up a multipath map. If it +doesn\'t happen until a +timeout expires, or if setting up the map fails, a new uevent is triggered for +the device; at second encounter in the udev rules, the device will be treated +as non-multipath and passed on to upper layers. +\fBNote:\fR this may cause delays during device detection if +there are single-path devices which aren\'t blacklisted. +.TP The default is: \fBstrict\fR .RE .