From patchwork Mon Apr 2 19:50: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: 10320275 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 0044260247 for ; Mon, 2 Apr 2018 19:53:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5231223B2 for ; Mon, 2 Apr 2018 19:52:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9F8028138; Mon, 2 Apr 2018 19:52: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=-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 4F86C223B2 for ; Mon, 2 Apr 2018 19:52:59 +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 9BA847E9CD; Mon, 2 Apr 2018 19:52:58 +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 7F51D6065F; Mon, 2 Apr 2018 19:52:58 +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 5871F4CA9C; Mon, 2 Apr 2018 19:52:58 +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 w32JqvGs027718 for ; Mon, 2 Apr 2018 15:52:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 11E6060637; Mon, 2 Apr 2018 19:52:57 +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 4807D18ADE; Mon, 2 Apr 2018 19:52:53 +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 30276C03677F; Mon, 2 Apr 2018 19:52:52 +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:34 -0600 From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Date: Mon, 2 Apr 2018 21:50:50 +0200 Message-Id: <20180402195051.26854-20-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.31]); Mon, 02 Apr 2018 19:52:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 02 Apr 2018 19:52:52 +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.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: Julian Andres Klode , dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v3 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.26]); Mon, 02 Apr 2018 19:52:58 +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 --- 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 88e6687..2d28ded 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include "mpath_cmd.h" @@ -474,9 +475,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 d59fdc8..1237c23 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -238,6 +238,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 .