From patchwork Wed Nov 17 21:21:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12625461 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7241C433F5 for ; Wed, 17 Nov 2021 21:21:42 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8021861B62 for ; Wed, 17 Nov 2021 21:21:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8021861B62 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637184101; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OgR+pjUhdX0mTVW7yra40IOAU9S08nnJR8keLP/yHkw=; b=QR5c0SMaCGCiTLwhxgZZ5/F+ZI4o8spyYtgsTXOvCh4we+3ha/Xc8Z5Qv/+YvlQ2aiW7SY GYxNltSO3KP+zwaKZomVHcfoNX6ZiMpr8U1/tNy1n5YM2SFrD5F4bnZOZ5SG91fZwZMBtS kgAKhbfMnUkHyoXNUDgSlalvksDMp00= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-575---t799LNMCyijN_-yKEtKg-1; Wed, 17 Nov 2021 16:21:37 -0500 X-MC-Unique: --t799LNMCyijN_-yKEtKg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 53F0A106F71E; Wed, 17 Nov 2021 21:21:33 +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 334435F4F5; Wed, 17 Nov 2021 21:21:33 +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 C37F5181A1CF; Wed, 17 Nov 2021 21:21:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AHLLVRj025233 for ; Wed, 17 Nov 2021 16:21:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 353285C22B; Wed, 17 Nov 2021 21:21:31 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B96D5C1BB; Wed, 17 Nov 2021 21:21:28 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 1AHLLQM6004923; Wed, 17 Nov 2021 15:21:27 -0600 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 1AHLLQ9K004922; Wed, 17 Nov 2021 15:21:26 -0600 From: Benjamin Marzinski To: Christophe Varoqui Date: Wed, 17 Nov 2021 15:21:16 -0600 Message-Id: <1637184084-4882-2-git-send-email-bmarzins@redhat.com> In-Reply-To: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> References: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 1/9] multipathd: remove missing paths on startup 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com If a path device was removed from the system while multipathd was not running, multipathd would not remove the path from the multipath table on start-up, or on a weak reconfigure. update_pathvec_from_dm() would return that a reload was necessary, but that information wasn't propigated back to where it could be used to reload the device. Multipath devices now remember if they need to be reloaded, and if so, force_reload is set in select_action(). This means that even when configure is called with FORCE_RELOAD_WEAK, these devices will still be reloaded. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/configure.c | 2 ++ libmultipath/devmapper.c | 2 ++ libmultipath/structs.h | 1 + libmultipath/structs_vec.c | 1 + 4 files changed, 6 insertions(+) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index eb8ec1bd..f1a890af 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -715,6 +715,8 @@ void select_action (struct multipath *mpp, const struct _vector *curmp, cmpp = find_mp_by_wwid(curmp, mpp->wwid); cmpp_by_name = find_mp_by_alias(curmp, mpp->alias); + if (mpp->need_reload || (cmpp && cmpp->need_reload)) + force_reload = 1; if (!cmpp_by_name) { if (cmpp) { diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index c05dc201..3e1a7260 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -522,6 +522,8 @@ freeout: addout: dm_task_destroy (dmt); + if (r) + mpp->need_reload = false; return r; } diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 399540e7..d0b266b7 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -355,6 +355,7 @@ struct multipath { int retain_hwhandler; int deferred_remove; bool in_recovery; + bool need_reload; int san_path_err_threshold; int san_path_err_forget_rate; int san_path_err_recovery_time; diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 85d97ac1..e52db0c4 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -237,6 +237,7 @@ bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, free_pathgroup(pgp, KEEP_PATHS); must_reload = true; } + mpp->need_reload = mpp->need_reload || must_reload; return must_reload; } From patchwork Wed Nov 17 21:21:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12625473 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C00BC433F5 for ; Wed, 17 Nov 2021 21:22:06 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E8AD619E5 for ; Wed, 17 Nov 2021 21:22:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3E8AD619E5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637184125; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Q4IFgwkgqUP7oe9HmapomPLXssQCMRDxXICNYDr3vXM=; b=FNpqAkT6dKzzcJu9/PflqG8ESL5VCPvoJ9NGkJ4eUHd7IeGU6IFl55Hkixwd/cDOM24jnZ KOrO9XmugFT3O+zCx1Cl4cJTvBjMbXg+u5/U6tyFc2RpOSKuM+jLEWHZnJUY9o1u3LW5o5 4Pug+yM+9Lt1hpuXy2wulz5mtt1H5AM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-374-domYTXFoO-C_yDkO0PaIyw-1; Wed, 17 Nov 2021 16:22:01 -0500 X-MC-Unique: domYTXFoO-C_yDkO0PaIyw-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6E2881030C2B; Wed, 17 Nov 2021 21:21:52 +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 524205DAA5; Wed, 17 Nov 2021 21:21:52 +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 2BF5F4E9F5; Wed, 17 Nov 2021 21:21:52 +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 1AHLLbwa025277 for ; Wed, 17 Nov 2021 16:21:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1802B5F4EF; Wed, 17 Nov 2021 21:21:37 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B413D5F4E0; Wed, 17 Nov 2021 21:21:29 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 1AHLLStJ004927; Wed, 17 Nov 2021 15:21:28 -0600 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 1AHLLR7o004926; Wed, 17 Nov 2021 15:21:27 -0600 From: Benjamin Marzinski To: Christophe Varoqui Date: Wed, 17 Nov 2021 15:21:17 -0600 Message-Id: <1637184084-4882-3-git-send-email-bmarzins@redhat.com> In-Reply-To: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> References: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 2/9] libmultipath: skip unneeded steps to get path name 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com The path already must have a udev device at this point, so it just needs to copy the sysname from it. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/structs_vec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index e52db0c4..4d56107a 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "util.h" #include "checkers.h" @@ -174,8 +175,8 @@ bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, } else { int rc; - devt2devname(pp->dev, sizeof(pp->dev), - pp->dev_t); + strlcpy(pp->dev, udev_device_get_sysname(pp->udev), + sizeof(pp->dev)); conf = get_multipath_config(); pthread_cleanup_push(put_multipath_config, conf); From patchwork Wed Nov 17 21:21:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12625471 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2B82C433F5 for ; Wed, 17 Nov 2021 21:22:00 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F7FE61B44 for ; Wed, 17 Nov 2021 21:22:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7F7FE61B44 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637184119; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JSEbamwY6RP0bAzXH38QLlyyC8sOkLCVeLDF037aiMo=; b=CUEldS/zG/fZDu2h3cc4OW91z5JcyBuTTKCYebequSO6w5jjDNcM5Zz0pow4neUT6RMPOm Lz2K0cbKsfS0nY9G58viI3KgsPl/x/j47UOvVfLNiqgtQ24nqN5XZLjUUMvtaiyY3M72en lfx/wPORNINY7ekscAbmjlp1hfbZQvU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-594-q955cxZIMeepLv5JXOiHiQ-1; Wed, 17 Nov 2021 16:21:58 -0500 X-MC-Unique: q955cxZIMeepLv5JXOiHiQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE3FF80414A; Wed, 17 Nov 2021 21:21:49 +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 C8B4D1017CF2; Wed, 17 Nov 2021 21:21:49 +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 A47641832DD7; Wed, 17 Nov 2021 21:21:49 +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 1AHLLbXN025278 for ; Wed, 17 Nov 2021 16:21:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1881D5F4F5; Wed, 17 Nov 2021 21:21:37 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 004395F4ED; Wed, 17 Nov 2021 21:21:30 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 1AHLLTtM004931; Wed, 17 Nov 2021 15:21:29 -0600 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 1AHLLTjl004930; Wed, 17 Nov 2021 15:21:29 -0600 From: Benjamin Marzinski To: Christophe Varoqui Date: Wed, 17 Nov 2021 15:21:18 -0600 Message-Id: <1637184084-4882-4-git-send-email-bmarzins@redhat.com> In-Reply-To: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> References: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 3/9] libmultipath: don't use fallback wwid in update_pathvec_from_dm 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com When new paths are added in update_pathvec_from_dm(). If they can't get their regular wwid, they shouldn't try the getting the fallback wwid, and should just copy the wwid of the multipath device. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/discovery.c | 7 ++++--- libmultipath/discovery.h | 2 ++ libmultipath/structs_vec.c | 3 +-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index f25fe9e3..5edf9593 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -2363,15 +2363,16 @@ int pathinfo(struct path *pp, struct config *conf, int mask) } if ((mask & DI_WWID) && !strlen(pp->wwid)) { - get_uid(pp, path_state, pp->udev, - (pp->retriggers >= conf->retrigger_tries)); + int allow_fallback = ((mask & DI_NOFALLBACK) == 0 && + pp->retriggers >= conf->retrigger_tries); + get_uid(pp, path_state, pp->udev, allow_fallback); if (!strlen(pp->wwid)) { if (pp->bus == SYSFS_BUS_UNDEF) return PATHINFO_SKIPPED; if (pp->initialized != INIT_FAILED) { pp->initialized = INIT_MISSING_UDEV; pp->tick = conf->retrigger_delay; - } else if (pp->retriggers >= conf->retrigger_tries && + } else if (allow_fallback && (pp->state == PATH_UP || pp->state == PATH_GHOST)) { /* * We have failed to read udev info for this path diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h index a5446b4d..095657bb 100644 --- a/libmultipath/discovery.h +++ b/libmultipath/discovery.h @@ -70,6 +70,7 @@ enum discovery_mode { __DI_WWID, __DI_BLACKLIST, __DI_NOIO, + __DI_NOFALLBACK, }; #define DI_SYSFS (1 << __DI_SYSFS) @@ -79,6 +80,7 @@ enum discovery_mode { #define DI_WWID (1 << __DI_WWID) #define DI_BLACKLIST (1 << __DI_BLACKLIST) #define DI_NOIO (1 << __DI_NOIO) /* Avoid IO on the device */ +#define DI_NOFALLBACK (1 << __DI_NOFALLBACK) /* do not allow wwid fallback */ #define DI_ALL (DI_SYSFS | DI_SERIAL | DI_CHECKER | DI_PRIO | \ DI_WWID) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 4d56107a..d363e7f6 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -182,8 +182,7 @@ bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, conf); pp->checkint = conf->checkint; rc = pathinfo(pp, conf, - DI_SYSFS|DI_WWID|DI_BLACKLIST| - pathinfo_flags); + DI_SYSFS|DI_WWID|DI_BLACKLIST|DI_NOFALLBACK|pathinfo_flags); pthread_cleanup_pop(1); if (rc != PATHINFO_OK) { condlog(1, "%s: error %d in pathinfo, discarding path", From patchwork Wed Nov 17 21:21:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12625475 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2D30C433EF for ; Wed, 17 Nov 2021 21:22:07 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 777A5619BB for ; Wed, 17 Nov 2021 21:22:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 777A5619BB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637184126; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=i7xLUtRLA62I3e6hfoteBzJURkkMNhOl655FoNQPYiY=; b=HYsHiaRZ8iRL5gs5A9xGYTipmDVPov3MMh9vM1c3DV/SdBE0cwim+R9JjyYUrmeUHBkxCn 69Wzlg2zcVmXDY0SwOjnRjiJGNWaCvD+W53Esak5fQFHz221wFKhD+gGPR0MEb4vIvNKYS QZs8AP8GRnWNtNgS8KLLXmSN8ZYeggI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-151-hwzP4vNfMyyNbiu4D40pIQ-1; Wed, 17 Nov 2021 16:22:03 -0500 X-MC-Unique: hwzP4vNfMyyNbiu4D40pIQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id E464E1006AA4; Wed, 17 Nov 2021 21:21:49 +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 CC0D41B5C0; Wed, 17 Nov 2021 21:21:49 +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 A79401832DD8; Wed, 17 Nov 2021 21:21:49 +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 1AHLLcPs025308 for ; Wed, 17 Nov 2021 16:21:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id B16D55BAFB; Wed, 17 Nov 2021 21:21:38 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68C241B5C2; Wed, 17 Nov 2021 21:21:32 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 1AHLLUSS004935; Wed, 17 Nov 2021 15:21:30 -0600 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 1AHLLUT0004934; Wed, 17 Nov 2021 15:21:30 -0600 From: Benjamin Marzinski To: Christophe Varoqui Date: Wed, 17 Nov 2021 15:21:19 -0600 Message-Id: <1637184084-4882-5-git-send-email-bmarzins@redhat.com> In-Reply-To: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> References: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 4/9] libmultipath: always set INIT_REMOVED in set_path_removed 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Avoiding this corner case simplifies a future patch Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/structs_vec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index d363e7f6..fb26437a 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -326,10 +326,8 @@ void set_path_removed(struct path *pp) * Keep link to mpp. It will be removed when the path * is successfully removed from the map. */ - if (!mpp) { + if (!mpp) condlog(0, "%s: internal error: mpp == NULL", pp->dev); - return; - } pp->mpp = mpp; pp->initialized = INIT_REMOVED; } From patchwork Wed Nov 17 21:21:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12625477 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56214C433F5 for ; Wed, 17 Nov 2021 21:23:15 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E78FF615E6 for ; Wed, 17 Nov 2021 21:23:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E78FF615E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637184194; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AsPSaKdTOw88BrUde2mwpOEahHrXyFqRR7E32hQb6WE=; b=fikX3iaZUT+D1jAg4jDvqsz0UHncJCZyS2xTujFm0S6rV7Q7Peoqac8mc+O9XSNeEjLsVB R1e7hiph9a4GHV40LsTSZsDNDIA8T7JdT7ulz9fdxOvuiaQUXEDXaH3jqAnonV2kYd3Lmz OyJ9M+mRZwUt16vJO2+voWLeBRQqQpQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-245-4OMJFuANPDGWKcsSdskk9Q-1; Wed, 17 Nov 2021 16:22:02 -0500 X-MC-Unique: 4OMJFuANPDGWKcsSdskk9Q-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 22A6F804142; Wed, 17 Nov 2021 21:21:55 +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 0882660CC3; Wed, 17 Nov 2021 21:21: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 D4A554EA2A; Wed, 17 Nov 2021 21:21:54 +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 1AHLLbef025292 for ; Wed, 17 Nov 2021 16:21:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id EE05260C4A; Wed, 17 Nov 2021 21:21:37 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9936A60C13; Wed, 17 Nov 2021 21:21:33 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 1AHLLWYU004939; Wed, 17 Nov 2021 15:21:32 -0600 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 1AHLLVom004938; Wed, 17 Nov 2021 15:21:31 -0600 From: Benjamin Marzinski To: Christophe Varoqui Date: Wed, 17 Nov 2021 15:21:20 -0600 Message-Id: <1637184084-4882-6-git-send-email-bmarzins@redhat.com> In-Reply-To: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> References: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 5/9] multipathd: fully initialize paths added by update_pathvec_from_dm 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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com When paths are added by update_pathvec_from_dm(), udev may not have initialized them. This means that it's possible that they are supposed to be blacklisted by udev properties, but weren't. Also, in order to avoid doing potentially stalling IO, update_pathvec_from_dm() doesn't get all the path information in pathinfo(). These paths end up in the unexpected state of INIT_MISSING_UDEV or INIT_NEW, but with their mpp and wwid set. If udev has already initialized the path, but multipathed wasn't monitoring it, the blacklist checks and wwid determination in update_pathvec_from_dm() will work correctly, so paths added by it are safe, but not completely initialized. The most likely reason why this would happen is if the path was manually removed from multipathd monitoring with "multipathd del path". The most common time when uninitialized paths would in be part of multipath devices is during boot, after the pivot root, but before the udev coldplug happens. These paths are not necessarily safe. It's possible that /etc/multipath.conf in the initramfs and regular filesystem differ, and they should now be either blacklisted by udev_property, or have a different wwid. However an "add" event should appear for them shortly. Multipath now has a new state to deal with these devices, INIT_PARTIAL. Devices in this state are treated mostly like INIT_OK devices, but when "multipathd add path" is called or an add/change uevent happens on these devices, multipathd will finish initializing them, and remove them if necessary. Signed-off-by: Benjamin Marzinski --- libmultipath/structs.h | 6 +++++ libmultipath/structs_vec.c | 5 ++-- multipathd/cli_handlers.c | 35 ++++++++++++++++++++++++-- multipathd/main.c | 51 +++++++++++++++++++++++++++++++++++--- multipathd/main.h | 1 + 5 files changed, 90 insertions(+), 8 deletions(-) diff --git a/libmultipath/structs.h b/libmultipath/structs.h index d0b266b7..69409fd4 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -200,6 +200,12 @@ enum initialized_states { * mapped by some multipath map because of map reload failure. */ INIT_REMOVED, + /* + * INIT_PARTIAL: paths added by update_pathvec_from_dm() will not + * be fully initialized. This will be handled when an add or + * change uevent is received. + */ + INIT_PARTIAL, }; enum prkey_sources { diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index fb26437a..1de9175e 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -194,6 +194,7 @@ bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, } condlog(2, "%s: adding new path %s", mpp->alias, pp->dev); + pp->initialized = INIT_PARTIAL; store_path(pathvec, pp); pp->tick = 1; } @@ -392,12 +393,12 @@ extract_hwe_from_path(struct multipath * mpp) condlog(4, "%s: searching paths for valid hwe", mpp->alias); /* doing this in two passes seems like paranoia to me */ vector_foreach_slot(mpp->paths, pp, i) { - if (pp->state == PATH_UP && + if (pp->state == PATH_UP && pp->initialized != INIT_PARTIAL && pp->initialized != INIT_REMOVED && pp->hwe) goto done; } vector_foreach_slot(mpp->paths, pp, i) { - if (pp->state != PATH_UP && + if ((pp->state != PATH_UP || pp->initialized == INIT_PARTIAL) && pp->initialized != INIT_REMOVED && pp->hwe) goto done; } diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index 58b9916c..5de428f3 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -493,6 +493,33 @@ cli_reset_map_stats (void *v, struct strbuf *reply, void *data) return 0; } +static int +add_partial_path(struct path *pp, struct vectors *vecs) +{ + char wwid[WWID_SIZE]; + struct udev_device *udd; + + udd = get_udev_device(pp->dev_t, DEV_DEVT); + if (!udd) + return 0; + strcpy(wwid, pp->wwid); + if (get_uid(pp, pp->state, udd, 0) != 0) { + strcpy(pp->wwid, wwid); + udev_device_unref(udd); + return 0; + } + if (strlen(wwid) && strncmp(wwid, pp->wwid, WWID_SIZE) != 0) { + condlog(0, "%s: path wwid changed from '%s' to '%s'. removing", + pp->dev, wwid, pp->wwid); + ev_remove_path(pp, vecs, 1); + udev_device_unref(udd); + return -1; + } + udev_device_unref(pp->udev); + pp->udev = udd; + return finish_path_init(pp, vecs); +} + static int cli_add_path (void *v, struct strbuf *reply, void *data) { @@ -518,8 +545,12 @@ cli_add_path (void *v, struct strbuf *reply, void *data) if (pp && pp->initialized != INIT_REMOVED) { condlog(2, "%s: path already in pathvec", param); - if (pp->recheck_wwid == RECHECK_WWID_ON && - check_path_wwid_change(pp)) { + if (pp->initialized == INIT_PARTIAL) { + if (add_partial_path(pp, vecs) < 0) + return 1; + } + else if (pp->recheck_wwid == RECHECK_WWID_ON && + check_path_wwid_change(pp)) { condlog(0, "%s: wwid changed. Removing device", pp->dev); handle_path_wwid_change(pp, vecs); diff --git a/multipathd/main.c b/multipathd/main.c index cc4a4a5d..8f6be6b9 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -976,12 +976,19 @@ check_path_wwid_change(struct path *pp) return false; } +/* + * uev_add_path can call uev_update_path, and uev_update_path can call + * uev_add_path + */ +static int uev_update_path (struct uevent *uev, struct vectors * vecs); + static int uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) { struct path *pp; int ret = 0, i; struct config *conf; + bool partial_init = false; condlog(3, "%s: add path (uevent)", uev->kernel); if (strstr(uev->kernel, "..") != NULL) { @@ -1000,7 +1007,10 @@ uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) int r; struct multipath *prev_mpp = NULL; - if (pp->initialized == INIT_REMOVED) { + if (pp->initialized == INIT_PARTIAL) { + partial_init = true; + goto out; + } else if (pp->initialized == INIT_REMOVED) { condlog(3, "%s: re-adding removed path", pp->dev); pp->initialized = INIT_NEW; prev_mpp = pp->mpp; @@ -1110,6 +1120,8 @@ uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) } out: lock_cleanup_pop(vecs->lock); + if (partial_init) + return uev_update_path(uev, vecs); return ret; } @@ -1405,6 +1417,28 @@ fail: return REMOVE_PATH_MAP_ERROR; } +int +finish_path_init(struct path *pp, struct vectors * vecs) +{ + int r; + struct config *conf; + + if (pp->udev && pp->uid_attribute && *pp->uid_attribute && + !udev_device_get_is_initialized(pp->udev)) + return 0; + conf = get_multipath_config(); + pthread_cleanup_push(put_multipath_config, conf); + r = pathinfo(pp, conf, DI_ALL|DI_BLACKLIST); + pthread_cleanup_pop(1); + + if (r == PATHINFO_OK) + return 0; + + condlog(0, "%s: error fully initializing path, removing", pp->dev); + ev_remove_path(pp, vecs, 1); + return -1; +} + static int uev_update_path (struct uevent *uev, struct vectors * vecs) { @@ -1443,7 +1477,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) } /* Don't deal with other types of failed initialization * now. check_path will handle it */ - if (!strlen(pp->wwid)) + if (!strlen(pp->wwid) && pp->initialized != INIT_PARTIAL) goto out; strcpy(wwid, pp->wwid); @@ -1451,12 +1485,20 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) if (rc != 0) strcpy(pp->wwid, wwid); - else if (strncmp(wwid, pp->wwid, WWID_SIZE) != 0) { + else if (strlen(wwid) && + strncmp(wwid, pp->wwid, WWID_SIZE) != 0) { condlog(0, "%s: path wwid changed from '%s' to '%s'", uev->kernel, wwid, pp->wwid); ev_remove_path(pp, vecs, 1); needs_reinit = 1; goto out; + } else if (pp->initialized == INIT_PARTIAL) { + udev_device_unref(pp->udev); + pp->udev = udev_device_ref(uev->udev); + if (finish_path_init(pp, vecs) < 0) { + retval = 1; + goto out; + } } else { udev_device_unref(pp->udev); pp->udev = udev_device_ref(uev->udev); @@ -1507,6 +1549,7 @@ out: condlog(0, "%s: spurious uevent, path not found", uev->kernel); } + /* pp->initalized must not be INIT_PARTIAL if needs_reinit is set */ if (needs_reinit) retval = uev_add_path(uev, vecs, 1); return retval; @@ -2116,7 +2159,7 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks) int marginal_pathgroups, marginal_changed = 0; int ret; - if (((pp->initialized == INIT_OK || + if (((pp->initialized == INIT_OK || pp->initialized == INIT_PARTIAL || pp->initialized == INIT_REQUESTED_UDEV) && !pp->mpp) || pp->initialized == INIT_REMOVED) return 0; diff --git a/multipathd/main.h b/multipathd/main.h index c8a1ce92..4acd1b8c 100644 --- a/multipathd/main.h +++ b/multipathd/main.h @@ -66,4 +66,5 @@ int reload_and_sync_map(struct multipath *mpp, struct vectors *vecs, void handle_path_wwid_change(struct path *pp, struct vectors *vecs); bool check_path_wwid_change(struct path *pp); +int finish_path_init(struct path *pp, struct vectors * vecs); #endif /* MAIN_H */ From patchwork Wed Nov 17 21:21:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12625467 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9B13C433EF for ; Wed, 17 Nov 2021 21:21:54 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6E766619BB for ; Wed, 17 Nov 2021 21:21:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6E766619BB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637184113; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0CGVz9sGDbWJrSzPRC+55hnIUxAtjl48m/QTZePfCYI=; b=Ru4YyJStHmXQigiBCQkiSlL1n4cjI/60DUu8fcfMYdyu2Fwn/o/p1zn5nyXq61vEs+BbXD QMfMBWex2kw5GHxg7LpCNrA1Lbu31KptQyRmrCZvJgceZj9H/++hQk91BNqJkibifruOh0 CHUhGhTU/8mV+hBqe8ntilw5gqUqxaE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-600-JuWkUy56MkqNVEiA3VBTLQ-1; Wed, 17 Nov 2021 16:21:51 -0500 X-MC-Unique: JuWkUy56MkqNVEiA3VBTLQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D15415720; Wed, 17 Nov 2021 21:21: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 224FE5DAA5; Wed, 17 Nov 2021 21:21: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 F3D961832DD7; Wed, 17 Nov 2021 21:21:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AHLLYS6025260 for ; Wed, 17 Nov 2021 16:21:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id ECED25C22B; Wed, 17 Nov 2021 21:21:34 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7E085C1BB; Wed, 17 Nov 2021 21:21:34 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 1AHLLXsu004943; Wed, 17 Nov 2021 15:21:33 -0600 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 1AHLLWe0004942; Wed, 17 Nov 2021 15:21:32 -0600 From: Benjamin Marzinski To: Christophe Varoqui Date: Wed, 17 Nov 2021 15:21:21 -0600 Message-Id: <1637184084-4882-7-git-send-email-bmarzins@redhat.com> In-Reply-To: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> References: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 6/9] multipathd: retrigger uevent for partial 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: , 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com If a partial path appears and is not fully initialized within 180 seconds, trigger a uevent. If the udev device is not initialized trigger an add event. Otherwise, trigger a change event. Signed-off-by: Benjamin Marzinski --- libmultipath/libmultipath.version | 2 +- libmultipath/structs.h | 1 + libmultipath/structs_vec.c | 1 + multipathd/main.c | 20 ++++++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version index 6473091d..58a7d1be 100644 --- a/libmultipath/libmultipath.version +++ b/libmultipath/libmultipath.version @@ -31,7 +31,7 @@ * The new version inherits the previous ones. */ -LIBMULTIPATH_10.0.0 { +LIBMULTIPATH_11.0.0 { global: /* symbols referenced by multipath and multipathd */ add_foreign; diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 69409fd4..c21d1eda 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -318,6 +318,7 @@ struct path { int fd; int initialized; int retriggers; + int partial_retrigger_delay; unsigned int path_failures; time_t dis_reinstate_time; int disable_reinstate; diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 1de9175e..9b6407bd 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -195,6 +195,7 @@ bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, condlog(2, "%s: adding new path %s", mpp->alias, pp->dev); pp->initialized = INIT_PARTIAL; + pp->partial_retrigger_delay = 180; store_path(pathvec, pp); pp->tick = 1; } diff --git a/multipathd/main.c b/multipathd/main.c index 8f6be6b9..b0037721 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1948,6 +1948,25 @@ retry_count_tick(vector mpvec) } } +static void +partial_retrigger_tick(vector pathvec) +{ + struct path *pp; + unsigned int i; + + vector_foreach_slot (pathvec, pp, i) { + if (pp->initialized == INIT_PARTIAL && pp->udev && + pp->partial_retrigger_delay > 0 && + --pp->partial_retrigger_delay == 0) { + const char *msg = udev_device_get_is_initialized(pp->udev) ? + "change" : "add"; + + sysfs_attr_set_value(pp->udev, "uevent", msg, + strlen(msg)); + } + } +} + int update_prio(struct path *pp, int refresh_all) { int oldpriority; @@ -2566,6 +2585,7 @@ checkerloop (void *ap) retry_count_tick(vecs->mpvec); missing_uev_wait_tick(vecs); ghost_delay_tick(vecs); + partial_retrigger_tick(vecs->pathvec); lock_cleanup_pop(vecs->lock); if (count) From patchwork Wed Nov 17 21:21:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12625463 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF729C433F5 for ; Wed, 17 Nov 2021 21:21:48 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F886619E5 for ; Wed, 17 Nov 2021 21:21:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8F886619E5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637184107; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ltwmh17rKlxiXYiGiEkK7/hNhiD9NYwRxMOSCt1ameQ=; b=W74RxbeURFHlk5OmWzZRmmUjKSxQdeH1hFvZse3rJ4fnAvlSo8VGE9kS+2yaJOtz0U5Bx6 e2hkWfozYMHFp03bx/r5UPxIhE7/5QoXpSjKUcaxqBTvHFSejm90POb9dr/uJTD8tFePne lkV6+t4kF7ziZR6j/ZCCSkyyL0mdswg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-N5iKsld2NbCbnmjcs5UkgA-1; Wed, 17 Nov 2021 16:21:42 -0500 X-MC-Unique: N5iKsld2NbCbnmjcs5UkgA-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id D37C7104ED1A; Wed, 17 Nov 2021 21:21:37 +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 B69151F46F; Wed, 17 Nov 2021 21:21:37 +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 918D7181A1CF; Wed, 17 Nov 2021 21:21:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AHLLa84025270 for ; Wed, 17 Nov 2021 16:21:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 60D645C22B; Wed, 17 Nov 2021 21:21:36 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C01A5C1BB; Wed, 17 Nov 2021 21:21:36 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 1AHLLYFw004947; Wed, 17 Nov 2021 15:21:34 -0600 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 1AHLLYLV004946; Wed, 17 Nov 2021 15:21:34 -0600 From: Benjamin Marzinski To: Christophe Varoqui Date: Wed, 17 Nov 2021 15:21:22 -0600 Message-Id: <1637184084-4882-8-git-send-email-bmarzins@redhat.com> In-Reply-To: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> References: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 7/9] multipathd: remove INIT_PARTIAL paths that aren't in a multipath device 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com The only reason multipath is monitoring an INIT_PARTIAL path is because it was discovered in a multipath device table. If it stops being part of a multipath device before it gets fully initialized, drop it. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/structs_vec.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 9b6407bd..df5709a0 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -308,9 +308,12 @@ void orphan_paths(vector pathvec, struct multipath *mpp, const char *reason) vector_foreach_slot (pathvec, pp, i) { if (pp->mpp == mpp) { - if (pp->initialized == INIT_REMOVED) { - condlog(3, "%s: freeing path in removed state", - pp->dev); + if (pp->initialized == INIT_REMOVED || + pp->initialized == INIT_PARTIAL) { + condlog(3, "%s: freeing path in %s state", + pp->dev, + pp->initialized == INIT_REMOVED ? + "removed" : "partial"); vector_del_slot(pathvec, i--); free_path(pp); } else @@ -469,11 +472,14 @@ static void check_removed_paths(const struct multipath *mpp, vector pathvec) int i; vector_foreach_slot(pathvec, pp, i) { - if (pp->initialized != INIT_REMOVED || pp->mpp != mpp) - continue; - if (!find_devt_in_pathgroups(mpp, pp->dev_t)) { - condlog(2, "%s: %s: freeing path in removed state", - __func__, pp->dev); + if (pp->mpp == mpp && + (pp->initialized == INIT_REMOVED || + pp->initialized == INIT_PARTIAL) && + !find_devt_in_pathgroups(mpp, pp->dev_t)) { + condlog(2, "%s: %s: freeing path in %s state", + __func__, pp->dev, + pp->initialized == INIT_REMOVED ? + "removed" : "partial"); vector_del_slot(pathvec, i--); free_path(pp); } From patchwork Wed Nov 17 21:21:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12625465 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FDEFC433F5 for ; Wed, 17 Nov 2021 21:21:54 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 208DD619E5 for ; Wed, 17 Nov 2021 21:21:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 208DD619E5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637184113; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lkuqnqEIlm5vMkNLAmZC+My27Luftfsvn6pADc9LFAc=; b=RrDXSnEcD5NC9cQeFVHHzADCYECRekqwny7F325DOD95NKdKl8S/gwVVtd+ySDPk/WePHg HwNa4C+tg39gPb7/hCTyMNMlT33kts2BLUEyv4LVFvYdXoEwgKgdbVRTt2iEzK1aUu7yOq V99Hx7FgEb9sH0mWfI612DEqkBf3/NI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-443-7rxX8KPcPsWRvz3eFwrpTg-1; Wed, 17 Nov 2021 16:21:51 -0500 X-MC-Unique: 7rxX8KPcPsWRvz3eFwrpTg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 45C2E104ECFD; Wed, 17 Nov 2021 21:21: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 298715C22B; Wed, 17 Nov 2021 21:21: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 03CAC4A704; Wed, 17 Nov 2021 21:21: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 1AHLLbRK025287 for ; Wed, 17 Nov 2021 16:21:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id DEE0960C4A; Wed, 17 Nov 2021 21:21:37 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC24F60CC3; Wed, 17 Nov 2021 21:21:37 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 1AHLLZhl004951; Wed, 17 Nov 2021 15:21:36 -0600 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 1AHLLZg2004950; Wed, 17 Nov 2021 15:21:35 -0600 From: Benjamin Marzinski To: Christophe Varoqui Date: Wed, 17 Nov 2021 15:21:23 -0600 Message-Id: <1637184084-4882-9-git-send-email-bmarzins@redhat.com> In-Reply-To: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> References: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 8/9] multipathd: Remove dependency on systemd-udev-settle.service 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com multipathd can now handle starting up with incompletely initialized paths, so it no longer needs to wait for the device Coldplug to complete. However multipathd may need to write to /etc (for the wwids and bindings files), so in needs to wait for the root filesystem to be remounted read/write before starting. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/multipathd.service | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service index 0b2ac814..87cb5349 100644 --- a/multipathd/multipathd.service +++ b/multipathd/multipathd.service @@ -1,9 +1,8 @@ [Unit] Description=Device-Mapper Multipath Device Controller -Wants=systemd-udev-trigger.service systemd-udev-settle.service Before=iscsi.service iscsid.service lvm2-activation-early.service Before=local-fs-pre.target blk-availability.service shutdown.target -After=multipathd.socket systemd-udev-trigger.service systemd-udev-settle.service +After=multipathd.socket systemd-remount-fs.service DefaultDependencies=no Conflicts=shutdown.target ConditionKernelCommandLine=!nompath From patchwork Wed Nov 17 21:21:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12625469 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC99DC433EF for ; Wed, 17 Nov 2021 21:21:56 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 85B5861B62 for ; Wed, 17 Nov 2021 21:21:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 85B5861B62 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637184115; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8aYsRqcjdn6/VfhUi18WTVaV33uacr5GDIgK9mFnMIc=; b=eTByVuHrI74bPwkFF3kGZO76v1fhmb6x90JF6z74xLTUh3q6qC9VnfUYEAIpjM+DttcMB8 4sh/uidtceCjcD8BBH3QteXbv9vRk6nRzccec7HR1hDlyJdxwkrieZe9ORa9r7UBWeqUQy gNhGW0o1eCyOOC6qmo1RCf1OBiXn4m8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-dxKUmb9lNsyb-L8hPuSe3Q-1; Wed, 17 Nov 2021 16:21:52 -0500 X-MC-Unique: dxKUmb9lNsyb-L8hPuSe3Q-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A03E1006AA1; Wed, 17 Nov 2021 21:21: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 2EB78ADF9; Wed, 17 Nov 2021 21:21: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 08F1A4E58E; Wed, 17 Nov 2021 21:21:47 +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 1AHLLj12025333 for ; Wed, 17 Nov 2021 16:21:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 86D3A17CEE; Wed, 17 Nov 2021 21:21:45 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D2735D9DE; Wed, 17 Nov 2021 21:21:39 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 1AHLLbmi004955; Wed, 17 Nov 2021 15:21:37 -0600 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 1AHLLbDW004954; Wed, 17 Nov 2021 15:21:37 -0600 From: Benjamin Marzinski To: Christophe Varoqui Date: Wed, 17 Nov 2021 15:21:24 -0600 Message-Id: <1637184084-4882-10-git-send-email-bmarzins@redhat.com> In-Reply-To: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> References: <1637184084-4882-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 9/9] libmultipath: add path wildcard "%I" for init state 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Martin Wilck Enable printing pp->initialized with 'multipathd show paths format "%I"'. This is supposed to go on top of Ben's "multipathd: remove udev settle dependency" series, to simplify checking multipathd's state. Reviewed-by: Benjamin Marzinski --- libmultipath/print.c | 21 +++++++++++++++++++++ libmultipath/structs.h | 1 + 2 files changed, 22 insertions(+) diff --git a/libmultipath/print.c b/libmultipath/print.c index d2ef0104..e61349f9 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -504,6 +504,26 @@ snprint_dm_path_state (struct strbuf *buff, const struct path * pp) } } +static int snprint_initialized(struct strbuf *buff, const struct path * pp) +{ + static const char *init_state_name[] = { + [INIT_NEW] = "new", + [INIT_FAILED] = "failed", + [INIT_MISSING_UDEV] = "udev-missing", + [INIT_REQUESTED_UDEV] = "udev-requested", + [INIT_OK] = "ok", + [INIT_REMOVED] = "removed", + [INIT_PARTIAL] = "partial", + }; + const char *str; + + if (pp->initialized < INIT_NEW || pp->initialized >= __INIT_LAST) + str = "undef"; + else + str = init_state_name[pp->initialized]; + return append_strbuf_str(buff, str); +} + static int snprint_vpr (struct strbuf *buff, const struct path * pp) { @@ -804,6 +824,7 @@ struct path_data pd[] = { {'g', "vpd page data", 0, snprint_path_vpd_data}, {'0', "failures", 0, snprint_path_failures}, {'P', "protocol", 0, snprint_path_protocol}, + {'I', "init_st", 0, snprint_initialized}, {0, NULL, 0 , NULL} }; diff --git a/libmultipath/structs.h b/libmultipath/structs.h index c21d1eda..c0f8929c 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -206,6 +206,7 @@ enum initialized_states { * change uevent is received. */ INIT_PARTIAL, + __INIT_LAST, }; enum prkey_sources {