From patchwork Wed Nov 27 23:04: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: 13887430 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 012D2202F71 for ; Wed, 27 Nov 2024 23:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748682; cv=none; b=qIPfWMI+P0QpMMGsHwtXbSl61Yxg/PFnxQDoh0vhsQTsGtuc4ncqekOJoVmHPVEI/ClJNXowYmQyNUMR9rPEHCev2jz2cAhHH0djecfcKrvYWi+z2HMN/jfnjUrH7pELEpQeSMZaoWnPT/a3gvz+S4uEvh+Chn48kdhRiVv0jS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748682; c=relaxed/simple; bh=VP699SPieS4EpYkuuwK5suHCqsorrOXQSYXuM3atX/M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XMJVXwvREYdRjuPPaWTHKItopIQzumR1u7LWffU2Ljk/Q4UM0UhFakT6+jIsS0adLnReZ6ziUSyYEmDYjdzskPZKvaeisiHdZ0YmTy8P87mOCHRFHOt4v+OoFQRo18P4plZ9IL0xdI8lOecV/n2c/pKYtjdVWAhawI9nfzzPzXg= 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=d4svfP/L; arc=none smtp.client-ip=209.85.128.51 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="d4svfP/L" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-434ab938e37so1106205e9.0 for ; Wed, 27 Nov 2024 15:04:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732748678; x=1733353478; 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=GIL0oYsqG4cDKJBSXjIgjmATe2D58BHvG6PUTe0fWfQ=; b=d4svfP/LjdTzghJszVDWdr2bGAUJXPiWSsMxFGPX0K95+UohUP1/3P7I0Fnzm15huP 1kLx9D6nKVyzi6z3QWw6t9xXbGbCtpYkCak/YElFIyZ4oREoZ5AdRgI1Ffz/WGDyNA8T BI4mC4LWFbPXcUubWxFRdm6ezPIDhvdtFR3Qn9a0YfwiETmpe55DD7phxFchJuR65qPL JcYAmX41UEV4K75I/747TynzZSNBqmI5TybOXK02MFDjk0qXu1hn9eJtYLZ5Rn+78Naw s1UD7HfAlWHL2b5TU1rBcX+Jbd35h1GiXnmoXsISNUb94mxo9+PuZrMRb2ouctzPy2o7 bNPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732748678; x=1733353478; 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=GIL0oYsqG4cDKJBSXjIgjmATe2D58BHvG6PUTe0fWfQ=; b=t577GBB+ych+zyqs9ZDFG3+BSoY0bpmT/XtvBhyHxgtJidGHqVgnjuJUJ1EB1TvvI8 jhgQcCDf3t7SMuMwU+EHxk4CTDa3MiSL7U9QFbsl7BwiSTEkdD+YXzrj3lPL3XlvQRIm zTO1XS3n/D/4iId2tbdRb4kk+td5cPoscnVx24lm54X3Ywev3y5hy5zuO/NyjUXzeS65 UabOQlDsWlvGmYcSjAbKZnpQkZb9wtFJZRwQuwTTtX2TmMmnR+e+HTEeHGtsBcUnXzOZ /8iHQTzqRkQg41Zuzcmd7Ylf+J8CWoaHJiN9pIB+aEbppiam4XjHjgIkcw2CGQRSq/H4 BXqQ== X-Gm-Message-State: AOJu0YzczeHi4BtKvehkiAYjCaPlQcQQzQzFSVMNNtQIAmsdfHlUuu0A +nuCTOgmmTGmwMr8XDACLtyrui7b6TZioqiRndcFe2zkMUojQbWsPlu9/7/py28= X-Gm-Gg: ASbGncus3OohzHiKTQlp393MhxsItnSL94wDva/+U9D25bplsWXd1pHPzEHnnwVw6EY EOd885U4hFmUMP1lO7U8jrsZHDv1OHw2HGTiJIwE/TSXIO/W32GRERNU+0VARIUCIjBRnAvRvCw 9uc1Dy4WPL3LKLHhQ60irHyfbuQFbfSoiv/ldRdjcwr4l7p09Wuf6ZMBHxOigY1rYFywvGYgA4m R2nY5iRrJxEB5yB0rAa+OrbKZKJBs5aDu3kzqr7RCTFtxDc5DlVIkT2mU0M4RFjby1ZvyLcsoBE P63UitwxYjf6ZtfRU0DHFF1PFCw/rFD47IcN X-Google-Smtp-Source: AGHT+IH+QqLc0ulfgKKUGPsh+how/Rp9n0iuM5E5Q04hcLtTQy1WMxLMtLXg32LKXrbUyg+U133E8w== X-Received: by 2002:a05:600c:3546:b0:431:5044:e388 with SMTP id 5b1f17b1804b1-434a9de78d0mr40726085e9.22.1732748678143; Wed, 27 Nov 2024 15:04: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 5b1f17b1804b1-434aa7804fbsm34732595e9.21.2024.11.27.15.04.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2024 15:04: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 1/8] libmultipath: fix handling of pp->pgindex Date: Thu, 28 Nov 2024 00:04:23 +0100 Message-ID: <20241127230430.139639-2-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127230430.139639-1-mwilck@suse.com> References: <20241127230430.139639-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(). - when a pathgroup is deleted in update_pathvec_from_dm(). In this case, pgindex needs to be invalidated for all paths in all pathgroups after the one that was deleted. 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") Fixes: https://github.com/opensvc/multipath-tools/issues/105 Signed-off-by: Martin Wilck --- libmultipath/pgpolicies.c | 6 ++++++ libmultipath/structs.c | 12 +++++++++++- libmultipath/structs_vec.c | 15 +++++++++++++++ 3 files changed, 32 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..35883fc 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -108,6 +108,7 @@ static bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, struct config *conf; bool mpp_has_wwid; bool must_reload = false; + bool pg_deleted = false; if (!mpp->pg) return false; @@ -125,6 +126,10 @@ static bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, vector_foreach_slot(pgp->paths, pp, j) { + /* A pathgroup has been deleted before. Invalidate pgindex */ + if (pg_deleted) + pp->pgindex = 0; + if (pp->mpp && pp->mpp != mpp) { condlog(0, "BUG: %s: found path %s which is already in %s", mpp->alias, pp->dev, pp->mpp->alias); @@ -139,6 +144,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; @@ -237,6 +249,8 @@ static bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp, vector_del_slot(mpp->pg, i--); free_pathgroup(pgp, KEEP_PATHS); must_reload = true; + /* Invalidate pgindex for all other pathgroups */ + pg_deleted = true; } mpp->need_reload = mpp->need_reload || must_reload; return must_reload; @@ -354,6 +368,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 Wed Nov 27 23:04: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: 13887432 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.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 4D1AC2010E1 for ; Wed, 27 Nov 2024 23:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748685; cv=none; b=OFgRyyJqza7YF0syFMx4nniAPH/x+dPJPIj8z1AT+zdzLBPbb4yyBg/FspY/yYZKfh3+OZfrlsSUKNoFnJjv0RzRdIBHWX3zKZkGFJMol8iOqOWU2M/cqVIUtome8lE3br1ARWSdxnKeL9QR5nxElix5nLtbEZqsV3jVZkVkxf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748685; c=relaxed/simple; bh=aiRk9WAnkvI77xBxBQSNpsETn7u8gXA5eOC25/MZPtA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q8k9/pHMMnBzPx9IFeTL9Ro6sUBhpweeA9i/cJN4ZnwrQVSL7ZzdBzXd4BSfE/9ZZG9Di81VNh4E5G06Gsb9i1MBRZ8n3lBAYq7S6JKckwFP/9EjgJQDrtm+qAVZx84W/Qm9XacGiD/29Tkdm8vROPdN2lQvtaJ9b03FHkxATqM= 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=d/GkDQ2T; arc=none smtp.client-ip=209.85.221.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="d/GkDQ2T" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-38231e9d518so180235f8f.0 for ; Wed, 27 Nov 2024 15:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732748679; x=1733353479; 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=jrCEG6zpuSFIe5D2YdmWR1SuNildF1xSQO8Os0+jZoA=; b=d/GkDQ2T0TGqA/fw6zuj4nNBY20V/f1LZKJ1Kx6nFtrg3WIJIj2uxe+5wEKeoXepam mhHgW8k9ThCpy0tFMjfARInZWv/lqvFn5+nb5BTePIjIYdf4/mHKsGGCUqFYP1NFgQYC WehH6crrU7stATSCUxJUAjkjJFPeDzl51lXALRl9N/KuYpqmNby/Kix+yAI5RzPtIcOE eHwx0eG/VF/d+n+Ktdz6Qek/haM7Hx2kTtr4LWvF0BeVaKNZAqic889KgvRo+JyHtw8u UDGdER7OZ/JpSJlqAr/HZQG3Q8Ap4Bydv0r5c11Dorn0i/u54PqZ5ISEofx/naDLSAdo J6Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732748679; x=1733353479; 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=jrCEG6zpuSFIe5D2YdmWR1SuNildF1xSQO8Os0+jZoA=; b=R7yOzOXwp9eOdCZwvv1hX6+zzHKiF0xFmcnDwUXlGEdp3VoJf0+m74K/HyORAXNnxe CXK4WbKaaQubkFZD6NSK8mzKpta+CWxNN2CvSUNG4WK1pb9eBKB4i1l+94gmQAqmwvnh 3R8PqleZT8faWiBx3IQ3lE4XKIus9IdQcrmsDs+cjrCmycM2BdKjP5aR4G3KHhRbU8Bq 1JFSGPMleKDt1HjAEOhhWKlwfZ6VOSWDD9ArRi4Xs8fzmLiD2U2QL6EgBPYS2mFZQFGH vMldIWPzZIrPQ9jGN2iV4dcpeUECgyQDB4kP3w2Xlt1nJnwbyzMYfCNqOp9NR8ZpUVkv +Fow== X-Gm-Message-State: AOJu0YwzYOZ3Cwmh66LnvdJse/bLO5LkmiEUi1v/9WAmd2QfB56+HAk5 atiyeMjWpXgtMdcxhgSKNNr+Zr8IOkak6jOKGgqaihMfYQzQ0GynhkW3fRarJJOGnuLflhRRLkh U X-Gm-Gg: ASbGnctRe4b+MZjpcoU+yI99y8ac9+GPE2vk4YA6bjzu9E04r8slQbmTJ/FUPav5yvT +WvdwOL9mBmW/GrodJSBQajlA7nwiDQSunRb7t1/jrbOauvTGomWka8HFhb+RjrjOBlWKKYT4mt QXs4YOLzocGsZIcZwz1aroGB8tlmt2tUog5X5Z0P2nA/g3yfH72aiuzTR4sfid9royq1JtuJybE XoaQXpxhilpfRi98kwjBNRE2RLROqBWqnE4JX5cewVmhbH0sxyqkjQPjrmVsENeuncdZWwaEKv8 HWoYml6mJIqCCHyyGzxhc968tj0dtDvg1zU/ X-Google-Smtp-Source: AGHT+IEqM0lAeZ1YvJn+sckr/2hvQJNWJv4b2xidRXFlt9lffB81NHZ/43pI9cAWk3p6DxOSE09abg== X-Received: by 2002:a05:6000:18a2:b0:382:4485:2dae with SMTP id ffacd0b85a97d-385c6ebefd8mr4521771f8f.25.1732748679371; Wed, 27 Nov 2024 15:04: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 ffacd0b85a97d-385ccd3a71bsm74875f8f.55.2024.11.27.15.04.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2024 15:04:39 -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 2/8] libmpathutil: change STATIC_BITFIELD to BITFIELD Date: Thu, 28 Nov 2024 00:04:24 +0100 Message-ID: <20241127230430.139639-3-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127230430.139639-1-mwilck@suse.com> References: <20241127230430.139639-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 A non-dynamically allocated bitfield doesn't have to have static scope, it can also be a local variable on the stack. Change the macro such that it can also be used for the latter case. Signed-off-by: Martin Wilck --- libmpathutil/util.h | 8 ++++---- libmultipath/discovery.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libmpathutil/util.h b/libmpathutil/util.h index b1772e3..df7f91e 100644 --- a/libmpathutil/util.h +++ b/libmpathutil/util.h @@ -91,15 +91,15 @@ struct bitfield { bitfield_t bits[]; }; -#define STATIC_BITFIELD(name, length) \ - static struct { \ +#define BITFIELD(name, length) \ + struct { \ unsigned int len; \ bitfield_t bits[((length) - 1) / bits_per_slot + 1]; \ - } __static__ ## name = { \ + } __storage_for__ ## name = { \ .len = (length), \ .bits = { 0, }, \ }; \ - struct bitfield *name = (struct bitfield *)& __static__ ## name + struct bitfield *name = (struct bitfield *)& __storage_for__ ## name struct bitfield *alloc_bitfield(unsigned int maxbit); diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index b585156..2be1f5a 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -875,7 +875,7 @@ sysfs_set_nexus_loss_tmo(struct path *pp) static void scsi_tmo_error_msg(struct path *pp) { - STATIC_BITFIELD(bf, LAST_BUS_PROTOCOL_ID + 1); + static BITFIELD(bf, LAST_BUS_PROTOCOL_ID + 1); STRBUF_ON_STACK(proto_buf); unsigned int proto_id = bus_protocol_id(pp); From patchwork Wed Nov 27 23:04:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13887431 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 44BC6204088 for ; Wed, 27 Nov 2024 23:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748684; cv=none; b=Gz+n+r+lUGMDS4wF7J1qoB537dbxspd2bhR1kFnWi0TUjlUUu+0vBionYaSxC8bpyONxo6faIpBW8IWdxwnQrpL6PtV3yv2s/4wUrd4MavqU3hewnxg5KYhIzakBEvG8XNO8FdwuMzL9OGLar6QDlIR2ixwcObrEaIJe2fdn76g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748684; c=relaxed/simple; bh=sUIxznycnwi1m4nI8M0HKXt9hyXo6YgNy8VyZ3WmGIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mV/DQcuM7vFKTW93K51eYttYFenlQ1Ha1foOsq4mpcJu5pw43QoCcXl9Wa1N4GrPwmcOKpmJxmHJoWxnMiXfamBZimnBvOemWdfCyLhcoJ2pC6lI28uAMGoZwB05sS8vF7wkFzxY9M1i6W4OLOryNLtCAdc8MOMv0rNpHIhmNiI= 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=UuS0HAtR; arc=none smtp.client-ip=209.85.128.49 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="UuS0HAtR" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-434a752140eso1535535e9.3 for ; Wed, 27 Nov 2024 15:04:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732748680; x=1733353480; 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=uv2uUZ0sjLsGvtiky7aXyhDgrUtNOPpcenjftxXZL28=; b=UuS0HAtRzGIavHoej0vGuGZrUS1UF/F8TL38+hpcQp0OsPNkDuDySNskTByGVLDyat EBOFfNd1+vXbP7/2e7H5yzubHhqhXvxT0wnN0YkfiG2iypOw0ix4DSGfqtK9O4SUY7eB O9Xg2bZj1PdeuZJsgxO/u3WGVtyGrcnUAjJxT6rHcmnpq2TT/Az8kNCdeHKJ8LsoO+e0 W0nb0wT6AWz03ydYdttQwUrbIqvkvvIfjkmtcovbQicke71tJUQzm2/QMDLPakVfFa9v dZSPshZ4LtC8T9eGqkHsfYnLkMNBhbDJdGE05gkJ4/XxsxmJDH/9qqn9on+LDoN4puMF MNVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732748680; x=1733353480; 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=uv2uUZ0sjLsGvtiky7aXyhDgrUtNOPpcenjftxXZL28=; b=cMAS21OoXfEjQ2gpSZ3yXEQtLkjBdR2cSgyvuLBqUpd3QKdprb/Bpw5DA07lzK/KJS 2me+a9CnMoT+8OnMfZOCvOIRa3lMEE5bhDn8Ywxqme4fd57G+jSh2KT1PSw4TTDLkHiT 6PJpSV3rQVoyYnpiga/YB6h55SmZHon6jQEfjr89rU7O469xxRUxM1vl7OHb0BRb7IfV +Kr1hqtHWRPn5jWzxuITywpyw+KJGFIW+6q5GNSyWatRhQKtem3JUSsmrRg8cusxdN76 2ji2WF4kf9AQyzF66d9pCTmtwYkgZOBg032YNn7/YbEthCsTrIDKGNGbYhxD+Pn4TtMc ZQOg== X-Gm-Message-State: AOJu0Yx3owAsh1z0FcAp/3EIt3hCA6xfzaCk2ohtPPlPRdkmS2bgeoxG 7fb6G37jrUFEOn9fEPnmTxOGFDbY2an9Nr2PN5Pi2rpVI0atmq207oWKEJJk8e7xx6BgGst2JbV w X-Gm-Gg: ASbGncv+LzgJFYdRuu0V3sGCTahRBZ+bhEZZCU1QESviSQ2+BZoeQUpoEnyxLveVRjx JS0bRwn1t5X/PfOzmj9EgiwrCqEaQ5oLHkPVnqFp/1x2B9OBJhE74pxsJmu1ZebOKNCviDXhgXW Zhu4Pu5lBoYTsb4KBapxLPuCQodhhvu17fBaz8NLdCzP77BMmSR1eh+A20Az3A3Uv4HoC0tbV2k ACwtC662tlf2/d0JMMvVGkYiKRHiXq+6l42NMSN5CpKQPxde+nPulqPa/IViFf8uacdSeXmVS9v +1OnATPX+j7/tz1qWLA+XcTJD08J9hhjdFDA X-Google-Smtp-Source: AGHT+IHSGYTh4cW+yfJMl/X4qcOCBSClQPRkXKueBQUcqVIzMEXD0O6CAfe324LWQ+qQZvoG476dOQ== X-Received: by 2002:a5d:59af:0:b0:382:5088:9372 with SMTP id ffacd0b85a97d-385c6ed7667mr3899103f8f.43.1732748680380; Wed, 27 Nov 2024 15:04: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-385ccd36a02sm76993f8f.37.2024.11.27.15.04.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2024 15:04: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 3/8] libmpathutil: add cleanup_bitfield() Date: Thu, 28 Nov 2024 00:04:25 +0100 Message-ID: <20241127230430.139639-4-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127230430.139639-1-mwilck@suse.com> References: <20241127230430.139639-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Signed-off-by: Martin Wilck --- libmpathutil/libmpathutil.version | 1 + libmpathutil/util.c | 5 +++++ libmpathutil/util.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libmpathutil/libmpathutil.version b/libmpathutil/libmpathutil.version index fb92f72..14aa083 100644 --- a/libmpathutil/libmpathutil.version +++ b/libmpathutil/libmpathutil.version @@ -51,6 +51,7 @@ global: append_strbuf_str__; append_strbuf_quoted; basenamecpy; + cleanup_bitfield; cleanup_charp; cleanup_fclose; cleanup_fd_ptr; diff --git a/libmpathutil/util.c b/libmpathutil/util.c index 1255974..38e984f 100644 --- a/libmpathutil/util.c +++ b/libmpathutil/util.c @@ -337,6 +337,11 @@ void cleanup_fclose(void *p) fclose(p); } +void cleanup_bitfield(struct bitfield **p) +{ + free(*p); +} + struct bitfield *alloc_bitfield(unsigned int maxbit) { unsigned int n; diff --git a/libmpathutil/util.h b/libmpathutil/util.h index df7f91e..3799fd4 100644 --- a/libmpathutil/util.h +++ b/libmpathutil/util.h @@ -146,5 +146,5 @@ static inline void clear_bit_in_bitfield(unsigned int bit, struct bitfield *bf) void cleanup_charp(char **p); void cleanup_ucharp(unsigned char **p); void cleanup_udev_device(struct udev_device **udd); - +void cleanup_bitfield(struct bitfield **p); #endif /* UTIL_H_INCLUDED */ From patchwork Wed Nov 27 23:04:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13887433 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.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 52BD2202F71 for ; Wed, 27 Nov 2024 23:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748685; cv=none; b=PwyHqPNKEYDcEVq3ze2CURCxp84pvSzd/7vMZPYmbuUojpE0dksT2XD7LXM50TC3BkLzEHu+kAAdFOdlosLwNrHOSg4VOuKOrzFmE36i6jMFyv9Jzphr/+CFWPxEemLJBmee15G4xGIKyboM4pCauuWtRmVY5pGVldtrwIsAcYE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748685; c=relaxed/simple; bh=laIAL02rAfPP5OfUyKCOuf68vBzHgCuXP++Um9A+2vE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gwyA62BtQl9mfl40SNGUMHAGbEjcc0wK7bBHi3bif/skW91cgU1blmS9F/dvUABG7xTqXDx5cAWnwlUiGfIsOIhGIav8V7QcqGYW7Zr7Yxu575n/Zx9d1ewMpNYBuW9VJJI4bd5x53MUVX8wXaR5QUPE0PMgJ6wvGZfapy1F1Fc= 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=NP/Kr/Z7; arc=none smtp.client-ip=209.85.128.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="NP/Kr/Z7" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4349f160d62so1538305e9.2 for ; Wed, 27 Nov 2024 15:04:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732748681; x=1733353481; 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=apic9H1WkfA4dBNU/A0r5l0s03zwAfvOJu3QZU6FA5Q=; b=NP/Kr/Z7ywiK2h5GGxfo+G5ZLHDI7vR456Dt+Df5SNp7YqF2/sfxeXSndvRvwEBRNB JFC7N7qR1qnTxiHCwEJED344pCRKlox0frJOmQcuAuyf2Gm320zzMcYmW7rAR7oQ8LiO u7y+MIFicXjFAkBY9fIOhSeLSUfN+aYnQ0rTXSmxT9wiAk4PMkXUZjrCWfSntazBGBTh Ge6nJmSc3lklJVOmrxms8/2isP0JLPysjh0TaNTCEBtljJ+2JdKlQXVZ86KT8BAPNfjf XKwG415u4n5Fx7AtWL01DikjNvObgnnP5u9SkiRl8xDD12iSRvDBPkWIIib8TEDAgXL5 1SUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732748681; x=1733353481; 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=apic9H1WkfA4dBNU/A0r5l0s03zwAfvOJu3QZU6FA5Q=; b=DGPPZ1jTbAg6TC31+L5f8gdnZqr423anm3LjVOR+Z1KoZH5TYOR0hYEYDUbc4qu+yx vhUa8hq0VtQ/0iJEz88ai6ef5go19dyGjW867JFCQlabVwAYUdHqCqWJlq5aHAeKoxg1 Q8Zi5q1i4jpwDAEMFjt48z+BZBJVh1IDUTUu3W3dJA3iXTxcQ1k3Sn7aQqCLUSnJIrX9 Q2PpIOavAY6RQnRktKssvf02ajPyeWXPJSmk4Tq/UQrWZHtclyaZKhqTaJXVqFldyAEg x/997kRY02qqH/JOvTuL42rZTFnAatHhNniVzJESM83lgss66cLIBHbUwC0kH9/YX70H YjTw== X-Gm-Message-State: AOJu0Yz3k4o1MRjViGjFWrZMyHz1OB/pzin/KtegjR7s9r0oCF0G8ynK q9BFeSDc9KTBgfNnIwkkKcUa5Kw0HLGpWS9YJuUzrMHjKmCXVaZGshvCU3m2camOATnzKctJUzS T X-Gm-Gg: ASbGncsaoKwK2VjOnfNDtRTANeOUISkA6ncWoCFX483FHQW6y+Zoxwn8lyBXUBbkhZL JHXKybEQcoa1dW2CpxYjGEAgMgY8PlVn5bpeA6TA1kZ7hMulEENzaeFAqV0dfeEtPb3jFISQv9t K2AyolJru2tL6H+LEWenZOuy+AJyHQA3ClQkJU3PsQuXbMXltuqQwQKtTit7yRrWfzdOE2eEq0F B4SctbqDdCNITfpyJNWbnXzNQvWS3l0BZdpCDq+CLlVwlT23zC1rtHsOQlEX2p/DvYdvxeAEPlw XgBDmceaajTbZR/7ghOmr62cmN9D1KW1gtRH X-Google-Smtp-Source: AGHT+IFjKJaECmisjGFJeJX8VJfckDFl3aP141yDVDRywPyZBsKADjYcZrtE3k+dP301cJR9Ko8fCg== X-Received: by 2002:a05:600c:5118:b0:431:5863:4240 with SMTP id 5b1f17b1804b1-434a9de4584mr40212035e9.24.1732748681401; Wed, 27 Nov 2024 15:04: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 5b1f17b1804b1-434aa74f05asm33946125e9.1.2024.11.27.15.04.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2024 15:04: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 4/8] libmultipath: move pathcmp() to configure.c Date: Thu, 28 Nov 2024 00:04:26 +0100 Message-ID: <20241127230430.139639-5-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127230430.139639-1-mwilck@suse.com> References: <20241127230430.139639-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 d0e9c95..9ab84d5 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 *); From patchwork Wed Nov 27 23:04:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13887434 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 5B6D6204087 for ; Wed, 27 Nov 2024 23:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748686; cv=none; b=JaX0YWYF8bzR6FCd882Rd1nQ6FybjrIuA8BMXQIEeLa9eh7KFphmvAkcAwqQ6BzpD8xKTPTLAJ+joqTVR2VNCpXwr1QL2tKgN3As3YPVnN2kHWS6ZlE8P7DD9KmP8+Tnit8J7JNh0AjgMaRFYmA1dMIpDOZadK+oAzzctisArpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748686; c=relaxed/simple; bh=lxTFy6jJzIon/IJFM9OVu6a5u22eyDOg1t1zGeBhZLI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JK4xs9IjR8MKNOFvwRf4JwXn8Y6dSY8VgoFfRTwzNeIqgVpaC7m2u7i+xxL+XYZdiQ1seuvr9cHU99Ghm1aMl6YVRSXEFo/UO2gH429BhJpeNKCFKKSimK1FUnIGsOXeudPDS2+m1Ul8T8G3wvYQyPCNFKUXiNYQjzZeFb/iNIk= 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=R2Ex3X9W; arc=none smtp.client-ip=209.85.128.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="R2Ex3X9W" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-434a83c6b01so1654295e9.0 for ; Wed, 27 Nov 2024 15:04:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732748683; x=1733353483; 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=QTVUYr3FUXW0DkJ4E5yibvxLSGtXLyvZowRC/+2BwpU=; b=R2Ex3X9WuZWgQ+APwgGt/jJq6eH5fzAqpSGLQmdF3nJrSKEKzfAQmU5Rt7DNexsd5W Tub2t228UsdONi2ulnJK3oK6LL5nL2nsv+m6xBmnM4v5I0d82+dFnKLQfuPkhjPV3Rtc lHU6Z8sH3tliIo/KRRmxva080BCJWkVmth5fl+sfshGDs4qZK87PbIIx8qxpyrFoEZbJ 84J7rdxdtOysmrov8UcEvOoLLROfiAlZSl//lGTYd/AkRg0ZALxybtYYnvLLgF8ID55g 0pVepePHQnSjxkxlsgJ8QjRDfpeOf1mcbsz9XQDoog/BCiE8eeq6sRQh6BkyhibNgFnk xyqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732748683; x=1733353483; 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=QTVUYr3FUXW0DkJ4E5yibvxLSGtXLyvZowRC/+2BwpU=; b=Dxg2RbPS0JTRwhbsHCmBeq3SrZcDsmTzQa3OI5WeYsXkiuZ7u6zKGqnYSb14dzDg56 YYRTqz/2S6IzLzPJ+eqqwh9IsZ7Ahs0YG3FDaS17rnONsXuNFKTnQZ1+rSkNySmRIqUl 3rpPziJ5CdRNdcvOEU8fcSAxOQUgSAOTiuMwwfwdNFqlaLB1RcCHkB6KwJrbDQpNt0uo 1/5DR66eVGweEgwloUj1CnmRsgqf/HsKJYMmVaS1+jxBiIDMIJmUvQ3L4rD7rdLjdkYj D687DDM7SAVC1Bi+nFd8N6zX5m5aD0PF/mkxXNiWrjk6WfZvN/roPqKqOVavpJ9t/zBN g4Lg== X-Gm-Message-State: AOJu0Yyb0YPsIPyR+u8mF3js+aapxqJ2SZFyqr8Ms4UCxE+I6Q0+2Wwf 9TaYe9KLQ/rTC8mxj/n5e9s7ViTVUg5fesqzvFio8OUoRVnirA19hwXK2h+01Ce5icvxz5bZDMx 4 X-Gm-Gg: ASbGnctuzlmz8TIJ50mLC6wGRmSE6KNJcba1dlzgbf+1ocwZhPi+xOCIid8Hy+BOMN1 qSK4sEmjappEI1sIUJVHHtG0v5QLRkEiTZazhiFAlNKeKzJu0weGj6wXCluDK00hXI8Thnuqrzb Mow5sGaliHkDCDzK+EPw7O9B0zsUkw4AQLmuYhA2KMZFzHUKmGTBP3Ftsqn7LBechIHJ8OWGBZM iXWexV/ctb8AdwHxrpB3jo5613EoruaTuO8jq61Ix24ZhGPP5pI/6As9ymvgr2vVdsEDwpajjuF 6OcFPh9LBnqxPa7msp7qtADQaPM2pxAVncLc X-Google-Smtp-Source: AGHT+IHFeo8bNUIJFbjoNopc+kcNPPJ8UJwNXWbG/rJErIed4zihaS+2mAQ4oYc8idtUN/TU7H1GAQ== X-Received: by 2002:a05:6000:1866:b0:382:4a98:da57 with SMTP id ffacd0b85a97d-385c6ed75afmr4515544f8f.47.1732748682564; Wed, 27 Nov 2024 15:04: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 ffacd0b85a97d-385ccd2db59sm79343f8f.11.2024.11.27.15.04.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2024 15:04: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 5/8] libmultipath: re-implement pgcmp without the pathgroup id Date: Thu, 28 Nov 2024 00:04:27 +0100 Message-ID: <20241127230430.139639-6-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127230430.139639-1-mwilck@suse.com> References: <20241127230430.139639-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 pgp->id is not only calculated with a weak XOR hash, it can also get wrong if any path regrouping occurs. As it's not a big gain performance-wise, just drop pgp->id and compare path groups directly. The previous algorithm didn't detect the case case where cpgp contained a path that was not contained in pgp. Fix this, too, by comparing the number of paths in the path groups and making sure that each pg of mpp is matched by exactly one pg of cmpp. Fixes: 90773ba ("libmultipath: resolve hash collisions in pgcmp()") Suggested-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/configure.c | 94 ++++++++++++++++++++++++++-------------- libmultipath/dmparser.c | 1 - libmultipath/structs.h | 1 - 3 files changed, 61 insertions(+), 35 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 9ab84d5..bd71e68 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -416,16 +416,6 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs) return 0; } -static void -compute_pgid(struct pathgroup * pgp) -{ - struct path * pp; - int i; - - vector_foreach_slot (pgp->paths, pp, i) - pgp->id ^= (long)pp; -} - static int pathcmp(const struct pathgroup *pgp, const struct pathgroup *cpgp) { int i, j; @@ -445,32 +435,74 @@ static int pathcmp(const struct pathgroup *pgp, const struct pathgroup *cpgp) return pnum - found; } -static int -pgcmp (struct multipath * mpp, struct multipath * cmpp) +static int pgcmp(struct multipath *mpp, struct multipath *cmpp) { int i, j; - struct pathgroup * pgp; - struct pathgroup * cpgp; - int r = 0; + struct pathgroup *pgp, *cpgp; + BITFIELD(bf, bits_per_slot); + struct bitfield *bf__ __attribute__((cleanup(cleanup_bitfield))) = NULL; if (!mpp) return 0; - vector_foreach_slot (mpp->pg, pgp, i) { - compute_pgid(pgp); + if (VECTOR_SIZE(mpp->pg) != VECTOR_SIZE(cmpp->pg)) + return 1; - vector_foreach_slot (cmpp->pg, cpgp, j) { - if (pgp->id == cpgp->id && - !pathcmp(pgp, cpgp)) { - r = 0; - break; - } - r++; - } - if (r) - return r; + /* handle the unlikely case of more than 64 pgs */ + if ((unsigned int)VECTOR_SIZE(cmpp->pg) > bits_per_slot) { + bf__ = alloc_bitfield(VECTOR_SIZE(cmpp->pg)); + if (bf__ == NULL) + /* error - if in doubt, assume not equal */ + return 1; + bf = bf__; } - return r; + + vector_foreach_slot (mpp->pg, pgp, i) { + + if (VECTOR_SIZE(pgp->paths) == 0) { + bool found = false; + + vector_foreach_slot (cmpp->pg, cpgp, j) { + if (!is_bit_set_in_bitfield(j, bf) && + VECTOR_SIZE(cpgp->paths) == 0) { + set_bit_in_bitfield(j, bf); + found = true; + break; + } + } + if (!found) + return 1; + } else { + bool found = false; + struct path *pp = VECTOR_SLOT(pgp->paths, 0); + + /* search for a pg in cmpp that contains pp */ + vector_foreach_slot (cmpp->pg, cpgp, j) { + if (!is_bit_set_in_bitfield(j, bf) && + VECTOR_SIZE(cpgp->paths) == VECTOR_SIZE(pgp->paths)) { + int k; + struct path *cpp; + + vector_foreach_slot(cpgp->paths, cpp, k) { + if (cpp != pp) + continue; + /* + * cpgp contains pp. + * See if it's identical. + */ + set_bit_in_bitfield(j, bf); + if (pathcmp(pgp, cpgp)) + return 1; + found = true; + break; + } + } + } + if (!found) + return 1; + } + } + return 0; } void trigger_partitions_udev_change(struct udev_device *dev, @@ -763,11 +795,7 @@ void select_action (struct multipath *mpp, const struct vector_s *curmp, select_reload_action(mpp, "minio change"); return; } - if (!cmpp->pg || VECTOR_SIZE(cmpp->pg) != VECTOR_SIZE(mpp->pg)) { - select_reload_action(mpp, "path group number change"); - return; - } - if (pgcmp(mpp, cmpp)) { + if (!cmpp->pg || pgcmp(mpp, cmpp)) { select_reload_action(mpp, "path group topology change"); return; } diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c index 1d0506d..c8c47e0 100644 --- a/libmultipath/dmparser.c +++ b/libmultipath/dmparser.c @@ -307,7 +307,6 @@ int disassemble_map(const struct vector_s *pathvec, free(word); - pgp->id ^= (long)pp; pp->pgindex = i + 1; for (k = 0; k < num_paths_args; k++) diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 49d9a2f..2159cb3 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -531,7 +531,6 @@ static inline int san_path_check_enabled(const struct multipath *mpp) } struct pathgroup { - long id; int status; int priority; int enabled_paths; From patchwork Wed Nov 27 23:04:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13887435 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.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 C7737202F88 for ; Wed, 27 Nov 2024 23:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748688; cv=none; b=ikhqOW0PhL1pST9xwJOo5GM7Eul3fCltVAM2oSvcxGSUqaYm+pl+om0Hc8th4NfL6BaTrDmMUl4YJPI6dEVZ8PS0ABizaIRpf1jh9T56O41vQYV+ervKdA9jaGvRjivWaC3o084+JNjJnahpVXpTa68olGY1iQciGY8juHld28U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748688; c=relaxed/simple; bh=EbRSsIU8M5Z7wguy9WPxLyqDC7aPCUNC9FI3hsLSiWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kXUHRMxGRSxpm5/v3BvfixyS86Yr9YXBdzQnWoTLWCL1kTXixwbF5n1aRdhVHrSy4OWpMUwD2M7uPDedIwpMa9XuTbs5rGyMK1NxLygxWy2706x7a1km0UC5gmFiHn1KtRahCf08cMhgFwreXj8g4YaWYAJGf0k0t2CGdEzs6NE= 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=DPLf2z4+; arc=none smtp.client-ip=209.85.128.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="DPLf2z4+" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-434a1fe2b43so1569175e9.2 for ; Wed, 27 Nov 2024 15:04:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732748684; x=1733353484; 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=p2I0ZMSlmKaPHwyazn+ikQztNTZEcjG3llZmEp37SW4=; b=DPLf2z4+fUzAzaLqk2xptLU3Fx/D/WpJSJi68VpghDV1HBVFFrBPpOTY6iXN4ania7 GfgiHJijpHkGBFC11V9UdXK52omv56k4ZnKvnk7YHgzE8lvPX0eoJiO1/pxA7VhGaOia pWBc9ShH8kwJ7r+gN7VBLubykw8QE9VWjm+zUIq/ObsFRthjVn9NyErJu00uufU3Mz6T 7CLmxe8a0CgnQ4L8wCFSS8R3fYYluNSt8GXRHnBYOTwQB10063RBcVX9HWWvjP5I/2d0 y4/71gN2ntb4IdN0iYieaw6shwJjDUDoIKAAlTQf8P9eG9tl1PYcdT/m8wnS2ZXPpz4D 3qzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732748684; x=1733353484; 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=p2I0ZMSlmKaPHwyazn+ikQztNTZEcjG3llZmEp37SW4=; b=qCBd6lI3kajbdaofIwPGIXK8iu0PWYhjYEWA3DJsCrLQ0MuGuKg6bNDxyba58ITwVz 3xfSd8x6T74eSpFIwWgq7zaRno9A4YErA5VeogmobQjG5d0XhcXrIs2+yqD7wjnBufRG HQnNRztpnZyFghpU5kPPUslVBC47/qDG5Bn/V0oMxpCN5aIfcqBY3xERk/nmjYAjRRcO 9cw1euvm9lMAUieb8LJDLKkCfgR5l8INkn4FDlG0Sp3dianPOjwI/eyS4+G/O0UcqD/Y TEhZT3u+QKhHVSei/pmyH/Smb4kalXGfDn2Eo8yKl/QnB6rhVrs5NNHvVh4v+OCugaqy JmAg== X-Gm-Message-State: AOJu0YzqDsRHjxg1KHSdnyGkaoouLitd+wMTC+f4BjlDgZ6517Bt4ND9 ehMvqqVFWE1He5Fzi+5pJX5l3S7dC3Kut226HIXDDh49ZWn5kdJg6EPpoL8V89eZv3loc5z36/A y X-Gm-Gg: ASbGnctm5cTnOCH/o+q4CO3Aqo0tENkSs3SFsks/M07k0hM/axKJU5IzRDLmzU6jFda pF6SR5DkBg0069sAvHDLs4hbzXAxcCyiuJ8AjN6FZx4KSZPRgF4efncdRZ1e2thCPAqyiZua5Ta J5hMfhtManCck1nHRZ1OOkEk+0Tr8xcfooEJw834Hdf8JrKWKQ9hS+6iggkOsqctWBSLQ6/vcjx 68b1hE3DcNHcFGguDdMIGSATrG1qnAYwq5OckV0TYtFGMr+k4vDJHtp+I2VJZ1YiwZrPtwK4Euh U8Seh+FGWkM4AF6axB/ycVTTjgnEIVGOAjh5 X-Google-Smtp-Source: AGHT+IGI0edCpgIdr8hRPJI67Vn2JYzEVEvB0j07dLrAQj5gyAjRF+eFgdkrmc5R6rLWjgY4CnMiJA== X-Received: by 2002:a05:600c:510c:b0:434:a902:97d0 with SMTP id 5b1f17b1804b1-434a9df21f4mr41965615e9.29.1732748683891; Wed, 27 Nov 2024 15:04:43 -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-385ccd3a71bsm74982f8f.55.2024.11.27.15.04.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2024 15:04:43 -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 6/8] libmultipath: trigger uevents upon map creation in domap() Date: Thu, 28 Nov 2024 00:04:28 +0100 Message-ID: <20241127230430.139639-7-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127230430.139639-1-mwilck@suse.com> References: <20241127230430.139639-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 map creation succeeds, previously not multipathed devices are now multipathed. udev may not have noticed this yet, thus trigger path uevents to make it aware of the situation. Likewise, if creating a map fails, the paths in question were likely considered multipath members by udev, too. They will now be marked as failed, so trigger an event in this situation as well. Fixes: https://github.com/opensvc/multipath-tools/issues/103 Suggested-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- libmultipath/configure.c | 11 ++++------- libmultipath/devmapper.c | 9 +++------ libmultipath/structs.h | 1 - 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index bd71e68..2b1dfd2 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -614,8 +614,6 @@ trigger_paths_udev_change(struct multipath *mpp, bool is_mpath) vector_foreach_slot(pgp->paths, pp, j) trigger_path_udev_change(pp, is_mpath); } - - mpp->needs_paths_uevent = 0; } static int sysfs_set_max_sectors_kb(struct multipath *mpp) @@ -1002,10 +1000,10 @@ int domap(struct multipath *mpp, char *params, int is_daemon) * succeeded */ mpp->force_udev_reload = 0; - if (mpp->action == ACT_CREATE && - (remember_wwid(mpp->wwid) == 1 || - mpp->needs_paths_uevent)) + if (mpp->action == ACT_CREATE) { + remember_wwid(mpp->wwid); trigger_paths_udev_change(mpp, true); + } if (!is_daemon) { /* multipath client mode */ dm_switchgroup(mpp->alias, mpp->bestpg); @@ -1030,8 +1028,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon) } dm_setgeometry(mpp); return DOMAP_OK; - } else if (r == DOMAP_FAIL && mpp->action == ACT_CREATE && - mpp->needs_paths_uevent) + } else if (r == DOMAP_FAIL && mpp->action == ACT_CREATE) trigger_paths_udev_change(mpp, false); return DOMAP_FAIL; diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index d4dd954..55052cf 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -537,7 +537,7 @@ static uint16_t build_udev_flags(const struct multipath *mpp, int reload) MPATH_UDEV_RELOAD_FLAG : 0); } -int dm_addmap_create (struct multipath *mpp, char * params) +int dm_addmap_create (struct multipath *mpp, char *params) { int ro; uint16_t udev_flags = build_udev_flags(mpp, 0); @@ -547,9 +547,7 @@ int dm_addmap_create (struct multipath *mpp, char * params) if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, ro, udev_flags)) { - if (unmark_failed_wwid(mpp->wwid) == - WWID_FAILED_CHANGED) - mpp->needs_paths_uevent = 1; + unmark_failed_wwid(mpp->wwid); return 1; } /* @@ -570,8 +568,7 @@ int dm_addmap_create (struct multipath *mpp, char * params) break; } } - if (mark_failed_wwid(mpp->wwid) == WWID_FAILED_CHANGED) - mpp->needs_paths_uevent = 1; + mark_failed_wwid(mpp->wwid); return 0; } diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 2159cb3..6a30c59 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -467,7 +467,6 @@ struct multipath { int max_sectors_kb; int force_readonly; int force_udev_reload; - int needs_paths_uevent; int ghost_delay; int ghost_delay_tick; int queue_mode; From patchwork Wed Nov 27 23:04:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13887436 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 AF93A202F71 for ; Wed, 27 Nov 2024 23:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748688; cv=none; b=Eu+9ivzcKjGss5H6OF+ZsGB69f+XWQoZFgygzN/omR6TbdsS+vJNbPXA0IqHt2asd21hVEssUVR6/SRXHSvxHioeFBtbT5xlU5+GcF2lXeVs+0qaMQatdmt0eBIT9r5pTsLvNb7priklFU5QFHbP1ftYKjgWVdf8oHtmh7B3nxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748688; c=relaxed/simple; bh=TMDpgORyke9Sv8Ex33BThZ7ajMzGcbaE455+JYd8c2I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W7f8aYB+w0w5Se27yh62u6sbkmDhX4XwXhpQfCbitiK8VsXfHCZRDO614tLgfyrkbN8T1CnoUvHTouILe3G7JFVO/4+bT7shnsJKiKN3ebR1Me6mZexN8EMiTAM1B/NmRWF7UUhHqcyNtP5tFYEANh4uLw5B17SDKdQoZv0pkjw= 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=d+G5nh8f; arc=none smtp.client-ip=209.85.128.49 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="d+G5nh8f" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-434a10588f3so1038755e9.1 for ; Wed, 27 Nov 2024 15:04:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732748685; x=1733353485; 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=k8OUi9V7BDIpsKIx1PKxdGGvddi4yTsFEoPCDgiOeKU=; b=d+G5nh8fR0Zvek5cCIdNtPc7GPxBSHTMvQ51vIXsttQJ56ZMLiQpD2x04XDad3B3hH 50f3GbQYGOPqh9yfIvvO6n2tmwEXSOf9iOAL4YVkkmIusxo511s2hTRh+77NBcGvltBd Yp54rguBKJFfc2xZId/R85fT4pT7u1hnL1BITkjn/nIOKu1+4zx9n5VsCekx/8evqaUU E3dAF2FO/KHqnIkprmjqfleZ3ztbsvzZJ9DRvtT6Wdk2KISoyBzR4gaz8pKlNKaDeYV/ V/VEITAW+6aWH5hFkX0GtLtGw6Qdpgd6ayCEQR6IRxZ5gdNwCsB0lERXYCBOSib1xUeM ewog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732748685; x=1733353485; 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=k8OUi9V7BDIpsKIx1PKxdGGvddi4yTsFEoPCDgiOeKU=; b=W/LFuj8HST0N8290ujEEEwgqXJ7QcB8hQyx8Rn7GNsHjiBNswhJxPFrmqW/uwFONFm f9HtHaoxhuCui7pOcABscfU9sY0+QHekB6uw8noUffr26pI/l8uIFBYVHZspJfabrldR ryBkysCmq/U8KnYEFwtmV38lph3+XZJGi2MAZxE9Npitc8UnWIeKZAdnlULIfOu4whzY lW4nLxstxlLx/XwRVzY+OrURT0ZuJ7/TLIAkH35f1kHISADsRZxosmlsSUxJtWQMYiyd 62Ta2v1QDN1HlwepZcH31YM5vE19cBB4zwmOg5NevUGdhA/0BrjzJOPiBfNxJwN/y6EN /EuQ== X-Gm-Message-State: AOJu0Yy0zBmkFp93MCexJ2dCU/17S+zVL/REbrUBYzkKp+Nk0SM0YHcw s5Cwo5SqLXR3AEH1KTmCaDvhzSbd0wzTDdy6zQEIVvxRsVN/jJw60E/4kKd7SSY= X-Gm-Gg: ASbGnctyh/085jCAws9bScL4uJ2Pn1qRVOMLe8CqJyET+fE6zY/rPTbEaJJ1sT7IGm3 KiWZ5n6d23sj6ykLUDCgPmMMdgF+mT7zJDvh24V54M8xOuinVrrVZqzl9oQl+0v23dikFScaTnr LzeRsmM+vsjaoAoRfGrlGXphQU4TQwY305veiJ+luKok4seRfjHV+HkPVzBcu566p2OQBteMQPC BpPL9Jlip+BpzM+yUn45wLJPK1+R7zaFTMZzay0Tbp1iz5g+x8YWM1XavccTc+nJaOZ5+ROgA7c 0mIK6nQ7jatLrAqIVsBCY9IUaUKh1m100KmK X-Google-Smtp-Source: AGHT+IHNmk2W3fFVOwguqgMCnkIEmeBMJ0w8FKpj4KeyHZywiKnHjUCzN5mJyOrsNN4UgDr4bg4yHQ== X-Received: by 2002:a5d:64c2:0:b0:382:41ad:d8dc with SMTP id ffacd0b85a97d-385c6edd452mr4271897f8f.36.1732748684913; Wed, 27 Nov 2024 15:04: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-385ccd36d1asm79129f8f.27.2024.11.27.15.04.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2024 15:04: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 7/8] multipathd: trigger uevents upon map removal in coalesce_maps() Date: Thu, 28 Nov 2024 00:04:29 +0100 Message-ID: <20241127230430.139639-8-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127230430.139639-1-mwilck@suse.com> References: <20241127230430.139639-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 a map has been flushed. In this case, we know that the the paths haven't been multipathed by coalesce_paths() because of the current configuration (failure to create the map can't be the reason if the map exists in coalesce_maps()). Make sure udev sees the paths which have been released from the map as non-multipath. Note that this is the only case where maps are flushed where it is correct to trigger paths uevents. In other cases, e.g. after a "remove map" CLI command, the configuration is unchanged and if we triggered an uevent, the map would be re-created by multipathd when the uevent arrived. Signed-off-by: Martin Wilck --- multipathd/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index fcab1ed..9ed27da 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -794,8 +794,10 @@ coalesce_maps(struct vectors *vecs, vector nmpv) vector_del_slot(ompv, i); i--; } - else + else { condlog(2, "%s devmap removed", ompp->alias); + trigger_paths_udev_change(ompp, false); + } } else if (reassign_maps) { condlog(3, "%s: Reassign existing device-mapper" " devices", ompp->alias); From patchwork Wed Nov 27 23:04:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13887437 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.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 EBDE6204086 for ; Wed, 27 Nov 2024 23:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748689; cv=none; b=uaSYyItLxUpl7b6I1Jfx0uW60ICsyB/X/cOlWQP7rlBrZActyRfsyk2zkXiSYxpDqbH0xBQC/OzywQogVYxzHh8+GMq2B/kNyqrarP92bxhKRPwCLj6IHGqbXMio/Zzz5IjWFnzjwAaHEKwLdhnPQmq16eKaP2oSBCu7DGiG7DA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732748689; c=relaxed/simple; bh=B149yvPgIKHW4PFWfx8re2i372ylWp5fR+kEg85PKCo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tlRBCr78fnYFDx7Xc8cdPvLxuUBeSmA0GcI8HW/wnc8hKVIRwf2Z2mtsjfJEwvLkBINUh9xHf+mR1OPtlJjD+FVqFmPEnkb5QOgyRJkIpSvM1Bo8xMlZ+b3SoT4R3i88vg2XbNgjVipvpiS8SxVLXtcpBfKS52zdvenGITKor/8= 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=eSqlJZhA; arc=none smtp.client-ip=209.85.221.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="eSqlJZhA" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-38248b810ffso192989f8f.0 for ; Wed, 27 Nov 2024 15:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732748686; x=1733353486; 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=1bdjTZ7PbBu/BpdZdueuvo1kxjSc8Hq0/qC9334W4eY=; b=eSqlJZhA6o60xJRYDgU1WAgBn2F6N+hh2X0+DxCiT0L/zfkNmU4PIHvuy84hACIYPH pR5cZDvPIhmJg8YGQ2OObMvGaWvKh0kIjXmRme7dOShZ26LNqNWspaiGdC2ER54+8NEe 7JPclvJyLFHjsM9F9B/idgZJKp/n/vZDfnK/hFdnAnEr8d1PCHOUwbaDigrzmQ9nPGVU O0Hi6XxnAxVYBLlY+O3VK43dW5GU/1N7V6uo+1m0VxQj7r7s//xKq0kjPU73YCdDRyR2 gQ5klbm5PUa5dJJestgJdJcuh7MnS3LsuUPEU+hnHo86Fp3eQo/tfYTix81rv5e/PNjt 8P8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732748686; x=1733353486; 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=1bdjTZ7PbBu/BpdZdueuvo1kxjSc8Hq0/qC9334W4eY=; b=Tmpt87gEWTLrO3ghjDA05zYSZqiRvZRc20eG3ZXyIPvzW+c0s059CCpBOVxr8dp9A7 Az6QG2kwhSig4AO3nRnIGlxRo+cetDdu2H53iluxYtUufIWQ71xycKic5wm86TThmqHG p3giZQbnfcwoYBg2A7qruZGigMOQk8DvUfYdVahRfVHgShv/kKBMLLYI5KOIUb1TdRgc 4ER4sO5rKFfs2Ua51BJL93v+BDBmXNHI5J4ezB4DcSvRrE5FUKFx2LQeFFWcBOgMcj5p yam5epTcUQn3YcGw6Awpt7U2qHeS8M3sSR5OyRBlgiEh5BbfP44Cc11bNj7CmwA4SpKn 1K6A== X-Gm-Message-State: AOJu0Yyc4XT7bMn9TjSPmmDpERW0gF0gyt/Dqt5Tbw0Q9Qe/88nDTEah cB26m8QT5FPkRU3EnG2E5dsTUdA+duo5ZwvgWduQDXYyu/ADH6LoLkC9J45tl6jWnwHe7V7x7Vk X X-Gm-Gg: ASbGncvNBSGMvLWXRzXq9a3BYKHHaZhgcgi1JTC8H0GnZRD1kFaog1c0pWTPnMUX6RY EzUmFYae2Y35D4zwUt2aliuOm3+PIuFGe6bxrq1wynR6WNOQy8SXNHmmyR3cMMh2OYoDHl72q+K FDJxN1i/lldVMZzrURavBoe8G+dMxdx55kPQ4wiw+5x27AtV1ib5feN+r74miyLJPFOSWJuKp6U 5BaNyyjNqN+GVVrRPmT8hcfK1QTytxP10AmWMOToJwHCI+EMTQPxyjG6ULJrsXoUlMMs60cOjx+ p2T5bwqzpLZXmlm1H58NakrYyz7bqdpJO+C5 X-Google-Smtp-Source: AGHT+IF1xDAOt9NtYvnA9hp7IappnTEl+/HOYuhQN6f3cly81pFqjkJA6oVONQItBKe8vdgu1doWJA== X-Received: by 2002:a05:6000:2a08:b0:382:499a:dc6d with SMTP id ffacd0b85a97d-385c6ee26bcmr3245526f8f.55.1732748686157; Wed, 27 Nov 2024 15:04: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 5b1f17b1804b1-434b0f32837sm2758575e9.33.2024.11.27.15.04.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2024 15:04: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 8/8] multipathd: improve a log message in coalesce_maps() Date: Thu, 28 Nov 2024 00:04:30 +0100 Message-ID: <20241127230430.139639-9-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241127230430.139639-1-mwilck@suse.com> References: <20241127230430.139639-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Signed-off-by: Martin Wilck --- multipathd/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 9ed27da..e9d9848 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -795,7 +795,7 @@ coalesce_maps(struct vectors *vecs, vector nmpv) i--; } else { - condlog(2, "%s devmap removed", ompp->alias); + condlog(2, "%s: multipath map removed", ompp->alias); trigger_paths_udev_change(ompp, false); } } else if (reassign_maps) {