From patchwork Tue Nov 12 15:02:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872373 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA167202F82 for ; Tue, 12 Nov 2024 15:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423757; cv=none; b=T6AteRNYYWraLFH8l5tBkyKmhBlPn01k0v7F/K6vgH6SR1gZN0qiUpgnrVqnep9iF4RtpvfESJ/TwapUH+SxiihCS83V2rsOsYwqFJ8jwm5fZ1iGMQpwIpoPi1aql49IShRSSiKxRQyVhGZgKvSadNC2wruH0iDU0PBhQU68Sl4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423757; c=relaxed/simple; bh=Aw4TAQDNERCvmqA104IpBo1CfRN86k0jqEIe6hqlbkc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cRksdS9VpdmY8mXHgqLF6YmnaXk2Hsct5NwtNZZuPkVwjbyikKbj/p2y0n34tNuEZp1T24nuMViRm4VbR84D3fCwqMuE60IC++785T1JOyGb0tB+89QkiRXGtdHhcdt5cKqeKZPypUlTDBRMUoRQ5PXYO9DEOZgVSZX4HxaL4v8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=GTu6EIoA; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="GTu6EIoA" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-431548bd1b4so49347095e9.3 for ; Tue, 12 Nov 2024 07:02:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423753; x=1732028553; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c7D3W5VxO1slniB2q9G87wm2gIQMzUlOVKrRB20+rX0=; b=GTu6EIoAIWhK52AwaZWJUyDirbps9DCGwxiO09p+26qeol6xkrbuK7evXiZB3l2eg8 yvqYI7uF6avhQnTxNCnusgkyrLN7ODYAPORn9ZLVaDOOY9/neMnncZvqHqyvbwdnXEfa izMoh7V9BZc5fFAl11WDUERe01tBGP4wXGfG7mCZ54X8OEakLNYHcZaAPMpR4ctdJaNF uIH6RG/cYZwREa50kI9dId/YswrSylr73fBc0CM4dqHkGR7XoQuisXOxTaMOmYy/5R0R ZGEURRbU5cxn9ZzO/lwyZQnUn95262mqNZQswzp2IWEeVi1qH3oeobj7y7RcqU83h2Lh dpeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423753; x=1732028553; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c7D3W5VxO1slniB2q9G87wm2gIQMzUlOVKrRB20+rX0=; b=IwropwYXK84cMCX3JVtdaMu26+v6MllKwMlrMMmdyG5I2KM/x/+npg2kWnBMfPdww9 h4rSdQNPxbxnRezf8cAfau+PbSgKXNzQPm7LpvhaIWljuErIXphIB97YRltYAWadXvtN ME1tvsCWq3iod8ULzBLTXPwgT1UnBHdDzVCKOyP+XYfoseJPDsWruyVwszmnjs39BLsv xYNMv1hUlGbTYKHeEtyYdIMztaNd/BIBsGobfN6Cm6ON6c2U9C3JLj6Ff3IsYgYYU/rv ud68AY+r0u6aPmDkaFcm47NID3j/55HULHTpGcWap+Wg59TkVM3kZmXs4kEhens+GmEk AmwA== X-Gm-Message-State: AOJu0YzLiRY39SdDAfDQjQWSXMW0qWDhLPpDZkkZpuqXyQQTOyMO5YPD 8ELDwBuxVlyQf9H3NBiGkDXFXBNJABmuhvuKTpxAhaLJX9vobe59nhHFjopJbYU= X-Google-Smtp-Source: AGHT+IELj8Qo2y52l/8gscNlClElphxLpv6OwVEs4/3vmhxxNaJcoG36AuITCa3IGPGJE2oB8ALoyw== X-Received: by 2002:a05:600c:1909:b0:431:4a5a:f09a with SMTP id 5b1f17b1804b1-432b7518cbemr139861685e9.24.1731423752542; Tue, 12 Nov 2024 07:02:32 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-432cf1216d6sm14867735e9.0.2024.11.12.07.02.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:32 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 01/12] libmultipath: dm_get_maps(): don't bail out for single-map failures Date: Tue, 12 Nov 2024 16:02:04 +0100 Message-ID: <20241112150215.90182-2-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 dm_get_maps() traverses the entire list of dm maps. We shouldn't give up just because probing a single map failed. Based on an earlier patch from Benjamin Marzinski Fixes: bf3a4ad ("libmultipath: simplify dm_get_maps()") Signed-off-by: Martin Wilck --- libmultipath/devmapper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index c497c22..52bfe9c 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1262,10 +1262,8 @@ int dm_get_maps(vector mp) } vector_set_slot(mp, mpp); break; - case DMP_NO_MATCH: - break; default: - return 1; + break; } next = names->next; names = (void *) names + next; From patchwork Tue Nov 12 15:02:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872375 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7111B202F9C for ; Tue, 12 Nov 2024 15:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423759; cv=none; b=hvjnfISRS6I5nJZBBDNCEYkADXeJiKmYe0fj5LOvQvgVQoAbfzx/Slg57r12Ty5SPQ0zHd0JEcCNlGPhVWFEKYF79x8EiMFSNS7VJQpf11MlS7nbhdGzHOeEQYbGvHSRuA9uyUMjCH4UHnO+JesZ4Wm2Bdv9dk2pBVtKGiizDQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423759; c=relaxed/simple; bh=wwpgGa1IpqLv0Y3jwkmcqUvUlItSqjpF2iQVWbPRXHw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l4kfQlzIJOtLdPP8jJsWeXetROExEsZRuoiYsVb1eSqleUfb70ORBIODXYSFeKd6XImNn6SIBvmkTXmPgVM6x58CuyWgpzOmvP5sC21gTX6wQYT1c0KJ4jo6UnOnldPNugbVR0CQypLSsHi7e9+7ruX/0j2eEMU/k8OZYEsV3YA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=HJAcIrie; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="HJAcIrie" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4315eac969aso33503275e9.1 for ; Tue, 12 Nov 2024 07:02:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423756; x=1732028556; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uaegvdmr12Jodj4tZFHwcVICwYupT9s60O77leYHrq0=; b=HJAcIrie67LlZN3EzwhODF5jpY7K1ZozFo1+RYoXLXh+Bsi4SBByxZfrdsiuyD2vca rryOjWfX/NtfffChovLvZeMEjR0egsypUkb3g2YTY4i7dCPjLwPECgUDduT7asQc8fsb uwC//CK+qmKI2MFkfvwzbh5GYoR1EXX39VxFvoIUglUf7H3HQt9wL1RT2qo6Ubji7MBv 6IofMqFlvQFdW46E98Lzq7GDxFCU5tF62YW5IoyArNTnX+IK2gKxR43j6EAukgh6+gpu 0nlpmn5bfOWy8eFftnC0Jd8kjZ8wHYlY4mqUaz3r3VCAroZYTlHGJE9gSaeXAkhxT0pj i3ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423756; x=1732028556; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uaegvdmr12Jodj4tZFHwcVICwYupT9s60O77leYHrq0=; b=E4y2SwAvRGQfjvD1npB5iPx5iW9sVmH0HsvS02M44X4dEEvawdMtvpPhbYi/SV4prl 02t5jAsv9yafdV8UFt8YwjathabASdT2nVNmseJUnQ2oZVfWvaZsX/ZPt7hrD82e7YMy hEA2raOIJ0FLrJ/T7nxPgIH04cLbePO9tL+pNrHogz+7S7j2Gl63HNKY7ew0BiiAb4ho lBsLnwmrSGAUp53NNRnG54Jnhiaz15vBh/h0snQi0jpLyRXbEf0J2jOJGfn7iE7Kzbkz DKCaIaCp5K2nM3SDeugK6Pc7cf3IqcN3ZZVlg4ItqsywrChbrfnpFTB7pod8Ns0mwwxU FLRQ== X-Gm-Message-State: AOJu0YzaF+gKOwlYnlCNBVdxr5UI7iVBDHYqIIl7zc8WiattrN0DHa9t liRb8VERNsTRH94s7iZw6doh3GGRfIM2fDDhHHG6mMTE4knTKn4suahNEel2hvHqXO5x4aVNcoh m X-Google-Smtp-Source: AGHT+IHnlNL4HryuRw1Vo5SJa4C9XNJ5aWWIuWeK+V1hnRQOVGdYF5n2vo3Po73gv9y5eRxyKAgjPA== X-Received: by 2002:a05:600c:3ba9:b0:431:47e7:9f45 with SMTP id 5b1f17b1804b1-432b686ec45mr153149175e9.11.1731423753586; Tue, 12 Nov 2024 07:02:33 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-432aa73886bsm246087645e9.39.2024.11.12.07.02.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:33 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 02/12] libmultipath: libmp_mapinfo(): return DMP_NO_MATCH for multi-target maps Date: Tue, 12 Nov 2024 16:02:05 +0100 Message-ID: <20241112150215.90182-3-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 multi-target maps are more like maps with a single non-multipath target than like maps with no target at all. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- libmultipath/devmapper.c | 2 +- tests/mapinfo.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 52bfe9c..ab6eefc 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -719,7 +719,7 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma if (dm_get_next_target(dmt, NULL, &start, &length, &target_type, ¶ms) != NULL) { condlog(2, "%s: map %s has multiple targets", fname__, map_id); - return DMP_NOT_FOUND; + return DMP_NO_MATCH; } if (!params) { condlog(2, "%s: map %s has no targets", fname__, map_id); diff --git a/tests/mapinfo.c b/tests/mapinfo.c index fca6462..66c81e8 100644 --- a/tests/mapinfo.c +++ b/tests/mapinfo.c @@ -870,7 +870,7 @@ static void test_mapinfo_bad_next_target_01(void **state) rc = libmp_mapinfo(DM_MAP_BY_NAME, (mapid_t) { .str = "foo", }, (mapinfo_t) { .size = &size }); - assert_int_equal(rc, DMP_NOT_FOUND); + assert_int_equal(rc, DMP_NO_MATCH); } static void test_mapinfo_bad_next_target_02(void **state) From patchwork Tue Nov 12 15:02:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872374 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D751202F9E for ; Tue, 12 Nov 2024 15:02:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423759; cv=none; b=HYnMeyWzZrpBkXqidLbDFulzK8tsU9I7Dr/ozV41MRV8Nph12B5c+posUWCxS7toG1FkkDnHnwsTnpXLqSv+b5BJy+g16uqKC+alPwlxP/J2X+a3uGDqMSc/z4arxucubTvjpJiW8V9yrbD2A2X+UznBqFB3mDShhFnDZPKi3vc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423759; c=relaxed/simple; bh=4XHTKgsq0ewjstUZzsLq7uJE566Tj7F3r29td0h24vE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eqNnxg5stQXrHuIwZJR9ti2N/8hMEoL4xI1UWhYwlhXkW2ypKwTCN+o/RPoWFH5Tefwr1TDzvKcve3TjQwWuSupjFHRfwxtC21KZMN/O/0K26V7GDEP6WQPXOisw0Fc55K9+WBxJDeL+e+VmDmkXShGf+fdkfh42/soKTYlnBFE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=RG6l4+hg; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="RG6l4+hg" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-43193678216so55178275e9.0 for ; Tue, 12 Nov 2024 07:02:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423755; x=1732028555; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oM9G4+Y/UUNSnI92ytGGI9bTNUrGAHaIcfobgWz451Q=; b=RG6l4+hgfCuOBqo+eyAp7OGyhy06qbGc8eJ6lC21ZxFxVMl+cNQSV+cqWrikkfG70d kQEGYUFpKqVSubKGT3tgyAdxh2uXVIuIKOywM+TdVndsfYgl8IhX6Bz0q2TXZLqMWYb7 7cB6zMumaJv+Gk2U1ilT6vD6eXu7aJwBzYUwSsbcfOnFK02zONWeYDDE5XOsojCPX++l X2wc0T14Jzu1lzU+qlw/yciAWhPjgZ+m/QF1ZE7iRhtCn4UEoQac1bETWpD8ZSaL9d08 S9hl8CMJr3fPJThhVRtGsNK6a9Qg+zS1k2Pg4uBEDkBYLZPQcmoVXnFcM7K2Ra4w+9Ee gLgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423755; x=1732028555; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oM9G4+Y/UUNSnI92ytGGI9bTNUrGAHaIcfobgWz451Q=; b=ckk8UwlaN2fJrqzqEEyc5GYF0gJcfkcRRWDOwU7Bk0a2cbX/v0hhwo4Uo8ZsEIsDGq 8uNiz7QQkXi0XWL38TuJrIV4nETTeqmgM1wKAJWCQnkozQS9A/E96gGTMugpVxR7Aa2a D7UwKVfi0Jnp5OQldc5O2B/nMCgdzFrHbIV+GyelMi7yE/J2tI3O/YxQzHJLh7vjhFfW TAvUcPM2rGTkzi1m7pERNHHB9ZMM9lqBbSRPHzrpyXi2LKE8s2DntG7b253raUCurq9K aXqJvmNTYdQHnMQeth2KdQyZNlXiA5n7cMV7L93DxPwmyNoiuJ5QbsYB7irRH+uXXc0Q TuUQ== X-Gm-Message-State: AOJu0Yw5EQahjU0i+hkld9w6Hp7ZvDKA0vKOWKtmBpEFsTFjlctoJdeK tCAlJGXHlb19CfPPTijvIj3xmjwf4FRWK5Bq6/MPxTfWYo68PGp3CCylTRFb24Y= X-Google-Smtp-Source: AGHT+IG4myLadnuziydGP5txJQiHuEFSCtMLjCjoxaeSr/vXVizSL0pWkjP4L8zTUqT48w1aiQhfFA== X-Received: by 2002:a05:600c:3ca8:b0:42c:c003:edd1 with SMTP id 5b1f17b1804b1-432b7501d59mr144266325e9.10.1731423754669; Tue, 12 Nov 2024 07:02:34 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-432aa6b35c0sm256276535e9.16.2024.11.12.07.02.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:34 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 03/12] libmultipath: check DM UUID earlier in libmp_mapinfo__ Date: Tue, 12 Nov 2024 16:02:06 +0100 Message-ID: <20241112150215.90182-4-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Benjamin Marzinski Before checking the target details, first check that the device has a "mpath-" dm uuid prefix. If it doesn't then we can just ignore the device. This keeps multipath from printing error messages for non-multipath devices with multiple targets for instance. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/devmapper.c | 20 +++++++++++--------- tests/mapinfo.c | 15 +++++++++++---- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index ab6eefc..93fbc4a 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -715,6 +715,16 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma return DMP_NOT_FOUND; } + if ((info.name && !(name = dm_task_get_name(dmt))) + || ((info.uuid || flags & MAPINFO_CHECK_UUID) + && !(uuid = dm_task_get_uuid(dmt)))) + return DMP_ERR; + + if (flags & MAPINFO_CHECK_UUID && !is_mpath_uuid(uuid)) { + condlog(3, "%s: UUID mismatch: %s", fname__, uuid); + return DMP_NO_MATCH; + } + if (info.target || info.status || info.size || flags & MAPINFO_TGT_TYPE__) { if (dm_get_next_target(dmt, NULL, &start, &length, &target_type, ¶ms) != NULL) { @@ -740,18 +750,10 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma * Check possible error conditions. * If error is returned, don't touch any output parameters. */ - if ((info.name && !(name = dm_task_get_name(dmt))) - || ((info.uuid || flags & MAPINFO_CHECK_UUID) - && !(uuid = dm_task_get_uuid(dmt))) - || (info.status && !(tmp_status = strdup(params))) + if ((info.status && !(tmp_status = strdup(params))) || (info.target && !tmp_target && !(tmp_target = strdup(params)))) return DMP_ERR; - if (flags & MAPINFO_CHECK_UUID && !is_mpath_uuid(uuid)) { - condlog(3, "%s: UUID mismatch: %s", fname__, uuid); - return DMP_NO_MATCH; - } - if (info.name) { strlcpy(info.name, name, WWID_SIZE); condlog(4, "%s: %s: name: \"%s\"", fname__, map_id, info.name); diff --git a/tests/mapinfo.c b/tests/mapinfo.c index 66c81e8..4362cdb 100644 --- a/tests/mapinfo.c +++ b/tests/mapinfo.c @@ -43,6 +43,15 @@ static const struct dm_info __attribute__((unused)) MPATH_DMI_01 = { .minor = 123, }; +static const struct dm_info __attribute__((unused)) MPATH_DMI_02 = { + .exists = 1, + .live_table = 0, + .open_count = 1, + .target_count = 1, + .major = 254, + .minor = 123, +}; + static const char MPATH_NAME_01[] = "mpathx"; static const char MPATH_UUID_01[] = "mpath-3600a098038302d414b2b4d4453474f62"; static const char MPATH_TARGET_01[] = @@ -928,6 +937,8 @@ static void test_mapinfo_bad_target_type_03(void **state) mock_mapinfo_name_1(DM_DEVICE_STATUS, 1, "foo", 1, 1, 0); WRAP_DM_TASK_GET_INFO(1); WRAP_DM_TASK_GET_INFO(&MPATH_DMI_01); + will_return(__wrap_dm_task_get_name, MPATH_NAME_01); + will_return(__wrap_dm_task_get_uuid, MPATH_UUID_01); mock_dm_get_next_target(12345, TGT_PART, MPATH_STATUS_01, NULL); rc = libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_MPATH_ONLY, (mapid_t) { .str = "foo", }, @@ -1090,7 +1101,6 @@ static void test_mapinfo_bad_get_name_01(void **state) mock_mapinfo_name_1(DM_DEVICE_STATUS, 1, "foo", 1, 1, 0); WRAP_DM_TASK_GET_INFO(1); WRAP_DM_TASK_GET_INFO(&MPATH_DMI_01); - mock_dm_get_next_target(12345, TGT_MPATH, MPATH_STATUS_01, NULL); will_return(__wrap_dm_task_get_name, NULL); rc = libmp_mapinfo(DM_MAP_BY_NAME, (mapid_t) { .str = "foo", }, @@ -1112,7 +1122,6 @@ static void test_mapinfo_bad_get_uuid_01(void **state) mock_mapinfo_name_1(DM_DEVICE_STATUS, 1, "foo", 1, 1, 0); WRAP_DM_TASK_GET_INFO(1); WRAP_DM_TASK_GET_INFO(&MPATH_DMI_01); - mock_dm_get_next_target(12345, TGT_MPATH, MPATH_STATUS_01, NULL); will_return(__wrap_dm_task_get_name, MPATH_NAME_01); will_return(__wrap_dm_task_get_uuid, NULL); rc = libmp_mapinfo(DM_MAP_BY_NAME, @@ -1162,7 +1171,6 @@ static void test_mapinfo_bad_get_name_02(void **state) mock_mapinfo_name_1(DM_DEVICE_STATUS, 1, "foo", 1, 1, 0); WRAP_DM_TASK_GET_INFO(1); WRAP_DM_TASK_GET_INFO(&MPATH_DMI_01); - mock_dm_get_next_target(12345, TGT_MPATH, MPATH_STATUS_01, NULL); will_return(__wrap_dm_task_get_name, NULL); rc = libmp_mapinfo(DM_MAP_BY_NAME, @@ -1195,7 +1203,6 @@ static void test_mapinfo_bad_get_uuid_02(void **state) mock_mapinfo_name_1(DM_DEVICE_STATUS, 1, "foo", 1, 1, 0); WRAP_DM_TASK_GET_INFO(1); WRAP_DM_TASK_GET_INFO(&MPATH_DMI_01); - mock_dm_get_next_target(12345, TGT_MPATH, MPATH_STATUS_01, NULL); will_return(__wrap_dm_task_get_name, MPATH_NAME_01); will_return(__wrap_dm_task_get_uuid, NULL); From patchwork Tue Nov 12 15:02:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872376 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92DC420370C for ; Tue, 12 Nov 2024 15:02:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423760; cv=none; b=dfuUWW0x6+UTF71XSYMgzr5Q38RI2q7MtK+aRkr57PSXx3LpYdD3Hb+9HQ2IhOFkg9+NYsk9tR27+nc/tnTPABi8/pWg9KIFodLy4ZDB64HmRG6g7+DbqpNge1psb2iPp4XPEkhUaLIAwHovPzZAVEItHvVLTgATeFxFoIZ6eeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423760; c=relaxed/simple; bh=H+VRsW7Xn0yLoakFQJ0gRM3MyEEWzOa34iOeU8px734=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RufQOod3fk6mcgMR+kojiZQANZUKXSai2mvBjQGLD8InSVibzToTLTPLrUEBXzCGQCLMufg2cKIN8dfjdNr9mGZW0yU6L0TbIT9qbgLuz+u7mZlPsVXlFQVECo0j8W0GlQyhTK/zvPTcB53Ap+dRYuxomjANCkeWlUeTQRh+zT0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=gd/UIFr2; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="gd/UIFr2" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-37d473c4bb6so5371743f8f.3 for ; Tue, 12 Nov 2024 07:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423757; x=1732028557; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o1o4XHBXt7Gcdwmg05GovfIjGORc7/16vIFhR/9ZGGM=; b=gd/UIFr2j4Rw9FJwPruNMstzQAC6cIH9YfSUSD195HpFU5fRAt8OSCbItOLK322LN0 X7lsXgfjfXf5qMDH5PUmJ7yn5lUmT85F77TDqV9KnZp6lYQG5rfcpFcNR+fUrVMFSULf zqiXyZOvMTey9TWNnf3NI7XjT93jisvN/wgTkU87kTUMwiUGKITtREo4BkIYnhWwH9j1 juRMnXqTHa6t8wAZrgSXQ8XR560pWayClxA6ZCs/daeA/l7/lCFn8bjx9vsMZpECPhUB IxpYfHZh52AxTtLVN20D0apMamif4fpdDKeytBEUMomLBUFXVCGDVf7fy8lytWBi9uQp fLMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423757; x=1732028557; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o1o4XHBXt7Gcdwmg05GovfIjGORc7/16vIFhR/9ZGGM=; b=nGltOCM6nqWao83pJVVeKvE15xeuSMmaLvVb9Fkp7wpCcCpYQMUXRX2BJk0vioPbgg xd3m6rngtseeWisfDEpSoPwXzfPsRVWusWM5XjuRruCoEV+SW10kVe+locbuzyGRwC8k fJFeUhv0B50dS8YEp2Ij5zqp0nVkHhRrZ+ws6I90eID097+vvpMfVbDqPsdci8f2FY17 C8Z3NzqTXF6g79SDN6aX/wzPR1Ld9OvcMjacfzekeF1Kekn/0tT7i0IUKQWH5SzQLcKR zf0Mz2/9uXK9JNQ7jm//kjGvHDWOgRNVfM9iHLfs/Iw/cxu+1ZRdQkIvomQaMqOjD5rb iBow== X-Gm-Message-State: AOJu0YwMk6LXm9f1ucVMekljtK6mmFPhQWzffEZgiYj04w0iigHhcNWf SzxZ8L8+xgOklOe90mf4GdxdqsgRkvHlEqYZyGRfC7LoEkoPqWIXrZVj7aeJc98= X-Google-Smtp-Source: AGHT+IF9KhphZyoUdEOTTPjxRw/lGl6WoIrMMc0QMm2Cb/gZqB8zorEnGW4UZWT0ecA+etW173vHgg== X-Received: by 2002:a05:6000:1fa1:b0:37d:3e6d:6a00 with SMTP id ffacd0b85a97d-381f1884805mr16454000f8f.47.1731423756084; Tue, 12 Nov 2024 07:02:36 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-381ed997313sm15541648f8f.53.2024.11.12.07.02.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:35 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 04/12] libmultipath: use MAPINFO_CHECK_UUID in dm_get_multipath Date: Tue, 12 Nov 2024 16:02:07 +0100 Message-ID: <20241112150215.90182-5-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Benjamin Marzinski Instead of seperately calling is_mpath_uuid(), just use MAPINFO_CHECK_UUID when calling libmp_mapinfo. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/devmapper.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 93fbc4a..d193586 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1211,7 +1211,8 @@ static int dm_get_multipath(const char *name, struct multipath **pmpp) if (!mpp->alias) return DMP_ERR; - if ((rc = libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_MPATH_ONLY, + if ((rc = libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_CHECK_UUID | + MAPINFO_MPATH_ONLY, (mapid_t) { .str = name }, (mapinfo_t) { .size = &mpp->size, @@ -1220,9 +1221,6 @@ static int dm_get_multipath(const char *name, struct multipath **pmpp) })) != DMP_OK) return rc; - if (!is_mpath_uuid(uuid)) - return DMP_NO_MATCH; - strlcpy(mpp->wwid, uuid + UUID_PREFIX_LEN, sizeof(mpp->wwid)); *pmpp = steal_ptr(mpp); From patchwork Tue Nov 12 15:02:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872377 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A42302038D6 for ; Tue, 12 Nov 2024 15:02:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423762; cv=none; b=grkYJarnGd+GHUMr/oFOB2EaIsl+OwYJM3C3FcPXwCPSHeFjrPMXEBTZocNtIfS3WnviOVxX0xjpIUwVsXStegiWRXLryg02b+Uwd7QVDO5KBO7UpIpFMVSsONBph8pHBA9zW4QWMHivubC6Mp6BvPWJBuDG+t/cfm0m0EO+jVo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423762; c=relaxed/simple; bh=gy8rx06hlELDWsNWF1BV4zSFyw2JKnUFKgUtELQKW3w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RGiC7HYjleOSZOGMt89gAAdUp5qH6BLoiuf9gpEEgHgoV1lEepL6pF4jwLhJfQkiDRJhWJqg80aO+j10nW4Oha9KzlA9wXhJogAKEFESzHIIij2lgTPDYaYqO9FHZg1POBxez/HEdPmLG8YIEt3Zghq8YC7u3jSPHR0WoZDldCo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Py9V2mXo; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Py9V2mXo" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-53d8c08cfc4so3167480e87.3 for ; Tue, 12 Nov 2024 07:02:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423759; x=1732028559; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UwOpU+9TAGmH+CHuX+QM5KopibTesgkhxmGrqFO+Fas=; b=Py9V2mXok/Uk+nCPjYz/+WAd7L6e6lx3Oo0hYQ1a3k9/d3W54n5smqxhBKOLPeRGQ9 aIwvVZ7JUfmwLIzqxkMuerC9JEeZJmN+tYmQYooDJUz9UsKR2KXaoN1cP1cEctohIm6a 17euz5sy63drLbxMmVaGWd0Q6KSA+9NpjxMGFuUZnpq9UocaKdKvFcT4A2R3HNB3Wuet saV5T9M8UVsNoLDzRqgKOCecS+d7H/GTX2MmuR/Qg3k1+mhgboOa2owek1zZpd2KqDxb XZLH9v9cLXzNqkNPaJjxcG2bY5DeTrqHeokP4uLbb9Vbk5acitH4UsP8pBv9fN82A+yS KTEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423759; x=1732028559; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UwOpU+9TAGmH+CHuX+QM5KopibTesgkhxmGrqFO+Fas=; b=blhJw7+bxNtlS9WrDEsGSkBm5BMxoHETA/jUkZBwfmduKQ1xn5z2zzz9MtQwWFmGsf aaa1QCP3dZO7Sz+zcBcQANLe+RgeFEW3dqIUMT8nIQiHsWn4c1XomwYOqITXGIkHbHLf 7uT2odINg8jCrL3djSl6kFzVNOnQSjMsS2IPKcvycYstiWVA8FSQATd7xJyhkUpUObuu TAZJEuVUIdOBmRk96Q61TOmAhd1G1OJJaBJmPla2fkxCb5QHRV8uyg0aRGBvwjpNFydA FmZ+ansQ+RNkXZ8Zoy64FiE12gnLwGUAZZS5sMGUrJeZ/umb4FfLOgEyCKpeG06bk5lZ oakg== X-Gm-Message-State: AOJu0YwGtHF1grwkDKaVE9i/CKXrqcNGu0JwKXTzoIhcpNk76XYZYGGE kvxse6vZyd8QdnSCWPwhpQUYASeUdQ8CQWuyOXvve0yMpH8KSL9aKFW+RYQ4qnc= X-Google-Smtp-Source: AGHT+IExvO8sI1uMkn0aQ+50+o0wJJqFvSESiWWJIHNhLZcVPZdwXB3oPP5TwOqznvKkgu1A3Zo5EQ== X-Received: by 2002:a05:6512:ba0:b0:539:e436:f1cd with SMTP id 2adb3069b0e04-53d862d38c5mr8297419e87.16.1731423757680; Tue, 12 Nov 2024 07:02:37 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-432b05e5bddsm216349515e9.38.2024.11.12.07.02.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:37 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 05/12] multipathd: print an error when failing to connect to multipathd Date: Tue, 12 Nov 2024 16:02:08 +0100 Message-ID: <20241112150215.90182-6-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Benjamin Marzinski Issuing multipathd commands when the daemon wasn't running didn't print anything. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/uxclnt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c index 16133a8..55d253a 100644 --- a/multipathd/uxclnt.c +++ b/multipathd/uxclnt.c @@ -52,8 +52,10 @@ int uxclnt(char * inbuf, unsigned int timeout) if (!inbuf) return 1; fd = mpath_connect(); - if (fd == -1) + if (fd == -1) { + fprintf(stderr, "ERROR: failed to connect to multipathd\n"); return 1; + } ret = process_req(fd, inbuf, timeout); From patchwork Tue Nov 12 15:02:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872384 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79CD6204027 for ; Tue, 12 Nov 2024 15:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423777; cv=none; b=k4NuaWTTs15LCkdfbrVGKReIxd197OjF8AbwuzLkLipHD4t8AlW9zc4U7+FdouWzoDwEoJJn/ybT0HAcu4Wu1Z6LEP7GNy932MDBeBvNILimraRDgcolfhZqSeeS3Uka6yM72rbH8nuegf653iifPvh1V/WQQfF/y06XehKUT4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423777; c=relaxed/simple; bh=P4QZIPlTFjOfEV19+T7IkTY5b8/zpjZmiO3qQ6J0Ut8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N4u3uyFNbqwJL4TaRc5yls5jGWUEUI8Kp1yBm842y86MBPwdUlQpD/KVz9nyQvBaS2jipb2jtktop+AqS5hqhOLnRIsMKYb33JlHE7pDM7c6cUEtZCqRWdHQEpA1RtjZNlUk4VWgQaZsJiFod6Rxufvm6vsSXhak8CLOHnQwK5o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=AhRA2dXy; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="AhRA2dXy" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-539f53973fdso5510908e87.1 for ; Tue, 12 Nov 2024 07:02:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423771; x=1732028571; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MVwT7oZIOWnuzpL8iQZqG1FDeYB+P+/VcybAWauqrnM=; b=AhRA2dXyqKl+ZgFwuwhEMDTEA2oEkSn6wOe0H+c75YUEHg/9gUOf/6oxhk1SLpO8lM 3QKA4gGznqa0swjkosN0uVTVw86P8aL2GDaB4/lB/XnpQjtOiaJG16OsU73Lwdmyshh7 HBZpZQ8y/17mIb+qUnMW5uhbBfGok32vFr7IeheaPT5sR01Os1RCBqJ91N+90bbjDCKK at9dip94dp/VXT4rNqryU33nJzw/PAlmArvV7eaeyLPq4ITaWPp7N7ROx14ugS9io/Dr 6+R9Xa4qVPq7p62YP3MQ9E4oIs+oXzGZJN/jU4ekGt35a2by6/6owbkR5Qq7FXVLheJE 4iLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423771; x=1732028571; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MVwT7oZIOWnuzpL8iQZqG1FDeYB+P+/VcybAWauqrnM=; b=Ph0LKjDbVrINb3dzqDYvSgPIv/WFiopXhCKJNUu4IxMAI7RHikqFUltX5NlUN7gps2 mmsOq2yFDTZVfKk7xWZ8SU6fGMKjbWJnNXtAbRlvYOPJ+TA87YVKO9W/d/G5yK2Ql2q4 OMzllTxwjK0z4GCOCM8C5URgOL498DTiFxr/2OVGBiOPcsLcNhY6wi8rxo4/3d7MyVY/ h+hp5v3SdwhFUPTi1arcixGu4o5xQs3ClfcsmJnU5p/C2Q+Qu73w5naUtUXF0TUKrGk2 aijpnWYfMRzlPi1f/dc/thytrtSC1X8Tpq2sObvkK3jqH3xMUcP/6963Jd2zky6WX108 A7KA== X-Gm-Message-State: AOJu0YwonXnfEhHuplzyfjkvfuyth70tzxvmkPTaLdsHu4qKumIDOsRI KULxZTkUtu8ygctxk+7MH6T78A5LSS7sDASG2Q5r2NuKQDQUr4/C36SQwR2JNIvOjfgg81czKk1 y X-Google-Smtp-Source: AGHT+IH3dAXcG5uGXfD3NvSmfPI/8yzi+RTDOmQSd/1y+EVtBUpPRPtDZBH2gQeQAScDfMWhNxB6rg== X-Received: by 2002:a05:600c:138f:b0:428:b4a:7001 with SMTP id 5b1f17b1804b1-432b6872c8bmr140594675e9.15.1731423759211; Tue, 12 Nov 2024 07:02:39 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-432b05305a4sm214401845e9.5.2024.11.12.07.02.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:38 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 06/12] multipathd.service: restart multipathd on failure Date: Tue, 12 Nov 2024 16:02:09 +0100 Message-ID: <20241112150215.90182-7-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Benjamin Marzinski systemd will now restart multipathd on failure unless it has already been started 3 times in the last 30 seconds. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipathd/multipathd.service.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/multipathd/multipathd.service.in b/multipathd/multipathd.service.in index 646001e..b6a25b3 100644 --- a/multipathd/multipathd.service.in +++ b/multipathd/multipathd.service.in @@ -12,12 +12,15 @@ Conflicts=initrd-cleanup.service ConditionKernelCommandLine=!nompath ConditionKernelCommandLine=!multipath=off ConditionVirtualization=!container +StartLimitIntervalSec=30 +StartLimitBurst=3 [Service] Type=notify NotifyAccess=main ExecStart=@BINDIR@/multipathd -d -s ExecReload=@BINDIR@/multipathd reconfigure +Restart=on-failure TasksMax=infinity LimitRTPRIO=10 CPUWeight=1000 From patchwork Tue Nov 12 15:02:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872381 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5A7E2003A7 for ; Tue, 12 Nov 2024 15:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423768; cv=none; b=RmfJpZMc8Ic3n7P/Zpblnx5ASidU5fGohZcdlI2uOYNa7ftpr++467D1La1UGJHL21gzSVq22IdCb4WOO7/Qi5MI/zQoDVBZRCqsV63y3dXaMk4PY3XjAFrGV4tyeYKqjtV+Bxcgw75XL4juRjDgqyX+XoQHAfNAO4qBGMCFIQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423768; c=relaxed/simple; bh=utDlDlQhKqlS5l5THjX0MseDGzkyTLR9WCslEfr89ic=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rxx/x7OF8rmTXFYne2XVuqMS+tyTFY5uxMk83K1NXRmlFpv9x41NWzZMXghdltkuEKLjz/m6b+KGxmtRhXMJ1BssKcv4RquUEMVynBuf4JbMtSUtQZJE5ydEsY1Ir2D7VHB3CdyCxNAd0KkydKuq7nKIGDAWpPAc2uy+jNIzZbE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Bs6o9r/j; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Bs6o9r/j" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-37d473c4bb6so5371917f8f.3 for ; Tue, 12 Nov 2024 07:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423765; x=1732028565; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8EjBg45QqWf6gRdCDySJFRg4CsD2SUgeEDpFPqg1a4g=; b=Bs6o9r/j6C0ruoD5AycOkYuhfA+kjyXevZXa1erYncFTOeveGixvzOzLD9iLnSySNm xXfHT1/0hJoLR9dpDwWbwH4H2jRQKrjRkmPG0uTThLZgkklI8kICWV2HNP01qZs238mo Q1vy1Qe8njqdS8ATeberfYLkU6uP5io+/kl7QvPox9F3qPVkoym7JGMTL5qQvnAukEnF S7SiWQhNEEnYmZC/D4mlRwZhymCyV34D4qKQUKxoHRqSB0tcWf0tVZn15BjqOFG3VOK2 HNMsWPXAX1bfyin3eqi/Pi3nxxKKl/+6QrHDC6E0XgDyyMbhcxFW8iX4i6QNIWFEZrfY oruA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423765; x=1732028565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8EjBg45QqWf6gRdCDySJFRg4CsD2SUgeEDpFPqg1a4g=; b=DLu7WfhJWYD7i0MreCvnKkvgJKjYtgInxaJCbf6OHUbgfx0g//wmmsVPDE0iVQnYKP f8jZnUHT1LLzwUwwNDRhgr9GASWhkEhGjKYUNYt9KxWNr9t8C8TAcMSkrwocSg2pV8Yv eNQ0HB0KDw8pZ7kzWomEoGCRRQwN9lFOZOOy6/f2uHgVrLK5D/9/cE8OjCbEXNhqMZqM aw6b4szVs4hpJkTQ5KEWmGkXowiPS7zLrHUPwQmMtsT1fsmiOf92OwQLL94jzFd3OHju vGyto6sEHMPnAv7v9LwRiSvD/8I/rTJG3p9NkeEdOzzGYmaqx+ev0ZllAZqddg/L37w1 1YIQ== X-Gm-Message-State: AOJu0YytnY56eCb2FtW26SB4MFFegqpPOQUzng/ecYY79UIwKXwGOO66 KvEy6hwKYs/lFGTMrXfk1jMzkctO9TYo598XjAR9ZskE2ZzL8w0y6z6xdH+bUkY= X-Google-Smtp-Source: AGHT+IGdF2X64g63RU0Be5s3pss3YtADLEN8Ey+4pHcg0+rFSqMb5ruzbx6ojPwwqsNGNMbKDmsxVg== X-Received: by 2002:a05:6000:1564:b0:37d:4376:6e1d with SMTP id ffacd0b85a97d-381f1884855mr18108895f8f.41.1731423760600; Tue, 12 Nov 2024 07:02:40 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-381ed9ea587sm15866452f8f.78.2024.11.12.07.02.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:40 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 07/12] libmultipath: make MAPINFO_CHECK_UUID work with partitions Date: Tue, 12 Nov 2024 16:02:10 +0100 Message-ID: <20241112150215.90182-8-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The semantics of MAPINFO_CHECK_UUID, MAPINFO_MPATH_ONLY and MAPINFO_PART_ONLY are confusing. Fix that by supporting UUID check for partitions, too. Signed-off-by: Martin Wilck --- libmultipath/devmapper.c | 30 ++++++++++++++++-------------- libmultipath/devmapper.h | 8 +++++++- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index d193586..03dae16 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -616,6 +616,18 @@ static bool is_mpath_uuid(const char uuid[DM_UUID_LEN]) return !strncmp(uuid, UUID_PREFIX, UUID_PREFIX_LEN); } +static bool is_mpath_part_uuid(const char part_uuid[DM_UUID_LEN], + const char map_uuid[DM_UUID_LEN]) +{ + char c; + int np, nc; + + if (2 != sscanf(part_uuid, "part%d-%n" UUID_PREFIX "%c", &np, &nc, &c) + || np <= 0) + return false; + return map_uuid == NULL || !strcmp(part_uuid + nc, map_uuid); +} + bool has_dm_info(const struct multipath *mpp) { @@ -720,8 +732,10 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma && !(uuid = dm_task_get_uuid(dmt)))) return DMP_ERR; - if (flags & MAPINFO_CHECK_UUID && !is_mpath_uuid(uuid)) { - condlog(3, "%s: UUID mismatch: %s", fname__, uuid); + if (flags & MAPINFO_CHECK_UUID && + ((flags & MAPINFO_PART_ONLY && !is_mpath_part_uuid(uuid, NULL)) || + !is_mpath_uuid(uuid))) { + condlog(4, "%s: UUID mismatch: %s", fname__, uuid); return DMP_NO_MATCH; } @@ -846,18 +860,6 @@ int dm_get_wwid(const char *name, char *uuid, int uuid_len) return DMP_OK; } -static bool is_mpath_part_uuid(const char part_uuid[DM_UUID_LEN], - const char map_uuid[DM_UUID_LEN]) -{ - char c; - int np, nc; - - if (2 != sscanf(part_uuid, "part%d-%n" UUID_PREFIX "%c", &np, &nc, &c) - || np <= 0) - return false; - return !strcmp(part_uuid + nc, map_uuid); -} - int dm_is_mpath(const char *name) { int rc = libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_MPATH_ONLY | MAPINFO_CHECK_UUID, diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h index ba05e0a..6b3bbad 100644 --- a/libmultipath/devmapper.h +++ b/libmultipath/devmapper.h @@ -58,7 +58,13 @@ enum { /* Fail if target type is not "partition" (linear) */ MAPINFO_PART_ONLY = (1 << 9), MAPINFO_TGT_TYPE__ = (MAPINFO_MPATH_ONLY | MAPINFO_PART_ONLY), - /* Fail if the UUID doesn't match the multipath UUID format */ + /* + * Fail if the UUID doesn't match the expected UUID format + * If combined with MAPINFO_PART_ONLY, checks for partition UUID format + * ("part-mpath-xyz"). + * Otherwise (whether or not MAPINFO_MPATH_ONLY is set) checks for + * multipath UUID format ("mpath-xyz"). + */ MAPINFO_CHECK_UUID = (1 << 10), }; From patchwork Tue Nov 12 15:02:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872378 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44BF82003A7 for ; Tue, 12 Nov 2024 15:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423766; cv=none; b=BQ+RXOWfkCLMomTR/PhTiA1SPpTMfZM+42gaePxwZpUMCHswgkeOkqtanl7bqutVOPhCExVNDwbOoyZSBUGTLSLPkr5sgEZDa9jObJYwAeYCL/GOr3zoM7wseluZdbYt4Ce+HwYeCBmTuF6YqPzTTVenYciJVE4SA8VdmEwWYag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423766; c=relaxed/simple; bh=QN4djqOIaCXyVvLZx1U47B+oGKm4CeJafdG6QJXiRZU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uVy/rG3sS8db4+UNmUUQxI01DBaUcr56RSBg9QCvrjIh5zdETAlhvd+PiomeOkxd0EdvImEle/C+wHbJqIu3BUEmCm8yiWeMINhXLrdGpp1juGwZ7rmSlIc15bNXWjDKLPSzgwUrRdiPDsfZzk0AlkDKxBdmiSejVLmH70tZKIc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=AVNSAzT0; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="AVNSAzT0" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-431616c23b5so33666295e9.0 for ; Tue, 12 Nov 2024 07:02:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423763; x=1732028563; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WXW4YhCLxpagPir0hckrMBtdWXrJTQz9l1K9NrwAtek=; b=AVNSAzT0LWIaVdqtqBEH+wSbmueCaIveHR4mQY5U86BKfmTIUrkojzieaoZk2Z6UFK JeoCwIdY78ojPgR2iX/QGeazmHthZn8ecsK5feB+4LDYooToXa5/FhPaIb32L9W8Qquh Bcp4yyIJ4Bv5MCj4yQjZ1G3vYNmbE5VEAInRBld3Ry/hJkOeWUqgwiD4MTSrHPryEYTC esYwRB2s4jVgq+O28JJjuq/n6vGbXEYsDGUUmNpJlEyouN2n3zKyf8mCUbwYg+/KQVdS PjtJpztSVyR96URpn42wR4VDpbsLcQqXxTJyG1kygvHgB3Kbw8m39+ksgFMkByMA1rTS 8WIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423763; x=1732028563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WXW4YhCLxpagPir0hckrMBtdWXrJTQz9l1K9NrwAtek=; b=xSiH5K1irYgfDc+oevPZPV2OTzaQXbp5z/8GvGHSOwmMbh5XJrcObmNhSSZCjADL2D CiRsSlhI+r691e/PUjbRR5zML8JibG/xF+k+LSW3EEfe5L2907qFCCjCsd6OY99PsjcL HFOHo4DlAVircPoF+ApQ3g1+DQBduisNBOblsNjL4iIYBE+v83m9CxW3pjbE+AfHps8h swyJLj/nDe5Cjq6+QOBG4tt/c37E8iUfZNzpM5yWifYfgWp//WbCxdCLd1K46FD5D1fr zaYeBCyMYXgFh+kVkM2iVag/HRzAXPvrtpacAtnbAbd5DVQHZLL8X3OtFFQF2yAxvDDJ nthQ== X-Gm-Message-State: AOJu0YyOtjPHWvEZ5cPLh/P6aTtJ6JP3ZpS9Llq82etMtjEoKQssuYf4 6rw/afbJ53a1vgJiZr6oKV/6y9bPozonZgap1eBk5JzIcML4h0wpaF1QXQo7vT4= X-Google-Smtp-Source: AGHT+IGrtbxMBv7lMGbgvoQHbhzvsgnjmyK7S2/eHKM6JchfbH67I9/zyN/MiAxoTAkhuY8mNg8uzw== X-Received: by 2002:a05:600c:3ba9:b0:431:47e7:9f45 with SMTP id 5b1f17b1804b1-432b686ec45mr153159255e9.11.1731423761934; Tue, 12 Nov 2024 07:02:41 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-381ed97fe6csm15495908f8f.31.2024.11.12.07.02.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:41 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 08/12] libmultipath: check map UUID in do_foreach_partmaps Date: Tue, 12 Nov 2024 16:02:11 +0100 Message-ID: <20241112150215.90182-9-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Don't try to remove any non-standard partition mappings. Signed-off-by: Martin Wilck --- libmultipath/devmapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 03dae16..3ab231e 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1349,7 +1349,7 @@ do_foreach_partmaps (const char *mapname, /* * if there is only a single "linear" target */ - libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_PART_ONLY, + libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_PART_ONLY | MAPINFO_CHECK_UUID, (mapid_t) { .str = names->name }, (mapinfo_t) { .uuid = part_uuid, From patchwork Tue Nov 12 15:02:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872379 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8910E2038D6 for ; Tue, 12 Nov 2024 15:02:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423767; cv=none; b=trtNPbEB7Mjn4J6gmvZfPJ0fMBrtjbCCHZ2JBfx+KDnIflAzZkN+R3J2g1dlW5J8BSpZQ9dY31iD2idoAa72VHhL0CJxtJ0zyB8caVYpKQLwCcbxuVAro5VwXauRfqG71M8TWkxv0CW3cLzeqXtViR9dGFDncdgWLqvucRnY4zc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423767; c=relaxed/simple; bh=IPkwcRkbWsK5ZzvesuHuopJZJirvCzm1LcApdqjpPxA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eocuExdzaLqA8CNKdxtbqyjiSiM2hxXooVzQWDv5A+wngttgyWjnSZXm1lW/QvYAdc0KSRG3Be82/bLougfWheTWp3OGZAPf2ADlJeKB+gKOyRPJjqedsIVfDgPTkrp7idtCl+F/JxSCeTilXHsj5IfbgzqDYqtl4tBWcK+XOBs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=OdoyQicc; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="OdoyQicc" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so50999975e9.1 for ; Tue, 12 Nov 2024 07:02:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423764; x=1732028564; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tgrRLTBS1xpLyE81YX4fHW3TadW+RZKWohG3rYC8HP8=; b=OdoyQicc+PFMne/IKAIexpSCKrdlncxM5RuaSDyb6xQiiboqsfycvIIXAeKNgEJxyq 127ODDO5fqECVF0cWYbSbI2peHXSPw74M68gQA6I3RvTDuydQ30w3G7VuEdBy13GwgrV nV1TjEzVlfD3mifsu+S6dEffgdLQREbAaeTR1ziL6XU3tfmeO1KNu1UCwXX4Ky2mms3i BZDOl1Iv5g3Z9xf+zKOxgJz/SSiWFur2+XTPJmKZp/LFx3qEax0ABAJpW6+ioTya6toc tZf7naGr1NoF/axHFiaWz9mBKfQ40HB+zVxpu2tGRidzrQD6+j3TYVj60sbnYmckgiYI q6kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423764; x=1732028564; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tgrRLTBS1xpLyE81YX4fHW3TadW+RZKWohG3rYC8HP8=; b=Mgyifi12G+Vf9VYUnoyZeWinOUbOGH/S3IJNCh0tfdvxFfB07lNUtqHsBP/qmMn8IX COi0ZWq0UHm7mbSQcliMduDfv4yeLu1qpgjUuihRUGp3LJtlNuwgfkKfTlrAkLiCgSED NNA7ZXCQ11JrjVIyq8fnG5dqoeQ5pQHOUf80IYeVXS6vTADKz5JXqkVdzCd3AapMe+99 q+SKSp/iIcy26cJhPqdf65cY1bkvU87S+1owN4FTR93C6VB0EiNwCPoxkw0W5vCZH9lS blmCYAEA74ZEuRc6I/lp1YlBi2BIn3YduvdGaE/R9aNSXF9kcpqCJKSodEGgsXK7b+eQ K0hg== X-Gm-Message-State: AOJu0Ywd0H+II/lRowMyXMDXbOklMSCn/venWmQfTtSTgNE99xcSPG6o tFPjL7Ti5339MfUNbVU/FfG+ps2wM1sZ4eyoH9lzr1dmLGCy1jeJpeMzSEBghXY= X-Google-Smtp-Source: AGHT+IEbJ39qsfoZQvGuv923+k2QsUqgAoBCmMXXYeHXqY8pz4cQtztOsjjt7B4j89K/sshZqpdn2A== X-Received: by 2002:a05:600c:3b22:b0:431:52da:9d67 with SMTP id 5b1f17b1804b1-432b74fdaf9mr148638845e9.3.1731423762941; Tue, 12 Nov 2024 07:02:42 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-432b0530599sm217756505e9.1.2024.11.12.07.02.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:42 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 09/12] libmultipath: increase log level for removing partitions Date: Tue, 12 Nov 2024 16:02:12 +0100 Message-ID: <20241112150215.90182-10-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Removing a partition map is an important action that should be logged at verbosity level 3. Signed-off-by: Martin Wilck --- libmultipath/devmapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 3ab231e..3502d05 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1392,7 +1392,7 @@ remove_partmap(const char *name, void *data) condlog(2, "%s: map in use", name); return DM_FLUSH_BUSY; } - condlog(4, "partition map %s removed", name); + condlog(3, "partition map %s removed", name); dm_device_remove(name, rd->flags); return DM_FLUSH_OK; } From patchwork Tue Nov 12 15:02:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872380 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE45D20400C for ; Tue, 12 Nov 2024 15:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423768; cv=none; b=JwhLxEBFPLj6YEZRvU9ahxKCDjGyvQY1XRtPcRkZcYG9SgFtOF7UY0isjPrhMgS5GssJyNe2cokMcARRBWak9iUEt0G03x1LlGybUolCymCiH/skRMSuZ2US4wspiFjt1+3mSlmWmHhfzBb7ejefZwe6Cj+3Stw2Txe5iJxADJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423768; c=relaxed/simple; bh=jZhlXLIIjczeO5uVuUYNXru1X5KD+14Qs+eRtR+CxQw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fMdPsbnPBoNxJq3ODx0zSIkvoYyJ63I5gp4UfHTLI5SQpRdHe3liLwe43gzL7gGNzjHz3obzSs/ixspiX3oTPSoQKOaMohOb+4/OsW+a+0xT3m7mVdJjUGCTrlfj1BfUD55ia7LMysHVJcCAKtPInMzM4leWrlQOoJOE23p5B9s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Ixj7bVN1; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Ixj7bVN1" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3807dd08cfcso5444332f8f.1 for ; Tue, 12 Nov 2024 07:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423765; x=1732028565; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Khh8gG0tDxXfH/QuoNQfGXj6+n9tzzRy2t/P4Kgr4GQ=; b=Ixj7bVN1cVeQvQ0qvWiYEZV5bJ4FjGGYKjFSPr/I1ufQE2Wvgtgwmm4qevX4o5yJDk IIaHnPJHSNDp71U9P38qAw8gb6YYzdjvtsCa6a9GXuKRY+X7qzkJamU3TC0r6+BQ5Ilp vHn/OzuFr+CggZ7nMPscVRhT+MCgdJPwh6r7tqO/mirpHqjLaiHD9ABR45hLNo7AmXm9 GbGFtFu+GNNYlCAz1nnZLQlTfJdmhaLIXAY9g1jq4U5nlpFeN0GLbcY0jjjUCzRq9nas +1NQEhJbnxclwEatwy8x4lB1UjkPeIy1PdpPiFx/L/Nrym/Rd1GPR3CqUFQa1p7uFvtN VY6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423765; x=1732028565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Khh8gG0tDxXfH/QuoNQfGXj6+n9tzzRy2t/P4Kgr4GQ=; b=E22mTMBLfoJ5vHYiyutLbc0vNvMWK71Drf61JlTWh5kJPy3yOnLy51rXQ1xWr2ym4a 1HMuNdXf8f4nwz72ZxN4IddDEUNkl8NGle+Ye79BEvyjwl9Zz1JkatD31SRNiaGx7WeI Y4LXB363t/Y428rQ67QB7pvhVchgkfUuaOwf44nGfTb7+UhD9kLtCdZnSkjnsO04D57J mB7dpNpZaXzmUXtiSI61yIJzUKvAwq3Y4ukvAh9nQB6uqAJKLFyhTFOo3ghgoCc5B4jX uCnTKkFjX5WqsbR1/oOS/12y9UJv0I1flFJ/kn3lzYEYKQ8Dp5ICql2qi8QndFO+eVO2 xvgA== X-Gm-Message-State: AOJu0YxPz6lkcr/5lDmuAnLsKKJAn18/NyL/c97Npcvc/wz8qiutxo/9 mIZIH/dMKPaUQsxKkhsTj+Yx9XiIbCKClJQt9hGxSnXoKAM9l2sSWUHMFCnXtao= X-Google-Smtp-Source: AGHT+IHy+LCoJ49rQ69m+UER3C57ek3qjvrL3o6LP01/QlesbnsG6r1jgUetAsGOx5YkxqKO6vFgTw== X-Received: by 2002:a05:6000:460f:b0:37d:542a:7995 with SMTP id ffacd0b85a97d-381f1872cc6mr17302472f8f.34.1731423764388; Tue, 12 Nov 2024 07:02:44 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-381ed97cfefsm15511262f8f.26.2024.11.12.07.02.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:44 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 10/12] libmultipath: reduce log level of libmp_mapinfo() messages Date: Tue, 12 Nov 2024 16:02:13 +0100 Message-ID: <20241112150215.90182-11-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Unless MAPINFO_CHECK_UUID was set and we know that we are looking at a map with a multipath UUID, encountering non-multipath maps is not an error. Don't log this at verbosity level 2. Signed-off-by: Martin Wilck --- libmultipath/devmapper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 3502d05..9714270 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -740,20 +740,22 @@ static int libmp_mapinfo__(int flags, mapid_t id, mapinfo_t info, const char *ma } if (info.target || info.status || info.size || flags & MAPINFO_TGT_TYPE__) { + int lvl = MAPINFO_CHECK_UUID ? 2 : 4; + if (dm_get_next_target(dmt, NULL, &start, &length, &target_type, ¶ms) != NULL) { - condlog(2, "%s: map %s has multiple targets", fname__, map_id); + condlog(lvl, "%s: map %s has multiple targets", fname__, map_id); return DMP_NO_MATCH; } if (!params) { - condlog(2, "%s: map %s has no targets", fname__, map_id); + condlog(lvl, "%s: map %s has no targets", fname__, map_id); return DMP_NOT_FOUND; } if (flags & MAPINFO_TGT_TYPE__) { const char *tgt_type = flags & MAPINFO_MPATH_ONLY ? TGT_MPATH : TGT_PART; if (strcmp(target_type, tgt_type)) { - condlog(3, "%s: target type mismatch: \"%s\" != \"%s\"", + condlog(lvl, "%s: target type mismatch: \"%s\" != \"%s\"", fname__, tgt_type, target_type); return DMP_NO_MATCH; } From patchwork Tue Nov 12 15:02:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872383 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F2B220403B for ; Tue, 12 Nov 2024 15:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423771; cv=none; b=dRFTvNd1ApwLFZRdiX5YXQjBkrNkKtjStG5b6tqJZOo5leZBMyjha6pChF0bbICBoa50oF5cBgHyLUF7CpNOJHDfXAy+suReraP1SFuJRWK2TNq/EI8tBeLrRyrVBPV6fftGEtqj4xgMbPHPngQIXha7u9tNLrne8FaJeeh1W2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423771; c=relaxed/simple; bh=pUBw9dJdIcOMGAyKnfBAIFglZUQ7IfyIo4FYXvu9d14=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZRshA0MxW4thFfr7p+4yhXezYAenrAdkTmJRHiaNVOq87b/ZKs6LZUY+0e504+tMAcPV3LF6AOu6/E+fVFVvBX7FHwP5KSZxHlJU5n+0M++LtLBS2iV0s9CZIxiXXuHem65XLB7I7TKdPZagVYIiBtCflhHI6lVYrurgLKkqNOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Oux4IFnK; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Oux4IFnK" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so51210755e9.1 for ; Tue, 12 Nov 2024 07:02:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423768; x=1732028568; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YjNB+oiHmZFHR0jfD4d+nOio5EngsbpfyK41dRdJzmU=; b=Oux4IFnKlzErb7RDccBVJ4fVXZsM3xDfoWySP6Yd+80vFaBkiZj5AIG+bvR9eIXbYi n8LD5XNli+LfCCzQl/rNXbhJsrPCCZNGo/PKZzBdvyOjiVRrq2AsCVY9MiveZCkArYRb Es9fC9Jynu9Gtm8w3WZQhHJ75tiTnt+aplDQPPNSgFqWoyADAI22xxNL0L9z1ov2y5fz sPJMtkN9oF86pDMidGkyjq0ucLWefSt1n1W3T1wzH5wIWqSMkTZZc3rMJTgqPt2KHofF M/f/WwqGscBZLMBvzzvMC0khhdTeT+W96SNhgGA9n67pc7kUXwKemC3QyBLvy2TUZjEI m4sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423768; x=1732028568; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YjNB+oiHmZFHR0jfD4d+nOio5EngsbpfyK41dRdJzmU=; b=DDY6uC6pwbG8RsF5p72ZXuBZ8NHa0uT1AIM3uV9tIvEwuhLhWfzdMT8Ay835tgHBpW T8Tzoa/R6cF92cs5dBvKwiW5KeCx+Q1cUxDAcJZkuAtN5+WM20rPPe3WSGvSFPuoJNff KKP7u3osZHWdIr4cfoD862k9/NGFpGJDBrjzsvx+hQ07vx/dM9c0fqg+Sggs4ijAaHza dPJ8vbpG60/QkqInPBVIyaGC1RZGD9oSF5A6srHhPeVwTy3RJxzqfL5KD7Gr+DDUZIel RymlDt6xbpZG6OEtuUIWEahqzP0eQf0nz/8B8ZakwrNrFX8sxC4Mk054vLq0943oRzV+ QAlQ== X-Gm-Message-State: AOJu0YxeVOzhOAJlND6k8RuTCaE4VR7mU/VSTkMlfZDTz0GKKOxBz7Eh 90pg0cN4ftqjsXkj8Nk1NMG5ceaKpYyYd6/S+pnXJ77xjE9Jizh28uHuslK7n3s= X-Google-Smtp-Source: AGHT+IGYS7eW7ZGOvqLISSVAqN5wvsNEQZd5jxzPL6zRxKFbfR+Y2ROYFY6+HSpjJj9vP9ai0oLnOg== X-Received: by 2002:a05:600c:3b05:b0:431:537d:b3b4 with SMTP id 5b1f17b1804b1-432b7503540mr135966215e9.11.1731423765685; Tue, 12 Nov 2024 07:02:45 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-432b053069fsm216752965e9.4.2024.11.12.07.02.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:45 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 11/12] libmultipath: don't log boring state messages at level 3 Date: Tue, 12 Nov 2024 16:02:14 +0100 Message-ID: <20241112150215.90182-12-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Even at verbosity level 3, it isn't interesting and actually disturbing to see every successful state and pending state logged by multipathd. Suppress these messages at level 3. Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 11 ++++++++--- libmultipath/structs.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 1d48c30..ae9fc8f 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -2018,15 +2018,20 @@ int get_state (struct path * pp) { struct checker * c = &pp->checker; - int state; + int state, lvl; state = checker_get_state(c); - condlog(3, "%s: %s state = %s", pp->dev, + + lvl = state == pp->oldstate || state == PATH_PENDING ? 4 : 3; + condlog(lvl, "%s: %s state = %s", pp->dev, checker_name(c), checker_state_name(state)); if (state != PATH_UP && state != PATH_GHOST && strlen(checker_message(c))) - condlog(3, "%s: %s checker%s", + condlog(lvl, "%s: %s checker%s", pp->dev, checker_name(c), checker_message(c)); + if (state != PATH_PENDING) + pp->oldstate = state; + return state; } diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 1f531d3..4821f19 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -375,6 +375,7 @@ struct path { int state; int dmstate; int chkrstate; + int oldstate; int failcount; int priority; int pgindex; From patchwork Tue Nov 12 15:02:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13872382 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7045204030 for ; Tue, 12 Nov 2024 15:02:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423770; cv=none; b=DlZxGOHyovkr+lSektkGn+RHYQiTDJCRkuvRekpt7UyjzoacUfimXBZ7I3xt5/b6NfvD47gtmAreMczBWpW9Ed+n58efgVj5sMnUqBX41l2YGwHCTRHj5749GhHDIw6YX6r9f4ew1qiFTNSGJFHWwZMydnu/n+Fox+J27xd7vn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731423770; c=relaxed/simple; bh=HyNqK1r6QUWdru52yD1z8iwS87iS+jsVTF5BEcc+Wjg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XHqL5/N6zNVa52eR9ThzAgdP12491MLM4IKPYEf5vqrNskRFztRibd6TA74nWglNaIeKOro4T7SSG68XtjfLrSXy0Q3sP+J122Qj3tG7Y0b5UqoSjXhVTjl9VjXYzU/zby/jGF6M45+mdER54OSMeYTPuzyz+sVTE/5AP0wUpS8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=SB0hTOyG; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="SB0hTOyG" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-382026ba43eso1325170f8f.1 for ; Tue, 12 Nov 2024 07:02:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731423767; x=1732028567; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5k3rxKGwcmdGypHCFp3inEq13eBuYaI5+UQ70ZS7A14=; b=SB0hTOyGb4mrffFZQ1FCzOXuSOo2sj+yuVAx0aDGr8AT36a9SYfsSY11Bvx2eLuZAA XSptAEJlirfYdfKijuYsfotf82spAP+JCJuM3HT3vntdRc0iL0+PLpCX8WUlwW1rR31T hShFNngU2Pg1wBwzldZ7R9gxRCbrmnS6A1RUU/ov8UJaLEXCw5PPjLkzL0pMq7qOch4b e+z+BcO85ZYgM0TsCrzV+aT4N6On3sm02+goCw1uW11f+8sZM9BUYLKgg/qMODWjD2qE u9PkZLWCIj/Xw7j9P81sXXqjTsa7sAqGrOpd3LHRl6XZZsx9jMjP9t5KSMfHOMYCqhd0 029Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731423767; x=1732028567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5k3rxKGwcmdGypHCFp3inEq13eBuYaI5+UQ70ZS7A14=; b=j5RHNC01abodFeClMdUsGWPvvswW9y2t4KWxMeDXH/186dHiYOTgYvgRN9W0hGcsI9 Em8x+yov+7UTpPMqj4GMrnys7qfFllIDDgR9dvpL8sciZgepLypFls7RvDQs/4tm0rIn fQQnC4L/UOOEYFmbQUCDO4C4jYsGQREQh0WEwgLIWhakQNiJbZV+5cRykZu6MwMhiLX6 V6n5h1QhlXInnDaHY/J2nqt5JcDgkIK99Db6hpqqYlDAZnbfLjVWcdar/c12V/4Ry4NH yXxE6+rnTfkABmy0+oYjIzL1T/bpNpj7xO9h8E68EFxLOZlSdlVum0fZQEkopcdOH1OS 111A== X-Gm-Message-State: AOJu0Ywl9dYpuOuUW5A3D+zcauSwnHHDiy2QDdd2syrAEoq+LEdSuBJr LwKK2zaYuFz3VHLlmayt2IC9cmHwTxsVhEZCMFFuBdyxHaDd/OZp8e2bmHGh30Q= X-Google-Smtp-Source: AGHT+IF9BIWWTn+4RQzH39BkAyN3o+WMd+ROQeR7H685a/qd8MOaZeemHsfPb5ZL72NAClflx5Blkg== X-Received: by 2002:a5d:5f95:0:b0:37c:cc4b:d1ea with SMTP id ffacd0b85a97d-3820834a0d2mr2285218f8f.53.1731423766788; Tue, 12 Nov 2024 07:02:46 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-381ed97075fsm15425447f8f.14.2024.11.12.07.02.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Nov 2024 07:02:46 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 12/12] libmultipath: don't set dev_loss_tmo to 0 for NO_PATH_RETRY_FAIL Date: Tue, 12 Nov 2024 16:02:15 +0100 Message-ID: <20241112150215.90182-13-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112150215.90182-1-mwilck@suse.com> References: <20241112150215.90182-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If pp->dev_loss is DEV_LOSS_TMO_UNSET and min_dev_loss is 0 (which is the case if no_path_retry is NO_PATH_RETRY_FAIL or NO_PATH_RETRY_UNDEF), we will set pp->dev_loss to 0, which is wrong. Fix it. Fixes: 058b5f5 ("libmultipath: fix dev_loss_tmo even if not set in configuration") Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index ae9fc8f..b585156 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -942,7 +942,7 @@ sysfs_set_scsi_tmo (struct config *conf, struct multipath *mpp) continue; } - if (pp->dev_loss == DEV_LOSS_TMO_UNSET) + if (pp->dev_loss == DEV_LOSS_TMO_UNSET && min_dev_loss != 0) pp->dev_loss = min_dev_loss; else if (pp->dev_loss < min_dev_loss) { pp->dev_loss = min_dev_loss;