From patchwork Wed Apr 2 23:13:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 14036577 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id CE93F1F7904 for ; Wed, 2 Apr 2025 23:13:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743635612; cv=none; b=t7N6MARoJeV+ncGDjFhYh1W97cJpcFln7LggxeG68NXPnWR2LmcElUkqk21QCDbPcgiaBULBUnBm0Va8imwjHXDsKtVAIVE/KuAbDYjY/ydxky6+NMq8AEBfUpfmhuxscCSZ/HsYsqnxNkafZRcRbMrubJwZsXGpmw5/44GMlWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743635612; c=relaxed/simple; bh=CuN6+D5ZqtTmGk17pE7Z+aCbNysBVqnqk7UyBPXzhgc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=OwgiPDrhWyT5wlmjrUHWYz4IUQM4iIacUPrISjAu+DqZi8bPv6pRlq5G2SjXgcgH0WzalsKVAky8h2FHKAffpGuy40ECXKfciIwlVzFMljMJJZgPO+oW6udvc2CfcWak3geKqwyw2nI/6+W6SZsaTkEKu7piiIe4zegZe9N2Rgk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JXXEmDad; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JXXEmDad" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743635609; h=from:from: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; bh=Z1u71JUgkCrZaaxyjgoiV8hcOXhStEfcLPqU6XJO4OM=; b=JXXEmDadU9tI2XBPS6C7zet6LepPoUteK/gtgGRR/s9X3ASWg/y9Uxc0HChaRJHGg2ngBt rzj0l27wH97vqHAoFhoHixagabC/KoanCs5xNhOPmsd0tlvilBEJyRs8N2Bkjldop5Ncnr QUIuE53VS9nYORhG/Chu1/i78SP17FE= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-413-pQXXEI4bM3KGCkes7GlKKw-1; Wed, 02 Apr 2025 19:13:26 -0400 X-MC-Unique: pQXXEI4bM3KGCkes7GlKKw-1 X-Mimecast-MFC-AGG-ID: pQXXEI4bM3KGCkes7GlKKw_1743635605 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E7A9C1800259; Wed, 2 Apr 2025 23:13:24 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (unknown [10.6.23.247]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 64777192C7C3; Wed, 2 Apr 2025 23:13:24 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.17.1) with ESMTPS id 532NDNGC3044081 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 2 Apr 2025 19:13:23 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.18.1/Submit) id 532NDNec3044080; Wed, 2 Apr 2025 19:13:23 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck , Martin Wilck Subject: [PATCH v3 1/4] multipathd: monitor new multipath dev even if we can't update it Date: Wed, 2 Apr 2025 19:13:19 -0400 Message-ID: <20250402231322.3044064-2-bmarzins@redhat.com> In-Reply-To: <20250402231322.3044064-1-bmarzins@redhat.com> References: <20250402231322.3044064-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: kgPH0-Lwy6AB09YdNu_ZcjcJwmRoN1OBrFEqGsIYFgI_1743635605 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true If a multipath device was created by the multipath command, multipathd might not agree with how the device was created. ev_add_map() can reload the device with a different table by calling add_map_without_path() -> update_map(). If this reloading of the map failed, multipathd was simply ignoring the multipath device, even though it still existed. One way that reloading can fail is if a path that multipathd already has initialized goes offline. If a multipath device is created by the multipath command while the path is offline, it will not use the offline path, since multipath won't be able to get the necessary pathinfo. However, multipathd will already have the pathinfo for the path, and may not even know that it's offline, since the path is an orphan. When it tries to reload the device, it will include the offline path, and the reload will fail. Instead of ignoring the device if it can't reload it, multipathd should just montior it as it is. When the path device is no longer offline, it can be added back to the multipath device by calling "multipathd reconfigure" or "multipathd add path ". Signed-off-by: Benjamin Marzinski Reviewed-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 e63b6aa7..7aaae773 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -679,7 +679,7 @@ retry: } fail: - if (new_map && (retries < 0 || wait_for_events(mpp, vecs))) { + if (new_map && wait_for_events(mpp, vecs)) { condlog(0, "%s: failed to create new map", mpp->alias); remove_map(mpp, vecs->pathvec, vecs->mpvec); return 1; From patchwork Wed Apr 2 23:13:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 14036574 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id BC0B91FC7CA for ; Wed, 2 Apr 2025 23:13:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743635610; cv=none; b=NNjfmy/2TFA7ISfCjwaCGtBqmC6a04c/blH59inrh8bN1C8b28KjAcrsqvBHHiMHQJp4Ejh1O1fr/h3puDTWZ/5HZo0ewLUqlM22S7NQvBzfB/6INMnl4y3Pc5Nqygl0XKjb/hQJOQFuOhETdyQv3xC6T0cEKf+LIhIruIBLlOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743635610; c=relaxed/simple; bh=zfej/LHdBiZ/zF47SgXz15+FbKYY9AYORajG+VicVm4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=Emg9Ero+6thxaUYBHmV03QkK+rjY6Gx16ULVHNQcfm++LCVkV4Lkcf/J84OuUEvTgMoluhgqj/uZGRNwRBV4RNSr/peQrltXuBENZ9i4S/kKfMqjEgtQDmYVAcDdGh83nch5yhbJPO3zcthoPxRy4p8v9ANS/MAeFj21Ls/jaTs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=epQJaWOT; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="epQJaWOT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743635607; h=from:from: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; bh=F+dIOWtXho6/gXoFh2i/yxa9canc0lXLKFdj9ISjrG8=; b=epQJaWOTRe3puqQeNXw8bQqV+9+JjQTXznXG4IRYHGDXqc+HEB65sqzqacbU1yowfS2jiw OdPOZ/6RXeo4J/kbfv453b4U9FEb+ZomVoxGmOAEZFWTcfWg1t/7VFCoqc7UlgxuZfTndl YegKYptKN0e34h5BkOOL8Etx5+L4uQo= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-337KYjmiNTiUv2JF63frcg-1; Wed, 02 Apr 2025 19:13:26 -0400 X-MC-Unique: 337KYjmiNTiUv2JF63frcg-1 X-Mimecast-MFC-AGG-ID: 337KYjmiNTiUv2JF63frcg_1743635605 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 42CAB1801A07; Wed, 2 Apr 2025 23:13:25 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (unknown [10.6.23.247]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B4BF91955BC2; Wed, 2 Apr 2025 23:13:24 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.17.1) with ESMTPS id 532NDNKb3044085 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 2 Apr 2025 19:13:23 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.18.1/Submit) id 532NDNTw3044084; Wed, 2 Apr 2025 19:13:23 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH v3 2/4] libmultipath: add helper function check_path_wwid_change Date: Wed, 2 Apr 2025 19:13:20 -0400 Message-ID: <20250402231322.3044064-3-bmarzins@redhat.com> In-Reply-To: <20250402231322.3044064-1-bmarzins@redhat.com> References: <20250402231322.3044064-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ELpryb6XKoZ13YsfJEy9kbjhrD3T_pwlsaCIZCQeP7g_1743635605 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true Wrap some code from select_recheck_wwid() in a helper function. A future patch will call this code from a different function. Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 12 +++++++++++- libmultipath/discovery.h | 2 +- libmultipath/propsel.c | 4 +--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 846101d0..c4bc6df6 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -2245,7 +2245,7 @@ static ssize_t uid_fallback(struct path *pp, int path_state, return len; } -bool has_uid_fallback(struct path *pp) +static bool has_uid_fallback(const struct path *pp) { /* * Falling back to direct WWID determination is dangerous @@ -2266,6 +2266,16 @@ bool has_uid_fallback(struct path *pp) !strcmp(pp->uid_attribute, "")))); } +bool can_recheck_wwid(const struct path *pp) +{ + /* + * check_path_wwid_change() only works for scsi devices, and it + * is only guaranteed to give the same WWID if the path uses + * the default uid_attribute + */ + return (pp->bus == SYSFS_BUS_SCSI && has_uid_fallback(pp)); +} + int get_uid (struct path * pp, int path_state, struct udev_device *udev, int allow_fallback) diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h index 2b39eb04..2ef1d94b 100644 --- a/libmultipath/discovery.h +++ b/libmultipath/discovery.h @@ -55,7 +55,7 @@ ssize_t sysfs_get_inquiry(struct udev_device *udev, unsigned char *buff, size_t len); int sysfs_get_asymmetric_access_state(struct path *pp, char *buff, int buflen); -bool has_uid_fallback(struct path *pp); +bool can_recheck_wwid(const struct path *pp); int get_uid(struct path * pp, int path_state, struct udev_device *udev, int allow_fallback); bool is_vpd_page_supported(int fd, int pg); diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index 664e62fc..367a9839 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -739,9 +739,7 @@ int select_recheck_wwid(struct config *conf, struct path * pp) pp_set_conf(recheck_wwid); pp_set_default(recheck_wwid, DEFAULT_RECHECK_WWID); out: - if (pp->recheck_wwid == RECHECK_WWID_ON && - (pp->bus != SYSFS_BUS_SCSI || - !has_uid_fallback(pp))) { + if (pp->recheck_wwid == RECHECK_WWID_ON && !can_recheck_wwid(pp)) { pp->recheck_wwid = RECHECK_WWID_OFF; origin = "(setting: unsupported by device type/config)"; } From patchwork Wed Apr 2 23:13:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 14036575 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id C349B1FC7CF for ; Wed, 2 Apr 2025 23:13:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743635610; cv=none; b=c+5z7ig3CjjTceEwewiD7Un+osG9sjCJhDTv8VtXBMgS4UhlpgElMWnnwjE8o9NbEWGmplkBhiCqFu4Yx0QuW6jYSXy4f+ECc5s8JTkBoM82W7YMiA5kwpryidPhfwDYdtCyLSBdf/isJKA9JmDYHfLS2Nfu9ZI4nfKcShuO1sQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743635610; c=relaxed/simple; bh=i74hoPYcBppYYn0DPKu859Gsq5aH8jaLjQwuda9lWS8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=EGeLBvwDJFBvfeYCzWDE5fyO2UfSmF+8W7aVfrJe8fGyoGIsiqp12O66sWkhXxna+t1MNyvbUYqKVlrUbIEFXSWFI/l92sstRVWoJcj99LdLRAn/VhzH1bxwec2Ipke94Xx7vkNHu7KGu0OBU/G1nwAsrBQS5p3xOjPXeDIotEY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=MYVuUsZZ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MYVuUsZZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743635607; h=from:from: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; bh=OCRjFYwMvpep2paRLnHKGpRcYXVdAvcNuotznJiNi+o=; b=MYVuUsZZF0WOAWFMbBq3Vulw4TelVV44hB97RGVHlhu9jNVc5PRps2P42RDiHfXXbRKH2g 0bJGAJb/AKlieu/vJMbVjA+OIi/urUMFoqKHG4KkOibP0wTCsJ23b8m3OzUMzV5lRqohXD rIwZlwY5BNORBLEP2cfbCxRI7POn9t4= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-696-OtxEzTgTNliMqNK96ukeQg-1; Wed, 02 Apr 2025 19:13:26 -0400 X-MC-Unique: OtxEzTgTNliMqNK96ukeQg-1 X-Mimecast-MFC-AGG-ID: OtxEzTgTNliMqNK96ukeQg_1743635605 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3BBBE1956048; Wed, 2 Apr 2025 23:13:25 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (unknown [10.6.23.247]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C686119560AD; Wed, 2 Apr 2025 23:13:24 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.17.1) with ESMTPS id 532NDN7g3044089 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 2 Apr 2025 19:13:23 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.18.1/Submit) id 532NDNZW3044088; Wed, 2 Apr 2025 19:13:23 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck Subject: [PATCH v3 3/4] multipathd: re-add paths skipped because they were offline Date: Wed, 2 Apr 2025 19:13:21 -0400 Message-ID: <20250402231322.3044064-4-bmarzins@redhat.com> In-Reply-To: <20250402231322.3044064-1-bmarzins@redhat.com> References: <20250402231322.3044064-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: PH5BqXYObrIuACOEVeUFW-HlKDwOcGp1IEsBHiLmMZY_1743635605 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true When a new device is added by the multipath command, multipathd may know of other paths that cannot be added to the device because they are currently offline. Instead of ignoring these paths, multipathd will now re-add them when they come back online. To do this, it multipathd needs a new path variable add_when_online, to track devices that could not be added to an existing multipath device because they were offline. These paths are handled along with the other uninitialized paths. Signed-off-by: Benjamin Marzinski --- libmultipath/libmultipath.version | 5 +++ libmultipath/print.c | 5 ++- libmultipath/structs.h | 1 + libmultipath/structs_vec.c | 5 +++ multipathd/main.c | 58 +++++++++++++++++++++++++++++-- multipathd/multipathd.8.in | 5 +-- 6 files changed, 74 insertions(+), 5 deletions(-) diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version index 9fda717c..a6718355 100644 --- a/libmultipath/libmultipath.version +++ b/libmultipath/libmultipath.version @@ -245,3 +245,8 @@ global: local: *; }; + +LIBMULTIPATH_29.1.0 { +global: + can_recheck_wwid; +} LIBMULTIPATH_29.0.0; diff --git a/libmultipath/print.c b/libmultipath/print.c index 00c03ace..019ae56f 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -658,8 +658,11 @@ snprint_path_serial (struct strbuf *buff, const struct path * pp) static int snprint_path_mpp (struct strbuf *buff, const struct path * pp) { - if (!pp->mpp) + if (!pp->mpp) { + if (pp->add_when_online) + return append_strbuf_str(buff, "[offline]"); return append_strbuf_str(buff, "[orphan]"); + } if (!pp->mpp->alias) return append_strbuf_str(buff, "[unknown]"); return snprint_str(buff, pp->mpp->alias); diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 28de9a7f..39d1c71c 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -413,6 +413,7 @@ struct path { int eh_deadline; enum check_path_states is_checked; bool can_use_env_uid; + bool add_when_online; unsigned int checker_timeout; /* configlet pointers */ vector hwe; diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index f6407e12..663c9053 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -389,6 +389,9 @@ static void orphan_paths(vector pathvec, struct multipath *mpp, const char *reas free_path(pp); } else orphan_path(pp, reason); + } else if (pp->add_when_online && + strncmp(mpp->wwid, pp->wwid, WWID_SIZE) == 0) { + pp->add_when_online = false; } } } @@ -595,6 +598,8 @@ void sync_paths(struct multipath *mpp, vector pathvec) found = 0; vector_foreach_slot(mpp->pg, pgp, j) { if (find_slot(pgp->paths, (void *)pp) != -1) { + if (pp->add_when_online) + pp->add_when_online = false; found = 1; break; } diff --git a/multipathd/main.c b/multipathd/main.c index 7aaae773..61ebf316 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -644,11 +644,45 @@ pr_register_active_paths(struct multipath *mpp) } } +static void +save_offline_paths(const struct multipath *mpp, vector offline_paths) +{ + unsigned int i, j; + struct path *pp; + struct pathgroup *pgp; + + vector_foreach_slot (mpp->pg, pgp, i) + vector_foreach_slot (pgp->paths, pp, j) + if (pp->initialized == INIT_OK && + pp->sysfs_state == PATH_DOWN) + /* ignore failures storing the paths. */ + store_path(offline_paths, pp); +} + +static void +handle_orphaned_offline_paths(vector offline_paths) +{ + unsigned int i; + struct path *pp; + + vector_foreach_slot (offline_paths, pp, i) + if (pp->mpp == NULL) + pp->add_when_online = true; +} + +static void +cleanup_reset_vec(struct vector_s **v) +{ + vector_reset(*v); +} + static int update_map (struct multipath *mpp, struct vectors *vecs, int new_map) { int retries = 3; char *params __attribute__((cleanup(cleanup_charp))) = NULL; + struct vector_s offline_paths_vec = { .allocated = 0 }; + vector offline_paths __attribute__((cleanup(cleanup_reset_vec))) = &offline_paths_vec; retry: condlog(4, "%s: updating new map", mpp->alias); @@ -685,6 +719,9 @@ fail: return 1; } + if (new_map && retries < 0) + save_offline_paths(mpp, offline_paths); + if (setup_multipath(vecs, mpp)) return 1; @@ -695,6 +732,9 @@ fail: if (mpp->prflag == PRFLAG_SET) pr_register_active_paths(mpp); + if (VECTOR_SIZE(offline_paths) != 0) + handle_orphaned_offline_paths(offline_paths); + if (retries < 0) condlog(0, "%s: failed reload in new map update", mpp->alias); return 0; @@ -2793,7 +2833,8 @@ check_uninitialized_path(struct path * pp, unsigned int ticks) struct config *conf; if (pp->initialized != INIT_NEW && pp->initialized != INIT_FAILED && - pp->initialized != INIT_MISSING_UDEV) + pp->initialized != INIT_MISSING_UDEV && + !(pp->initialized == INIT_OK && pp->add_when_online)) return CHECK_PATH_SKIPPED; if (pp->tick) @@ -2849,7 +2890,8 @@ update_uninitialized_path(struct vectors * vecs, struct path * pp) struct config *conf; if (pp->initialized != INIT_NEW && pp->initialized != INIT_FAILED && - pp->initialized != INIT_MISSING_UDEV) + pp->initialized != INIT_MISSING_UDEV && + !(pp->initialized == INIT_OK && pp->add_when_online)) return CHECK_PATH_SKIPPED; newstate = get_new_state(pp); @@ -2875,6 +2917,18 @@ update_uninitialized_path(struct vectors * vecs, struct path * pp) free_path(pp); return CHECK_PATH_REMOVED; } + } else if (pp->initialized == INIT_OK && pp->add_when_online && + (newstate == PATH_UP || newstate == PATH_GHOST)) { + pp->add_when_online = false; + if (can_recheck_wwid(pp) && check_path_wwid_change(pp)) { + condlog(0, "%s: path wwid change detected. Removing", + pp->dev); + return handle_path_wwid_change(pp, vecs)? + CHECK_PATH_REMOVED : + CHECK_PATH_SKIPPED; + } + ev_add_path(pp, vecs, 1); + pp->tick = 1; } return CHECK_PATH_CHECKED; } diff --git a/multipathd/multipathd.8.in b/multipathd/multipathd.8.in index 43f87bf8..8815e099 100644 --- a/multipathd/multipathd.8.in +++ b/multipathd/multipathd.8.in @@ -595,8 +595,9 @@ The device serial number. The device marginal state, either \fImarginal\fR or \fInormal\fR. .TP .B %m -The multipath device that this device is a path of, or \fI[orphan]\fR if -it is not part of any multipath device. +The multipath device that this device is a path of, or \fI[offline]\fR +if this device could not be added to a device because it is offline or +\fI[orphan]\fR if it is not part of any multipath device. .TP .B %N The host World Wide Node Name (WWNN) of the device, if any. From patchwork Wed Apr 2 23:13:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 14036578 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 smtp.subspace.kernel.org (Postfix) with ESMTPS id 459B11F755B for ; Wed, 2 Apr 2025 23:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743635614; cv=none; b=LyUBLEhWo0XFYtBNawxcnvPumdvwZFf5jMS5Hq5tVvYlh4x0v73LBzsHensVIJV3Y/y3re9MUFpeeB1IA3HZ+NX0pUUGurxBSQPOQwfC4YbSm7ZZCzLnxM3s/Hm92nArkLIxBjoa2ypxUY6WpHIi+JKVZdZanrDvUbE/NLwloEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743635614; c=relaxed/simple; bh=5F0pser7xeHU3dNHOuKLEf1HF3Ny3Bdall0NaTLNgQ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=FjUPqMznop7q/ISfiCI9uXI0PnC9OfbadlK/U6W51HLGKRUy1WQpYodGdXKLM9/Zw/r1KAT07OFeLO90yrmG8FnJHUUjUecjYN7zdb846VoDJ+pJrc+1cSMmNUKUZACLM4AmgQ27QomO1Pe1SCTtuG9imFKQFZUINi+NjObCLd8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=GViSpKRP; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GViSpKRP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743635610; h=from:from: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; bh=Ac4cHuBPk05HpekGxC/h0J5fHiT6ZmljnDOnXcQVDbQ=; b=GViSpKRPpMGu7FJbawFjJavgmxQ8pOHc92tgPyQNtfHFV+MPIXpt0NzVissywUTkf77W5r MYu45EjQ+cilExpd978SyTF5EuiyGrxDoj6dL+jxRS+KMqPQ0b5WQcv7tS8tFE8UmF0GrV 1BRFudl7K0hg8Z25+eCl0o1w5aPOcaE= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-471-yxkuI4jeMo-8vLIlcSx2Ew-1; Wed, 02 Apr 2025 19:13:26 -0400 X-MC-Unique: yxkuI4jeMo-8vLIlcSx2Ew-1 X-Mimecast-MFC-AGG-ID: yxkuI4jeMo-8vLIlcSx2Ew_1743635605 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5F5E91956089; Wed, 2 Apr 2025 23:13:25 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (unknown [10.6.23.247]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EFEBF180176A; Wed, 2 Apr 2025 23:13:24 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.17.1) with ESMTPS id 532NDN0x3044093 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 2 Apr 2025 19:13:23 -0400 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.18.1/Submit) id 532NDNRv3044092; Wed, 2 Apr 2025 19:13:23 -0400 From: Benjamin Marzinski To: Christophe Varoqui Cc: device-mapper development , Martin Wilck , Martin Wilck Subject: [PATCH v3 4/4] multipathd: don't update paths in INIT_MISSING_UDEV Date: Wed, 2 Apr 2025 19:13:22 -0400 Message-ID: <20250402231322.3044064-5-bmarzins@redhat.com> In-Reply-To: <20250402231322.3044064-1-bmarzins@redhat.com> References: <20250402231322.3044064-1-bmarzins@redhat.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: RiOAi6ghZstEd2Ud1DrjJcN76Mlzb2sk-R1KbDdcBuw_1743635605 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true There is nothing for update_uninitialized_path() to do for paths in the INIT_MISSING_UDEV state. In fact, there shouldn't be any paths in this state when update_uninitialized_path() is called, since they will have switched to a different state in check_uninitialized_path(). Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 61ebf316..99d603f9 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2890,7 +2890,6 @@ update_uninitialized_path(struct vectors * vecs, struct path * pp) struct config *conf; if (pp->initialized != INIT_NEW && pp->initialized != INIT_FAILED && - pp->initialized != INIT_MISSING_UDEV && !(pp->initialized == INIT_OK && pp->add_when_online)) return CHECK_PATH_SKIPPED;