From patchwork Mon Nov 25 14:32:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13885034 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 AC33B18F2DB for ; Mon, 25 Nov 2024 14:32:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732545160; cv=none; b=nedLliGJRmKkpstQEUnENo7eksebM95k64JzSRe2IhgdRQt/KEKpVi3m65Mwd27/BoGQ3GsoOV4OdmJNa09oBgmuKO7XKhhziklatNXv4muvWC+qrGAhCiIKyN/6CQpdcRTQdZQRTTJPiCCeKjNUzOdBuGQeSocn4eiczR46mzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732545160; c=relaxed/simple; bh=CuACxtTcfHIQP+6vMPYr4FxMUK2BBukZaS0UQjJn4gM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HnA/fRWhRkTIjWb1sMY59YCk/Fq36TvukyFIwgDYiSsDhNIGXv5u6zOnRfvdtfAHe9wT74Rz4fmV8M8u50EjxixGVK2ZuvgK3VudJeuLZ5MG4supSdhS5CpxTYBBHVQFowAJbtmFykWyGpn6cSu6wJ3nZzFKZX0glAaqlSC/Izs= 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=b1hLog3J; arc=none smtp.client-ip=209.85.218.52 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="b1hLog3J" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-aa51b8c5f4dso397612066b.2 for ; Mon, 25 Nov 2024 06:32:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732545157; x=1733149957; 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=tYm3Cau7rRrbqxoOYXZrlPRfPTCGqsWUPnVMetDEeZs=; b=b1hLog3Jt7j3fJYCfukvF2TvuZC6qDnEvDMJoq6VIhPdx9WYivgtFGRtaRAnFtrHi9 st/lWWPI33E1EEWJaI0Y5VyrEy74xukQVDGNBpN3M83BLprjhZhXrlPLYEmcEx7SFHFO dM1bJU+pe3ygLDvhL3tYpZNyzIF9rn/FjawsTJu+77zoboV4f7iY86ORqQIsT8stifRc aVhM5hi0aNCpIkr81alkNGj+e0LjCYTrGtZ9ZBbO2rjjtRPow5fyRQ2ntjRBCOE3ZhIq 4M1khxEOJnXpxpLOAaGRx90frNPKceL7ETDKkQSsRMQU+DUiGmj/wkRsekDBABjE6MoN JwFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732545157; x=1733149957; 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=tYm3Cau7rRrbqxoOYXZrlPRfPTCGqsWUPnVMetDEeZs=; b=IS2ZpMoQC69LXMHZY1X+8mRQiVRO/2XD7Ard667CzSj4zumnsikxNazyWToxOyIck2 VW+Taru69r9sI3jBrCxzxvzRqc5RenQb6bhuHDlMg7o9BHt53HKfNbumpFBQeuteu3iU zrjHhWMUOt+DgatL1c7kRKFYjhM5GXEqnrnJK3YSAPwu8QE33VKFkB+iimJzZvnjx+E6 1vmyTmrpvmfgnWYuWv+bvFZGnKVTFf2MQPqfRv4YKU3hoVgbt2EF3110qA7tUhrBWh4E kAD5OoHh36HH0hfXXf2jgib2GM0ZrcXA4s+oHqdnsEKJTYdVsamAxNIcN39KJVUuaUaB FfUg== X-Gm-Message-State: AOJu0YxdkUGxW1k6Pz8EUJGpjNt9nafMvx3w9qmwG6I29KAYDwiBYlwe fkPi24fKpOd66cej5WB4e9C6RQOcQmLC4BhYwlUjlZJcow08rlI+Ms2a7g5jf2I= X-Gm-Gg: ASbGnculRIHjE32uiyZ/4pjVQrOVJBh0jWENY6qD1WXPppMiVMb3Tawgj2VhbSLuYq0 p7Fwt0EDk/InXTLVlAIlgsBjgsKYrgdKMzaHnCQ7f1axbzErt7qdUmj3b9FS6v4BAZj/GAdX5T9 9UHg1F6tUSd3EMCKrQZlyQ/lyMifs9spRZp0buWExw7DakoNgTjSNWE141wKljB39NtPoXszznn odjKdSWec2AHWge1uzfWBZnwfCX4LWdq8FgLPynJ0HcUbB7ru22XVxkImCCx6Yx0CgCc908bilD Hj48BsxrrsK5kxNexhjsqCJkrDHunIw8UozG X-Google-Smtp-Source: AGHT+IFJjr8T7qJ6Zc8R05XBgnLluvMfOA3rxjhqBacV2cCprk2s0Nk6KXxjLUDp9wzi7HSqi1YkVw== X-Received: by 2002:a17:906:2182:b0:aa5:3853:5536 with SMTP id a640c23a62f3a-aa5385357camr644386266b.46.1732545156687; Mon, 25 Nov 2024 06:32: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 a640c23a62f3a-aa50b28f719sm468542666b.12.2024.11.25.06.32.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Nov 2024 06:32:36 -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 1/3] libmultipath: fix handling of pp->pgindex Date: Mon, 25 Nov 2024 15:32:22 +0100 Message-ID: <20241125143224.51934-2-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241125143224.51934-1-mwilck@suse.com> References: <20241125143224.51934-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 pp->pgindex is set in disassemble_map() when a map is parsed. There are various possiblities for this index to become invalid. pp->pgindex is only used in enable_group() and followover_should_fallback(), and both callers take no action if it is 0, which is the right thing to do if we don't know the path's pathgroup. Make sure pp->pgindex is reset to 0 in various places: - when it's orphaned, - before (re)grouping paths, - when we detect a bad mpp assignment in update_pathvec_from_dm(). The hunk in group_paths is mostly redundant with the hunk in free_pgvec(), but because we're looping over pg->paths in the former and over pg->pgp in the latter, I think it's better too play safe. Fixes: 99db1bd ("[multipathd] re-enable disabled PG when at least one path is up") Signed-off-by: Martin Wilck --- libmultipath/pgpolicies.c | 6 ++++++ libmultipath/structs.c | 12 +++++++++++- libmultipath/structs_vec.c | 8 ++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/libmultipath/pgpolicies.c b/libmultipath/pgpolicies.c index edc3c61..23ef2bd 100644 --- a/libmultipath/pgpolicies.c +++ b/libmultipath/pgpolicies.c @@ -127,6 +127,8 @@ fail: int group_paths(struct multipath *mp, int marginal_pathgroups) { vector normal, marginal; + struct path *pp; + int i; if (!mp->pg) mp->pg = vector_alloc(); @@ -138,6 +140,10 @@ int group_paths(struct multipath *mp, int marginal_pathgroups) if (!mp->pgpolicyfn) goto fail; + /* Reset pgindex, we're going to invalidate it */ + vector_foreach_slot(mp->paths, pp, i) + pp->pgindex = 0; + if (!marginal_pathgroups || split_marginal_paths(mp->paths, &normal, &marginal) != 0) { if (mp->pgpolicyfn(mp, mp->paths) != 0) diff --git a/libmultipath/structs.c b/libmultipath/structs.c index 61c8f32..4851725 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -239,8 +239,18 @@ free_pgvec (vector pgvec, enum free_path_mode free_paths) if (!pgvec) return; - vector_foreach_slot(pgvec, pgp, i) + vector_foreach_slot(pgvec, pgp, i) { + + /* paths are going to be re-grouped, reset pgindex */ + if (free_paths != FREE_PATHS) { + struct path *pp; + int j; + + vector_foreach_slot(pgp->paths, pp, j) + pp->pgindex = 0; + } free_pathgroup(pgp, free_paths); + } vector_free(pgvec); } diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index d22056c..64c5ad5 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -139,6 +139,13 @@ static bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, must_reload = true; dm_fail_path(mpp->alias, pp->dev_t); vector_del_slot(pgp->paths, j--); + /* + * pp->pgindex has been set in disassemble_map(), + * which has probably been called just before for + * mpp. So he pgindex relates to mpp and may be + * wrong for pp->mpp. Invalidate it. + */ + pp->pgindex = 0; continue; } pp->mpp = mpp; @@ -354,6 +361,7 @@ void orphan_path(struct path *pp, const char *reason) { condlog(3, "%s: orphan path, %s", pp->dev, reason); pp->mpp = NULL; + pp->pgindex = 0; uninitialize_path(pp); } From patchwork Mon Nov 25 14:32:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13885035 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.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 020651ADFF7 for ; Mon, 25 Nov 2024 14:32:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732545161; cv=none; b=FnFSCpfz+9Tb+SyODml8hGMpE982rqN/jfIPJkfuVBvNYhcVIa7TtoEqzxTwUna0O0mGxz05v6rfoMV6tLG177BuBC3m1MrNqQdiBpp2nN+qqjsRZHbu07RdCu8kCBSiERiP8TdkH72s21sYylrEHQnOnxczQ02NKi/RnZK7/yw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732545161; c=relaxed/simple; bh=DAgqZwztbKCIJUmO0+4RGw0DiDD9dQrsMi4rYlDdqOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XO9IFlMkNRO7gDn+m0CA0tlR/OmOfcFrsBUVyYPnJmJKgO1nk2pj88iOG3vBCzB8GsVJfDUKPe5CfDGItefSP3sWCGYMvs7gVlq6WManah39bN1b/FE4+gK/vHKosexbdHu+ucSOOJ2zEA1/5LDwy9w72oph3YQK4qMCduW2HGM= 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=KO7wLMh2; arc=none smtp.client-ip=209.85.208.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="KO7wLMh2" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-5ceb03aadb1so6180657a12.0 for ; Mon, 25 Nov 2024 06:32:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732545158; x=1733149958; 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=M0qx70Y/+Ua8CN+cqC1lWtwHCs3avhbEeh3ep0x0uZA=; b=KO7wLMh2g+LidE04ymTMVkm6U7jhjP+Bi2N7KvZdUrYekcbUMSrx89RHx3PoPxulR9 dS+RebGnSS3hAFpyTaJfXfEFqC5uifYvisMY4vwt5gRAHe+9ks8d33NjfP+0W0QlAOp+ sAEaBqCjwiDogBT8afV6uw9LTRLBiT72phWBo0pjMB03W00F2GKsmZorbhwmX5NWzmBO fM2RmfKMwhLjhz4FuQC2rcwGYd9X4FKdBoWxFTaypcbJ1r/OAjOfAxwqNnbaLbdqVM73 98ujDT5eszvElvCWICuUJyr550WEcWKm5hkiei+NjY/6fN6qvX0DKaLOVjwRz9YG9IHc fKhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732545158; x=1733149958; 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=M0qx70Y/+Ua8CN+cqC1lWtwHCs3avhbEeh3ep0x0uZA=; b=rt2ZhMnBxboBpG3sQEgiIs5LF7b/bvaTngDLBZ1tXdInB+2VFdWCpDR0XI2V15oEOG zmresER45RUfGyHGyBoppmTr0TnC/cGStQAs//sE9+T3oTVpkT/v9x2QMHR79YNZ913e Y9xVBZhhMqlAdv6/CM5ht9mGQwfF7fsOMU6cdoGXbs2ObMtxGMBXdvyVSuGE6/uisreZ VzKbeDIUqkuZQrK7aXu3BEjULRVi4cNwZCnjbsKz7RITzTTMzyWN4hqXbSowlruPSnrH v+S/p8Fhcjqce+Xm5roUbiqrKy07uk+pK7QFS8cL0DIE82BPwx3qSy8HQwF61bEvR7SH qXWg== X-Gm-Message-State: AOJu0YxRQQiEy3Dfo5kDpYGOA6R/4l4yqTjCfC/s4D9gEb+GqY29O/bi OhbErkdw0fK1WO2rGwDGjLCaYpxxVEq944qMXNScrmjXVj3bW33IiNpRIhGmHk4= X-Gm-Gg: ASbGncsBOlFB+iJmxNQs3P9il9xaKWl5aRh210Cj7ZYMB3RiHWANnpjZk7bqpCM78/M Cm55NHUMflqBThje73YWmDFk4PyJNHw8w8NH1FOCEpt/9bfY1XYW5Y+PDaRv251chJ6QNDkq9Tc ZqMqJLA8gQEbi3fVSfGm8hlHcpawVsNZ5sWM6cnSKzmSW+pw7PpGFhOnXfJWphfcUFUCGbCvr87 vgzgI/gUrk+agThs1G6vzrgLyX79dMTR0VbCMKZ1TeumfbAbtm5118bTIBTYnowZn9GWQt0G50J bOVs+NBtDyx+5vOSKmxCfjJaYG0oYZI2abs2 X-Google-Smtp-Source: AGHT+IE3pyFjCcEh0j9B/7zq7F4fJTsaAy+nun62bQIf66gBWvIT+e93ra3npaDgfrYjdBnlQllVWg== X-Received: by 2002:a05:6402:5113:b0:5cf:9cd1:1f77 with SMTP id 4fb4d7f45d1cf-5d0205f42f8mr11227551a12.8.1732545157835; Mon, 25 Nov 2024 06:32: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 4fb4d7f45d1cf-5d028f28ccbsm3656120a12.1.2024.11.25.06.32.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Nov 2024 06:32: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 2/3] libmultipath: pgcmp(): compare number of paths Date: Mon, 25 Nov 2024 15:32:23 +0100 Message-ID: <20241125143224.51934-3-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241125143224.51934-1-mwilck@suse.com> References: <20241125143224.51934-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 pathcmp() makes sure that all paths in pgp have a match in cpgp, but not vice-versa. Check the number of paths, too. Fixes: 90773ba ("libmultipath: resolve hash collisions in pgcmp()") Signed-off-by: Martin Wilck --- libmultipath/configure.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index d0e9c95..55140d0 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -442,6 +442,7 @@ pgcmp (struct multipath * mpp, struct multipath * cmpp) vector_foreach_slot (cmpp->pg, cpgp, j) { if (pgp->id == cpgp->id && + VECTOR_SIZE(pgp->paths) == VECTOR_SIZE(cpgp->paths) && !pathcmp(pgp, cpgp)) { r = 0; break; From patchwork Mon Nov 25 14:32:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13885036 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.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 E60981B0F1F for ; Mon, 25 Nov 2024 14:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732545162; cv=none; b=BbA/85gtbzgbXyiSU3TGFiFUhSKCeGc/VLKVFDYWbV8Htz7N7+mjWx8AsWLZ+HMINMCNwzD8WaZoq9JnaFObtI2OkAPJa6DWilZuyLJXiQng6gMfiMWYz6YEsSZ/dWoDrSMGfuoeYXUeP76H+b2XGZRGv+uucMD1OjQ6LdXnC+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732545162; c=relaxed/simple; bh=X6WF3C+sKubs7eXRB7P8XQYktmSOPIvvL0j2EQJ+9gk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cbi8SyMm2aAi+WTEC7M7r7peFHcwrgOha7cXECM3TrOrZOjHh/I78TmOHypQgHNFdZKcHGkWljhx/2YgMDvRXhKDhm+p5aF49RFEVzLU87OXx/x6Pn0M5gS3W6o3DMsWsjb6HwVmHjOzAhZ3j+7RAlAtkNjx2HA1YYkTPEXyNTE= 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=JAi2fWKs; arc=none smtp.client-ip=209.85.218.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="JAi2fWKs" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-aa5500f7a75so177263366b.0 for ; Mon, 25 Nov 2024 06:32:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732545159; x=1733149959; 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=n4mZuSscAilrbAaeYlUTldnht2aXSmKXbBabplDcNPU=; b=JAi2fWKsuGsTDFBHMKpxzfYgD5OjzgygCDLgneEWXXAOuy3dBLozqkDVbkXaemCcRd 9ylJ4e2ANBCXcxexXh3LxabsgyWCLPomL6pUSMwswe1XNREAfVNsy2kcwXWxFeHS7qIw MfnIZEPwOaLB3ZFyeGj4K3jZs21d6lSWKA5NjSlE/4JryFKbqbqKfzwuB9pK/bwpDC8L QuyWKpv4xSTlWXBjhnl9Cv4Nm4c/f06sgtF4OYIGHc9RTqsvtXfpmLg2iooBCwQ7Sh9u eBbEOUgjOuwwCU8sJMOmZOxTGwAc71xkug8i11GM9o47e0GsRAW0LzafIlt/Q9OFDBkh nfxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732545159; x=1733149959; 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=n4mZuSscAilrbAaeYlUTldnht2aXSmKXbBabplDcNPU=; b=B83GQBvUWc2Pc19b1UCX/rv1vWHxl37I1cqJEqXyrNSHr71XD3k9MIrv8k6mbas1yX BhwxDwZqCXTDiLGurPbEQmNzsf3u0mPnfYyUrMlVyUTv+MVFdNaZSssuvCmdUaJVk3yg wG4aax/hAu4l/d0HFHBHFjvXUyWOtHiT2VBndkF/eeJF65QSThNyVOcKFol8smhVUx7u NXjUQxKs9WNKloMKuX2Iolyub8pNOYmbEM+kjHBX2K4s+BsffYDhefme08G1Alo4fDNF bWAqp1nrfaiAQ9RzrqcVV+J2YfXQP/buJs7/KawndwMH2zk+uuIycpN8mT3lHvvFNteQ 9VfA== X-Gm-Message-State: AOJu0YxM9T/2FKMT4KkUzSZwt5T+9lICWk7aXyAbJRuv2/3Xv6NvCr81 GfEP97x9ZbtVq12l2y/M0iztngaEovO1jFYNF7NSQZJ1Qdp7ifpGpt0apeZfuNM= X-Gm-Gg: ASbGncucPvO1hiRWL7I0zUpZtW4IG53eqRTyKG7xPPjiM6b1lMv1TZmp+syJtOS0A+/ 43vVTbMp051oLhJcMWzr1L2ly9KkxzLHx8BKBy/nXzXoE75eRJHp69IJqgqW7lXF+M0jiLzAWK4 BafQs6ntA4k4mtadqznsTHpjvVczstdxM83T6HDeMj7kEUROFRCOS21mvhV2KS6inMEY9wDtbBp eGHhFrvy8/PfVqAjaZcRSPCT0/R5yzt20+X09H36PJ25CtmNSjtM500xxeWQryfHw26lKd9ZClP H5qXC6Hs5NuznJj42/T+V9bG7J86IG3a3/tq X-Google-Smtp-Source: AGHT+IE0MaIqqx9xUXZuVYBXwWZDgm06Xob0hEDdV+cKTCwCeac8a9Snn6MtNxdsIMdpKrseFp0fYQ== X-Received: by 2002:a17:906:3101:b0:a9e:b287:2813 with SMTP id a640c23a62f3a-aa509906366mr1196372266b.5.1732545158946; Mon, 25 Nov 2024 06:32:38 -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 a640c23a62f3a-aa535bd5bb1sm317526566b.48.2024.11.25.06.32.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Nov 2024 06:32: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 3/3] libmultipath: move pathcmp() to configure.c Date: Mon, 25 Nov 2024 15:32:24 +0100 Message-ID: <20241125143224.51934-4-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241125143224.51934-1-mwilck@suse.com> References: <20241125143224.51934-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 ... as it has only one caller, and make it static. No functional changes. Signed-off-by: Martin Wilck --- libmultipath/configure.c | 19 +++++++++++++++++++ libmultipath/structs.c | 19 ------------------- libmultipath/structs.h | 1 - 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 55140d0..6f79a4f 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -426,6 +426,25 @@ compute_pgid(struct pathgroup * pgp) pgp->id ^= (long)pp; } +static int pathcmp(const struct pathgroup *pgp, const struct pathgroup *cpgp) +{ + int i, j; + struct path *pp, *cpp; + int pnum = 0, found = 0; + + vector_foreach_slot(pgp->paths, pp, i) { + pnum++; + vector_foreach_slot(cpgp->paths, cpp, j) { + if ((long)pp == (long)cpp) { + found++; + break; + } + } + } + + return pnum - found; +} + static int pgcmp (struct multipath * mpp, struct multipath * cmpp) { diff --git a/libmultipath/structs.c b/libmultipath/structs.c index 4851725..dfa547b 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -627,25 +627,6 @@ int count_active_pending_paths(const struct multipath *mpp) return do_pathcount(mpp, states, 3); } -int pathcmp(const struct pathgroup *pgp, const struct pathgroup *cpgp) -{ - int i, j; - struct path *pp, *cpp; - int pnum = 0, found = 0; - - vector_foreach_slot(pgp->paths, pp, i) { - pnum++; - vector_foreach_slot(cpgp->paths, cpp, j) { - if ((long)pp == (long)cpp) { - found++; - break; - } - } - } - - return pnum - found; -} - struct path * first_path (const struct multipath * mpp) { diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 4821f19..49d9a2f 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -598,7 +598,6 @@ struct path *mp_find_path_by_devt(const struct multipath *mpp, const char *devt) int pathcount (const struct multipath *, int); int count_active_paths(const struct multipath *); int count_active_pending_paths(const struct multipath *); -int pathcmp (const struct pathgroup *, const struct pathgroup *); int add_feature (char **, const char *); int remove_feature (char **, const char *);