From patchwork Fri Dec 6 23:36: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: 13897944 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.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 AC3691C548E for ; Fri, 6 Dec 2024 23:36:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528208; cv=none; b=chdIrqoyNmJElKfBXJfbRSaFLpRo/kP7jDGqaV10ECAsqTTAbcwrZFKCmwkbvrlZ0o/MX7dbMlQfIls/V+40uvCeX9/tLijriFoXNDp7F8a9VMaMn8umGro5fjk4MKdcvObJQ2utT2qQ9Jf5rk6XKgAW28TDWkapZeEpjVGllhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528208; c=relaxed/simple; bh=TJUbZMJ/BQnct+rp7MX35gEGnVA9vmc04rNCABtswL4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=elqurcgDp7ejTEuhHE3j2QAoHIOfQdyPV9H/vBvyEBynVfVfmMyGfyylPktlXUh3tObVEEsoCG4e64jk2/rPa6TNTjbGxfzSB0F8NnKMQUMrJnVZfmeOx1ucRvkKkLf4R6TpumCBHIBph4eKn1UJxqjjevJGF1/DsvRqz4n5BNc= 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=BFA6+p9o; arc=none smtp.client-ip=209.85.218.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="BFA6+p9o" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a9f1d76dab1so132292366b.0 for ; Fri, 06 Dec 2024 15:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528203; x=1734133003; 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=up0bw/sBlDrivAIEU6w0r5sQC4powLACo44lnav8imE=; b=BFA6+p9oMHINS1ti78bO3NVAPM/2wYSRS0Z4gilKEz/Xf3y/rIqQrCaFEeGObt+i8t yWmImlTOa8GkzXCxzRIiOYyZkRzoGlQpGi2FuOhn6Q+Ct+uCpHuy6UnMD72VXVmR5QrC 8p3GzADYGPgJuxhxdjTZrEdR2CW+/J8opQp+fPlHr4wytbwotTBsPxL3zwfhJ83XEmoR 8UkyB6sgz0mQLOEjEA8v4SH3cKsZEbJOfKeGu7futxP3F/GEiWBlGbXAZbm4dZHr3DHk jXk8Z3QLtiedeWdUMc6FIrbEUkDvoRNWBMqdnbxLgzXSePmaAMbkZ4Un3C43xA9ye35p 3MCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528203; x=1734133003; 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=up0bw/sBlDrivAIEU6w0r5sQC4powLACo44lnav8imE=; b=KcV8lJ9QXGvxlj9Lj1AHMZ2eZubF1l2xxIiCcr6haRfbdkMOtwMHiBqiX2C0OyXXht Ho7w/Y6xn78O6RFZXYz3T7Fwwz5ZUeSIIqPP50BxQADPY1PZPe+1XAsl1ZDhVJleaoxD q6UKFhdNjJ7XFVVSXfGD9wkyWJi/ja8OsALAJkFoh6+PqwGx9fBcBrIw4y4PAcE43jCI IlHPvLQ2XrK03R4WdJkluPCz7/0kklYFvJrhnBpNQWKXqEPcKIj+rS9leCO2ajm+mFu/ +JTI2dFUYLcfw3sTSEBybvE6rMVgrbFinpT59EkOYO2pCVcxV0+t/xWeawPrXvMcxPam xj3Q== X-Gm-Message-State: AOJu0YzUi3OW5Kw/XoaTZokl+K9Puu5v6ZVOBWrIzBbAH2qFDkL9ZYFH fsUzn1xtxGrFcnZhkgwVq1VSv0B3ugqwSPanfLk/d/VjP7Ni/28Ka9NHRISRLE8= X-Gm-Gg: ASbGnculLMA8oopDJZAi/hvBhm5zG+ta0rDtZSRosfLmwjJErvmjeADohfvWcCd+yxj LFST5PRGZEJ2ZyeGQGZ2K3BhmOm9h5j7OqEvbK8iTXvlXgqefwP2VNJ4omXv05HrLiZyl8W/CBt XhSqLBMyRkS7uMObsQbBKMZjrQ7V2u4p+eIjrrc0LRgB03CVIcKGHhWURSe3tcFjNZr7cQfnjxT E0LREHZBW+3358dVR7ZBZ8vimORYbJKPPBT0SkFcBS5sIaMVgzwxKJePa5PPbOkMuFpjnhYd/Da 0P+Zuqd02t88hsyasUBVK8LqBpU9xCDof0kA X-Google-Smtp-Source: AGHT+IH/NwhX+bRAfkXjmND55wkBlSKKqof37xT3aXazlTxHSVff8yKduR7jrWOijzmUkiW1GySycg== X-Received: by 2002:a17:906:3194:b0:aa6:1e70:bc8e with SMTP id a640c23a62f3a-aa63a268950mr483792066b.48.1733528202589; Fri, 06 Dec 2024 15:36: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 a640c23a62f3a-aa625e92a08sm304708366b.45.2024.12.06.15.36.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36: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 01/13] multipathd: don't reload map in update_mpp_prio() Date: Sat, 7 Dec 2024 00:36:05 +0100 Message-ID: <20241206233617.382200-2-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rather, return a bool indicating whether checkerloop() should call reload_and_sync_map(). Signed-off-by: Martin Wilck --- multipathd/main.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index d7d4a26..fa684e6 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2689,25 +2689,25 @@ update_path_state (struct vectors * vecs, struct path * pp) return chkr_new_path_up ? CHECK_PATH_NEW_UP : CHECK_PATH_CHECKED; } -static int -update_mpp_prio(struct vectors *vecs, struct multipath *mpp) +/* Return value: true if the map needs to be reloaded */ +static bool update_mpp_prio(struct multipath *mpp) { bool need_reload, changed; enum prio_update_type prio_update = mpp->prio_update; mpp->prio_update = PRIO_UPDATE_NONE; if (mpp->wait_for_udev || prio_update == PRIO_UPDATE_NONE) - return 0; + return false; condlog(4, "prio refresh"); changed = update_prio(mpp, prio_update != PRIO_UPDATE_NORMAL); if (prio_update == PRIO_UPDATE_MARGINAL) - return reload_and_sync_map(mpp, vecs); + return true; if (changed && mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio && mpp->pgfailback == -FAILBACK_IMMEDIATE) { condlog(2, "%s: path priorities changed. reloading", mpp->alias); - return reload_and_sync_map(mpp, vecs); + return true; } if (need_switch_pathgroup(mpp, &need_reload)) { if (mpp->pgfailback > 0 && @@ -2718,12 +2718,12 @@ update_mpp_prio(struct vectors *vecs, struct multipath *mpp) (prio_update == PRIO_UPDATE_NEW_PATH && followover_should_failback(mpp))) { if (need_reload) - return reload_and_sync_map(mpp, vecs); + return true; else switch_pathgroup(mpp); } } - return 0; + return false; } static int @@ -3040,13 +3040,11 @@ checkerloop (void *ap) start_time.tv_sec); if (checker_state == CHECKER_FINISHED) { vector_foreach_slot(vecs->mpvec, mpp, i) { - if (update_mpp_prio(vecs, mpp) == 2 || - (mpp->need_reload && - mpp->synced_count > 0 && - reload_and_sync_map(mpp, vecs) == 2)) { + if ((update_mpp_prio(mpp) || + (mpp->need_reload && mpp->synced_count > 0)) && + reload_and_sync_map(mpp, vecs) == 2) /* multipath device deleted */ i--; - } } } lock_cleanup_pop(vecs->lock); From patchwork Fri Dec 6 23:36: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: 13897943 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.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 D7F6420457F for ; Fri, 6 Dec 2024 23:36:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528208; cv=none; b=qYbXOKMrmU7tUQKvbV0l/pYmhd3drGflbqXCiVw2ntcceGv5AhLxZO0aEGXfDn2wto0KklZ9aNsr072izl39+pdlim0ClTEdA6XFsyXEisvZGe5X5W4LIplV6+aVWGkI6MmkHzCs1ep8RDgWJmt/UTKmURB8KbV/hIKCmjEDy14= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528208; c=relaxed/simple; bh=rrGSVmOgyi1ETVifSDgJb3B+MjBSFqlPN22Xf2m5eJ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZMiZWbWh7Gbai5EoC0BC7NGvjpTS1Xl1y49USaH6fsnUYHphiBqAr0iGpkmixa4d/fwTaTaDYMms9+1/1GE2ktnbZs4hfe3RtdbXkQ17LbszP6rVuxfjUORxB1e7xChp7tXl5aETS+f9mCKKfo7e7lq23Dc8C4rLONAPPQOYfYI= 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=IqX/z3PM; arc=none smtp.client-ip=209.85.218.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="IqX/z3PM" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-aa64e1dc9b8so33532966b.0 for ; Fri, 06 Dec 2024 15:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528204; x=1734133004; 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=PvsqZ4zdQ+CnRhMyNVwfKD3vMahPAdqyL66NwgdCQ2c=; b=IqX/z3PMqS3xMWerTrqE49wz1xoGZVifM3WmLUt4AO1FDgr4k7PbWwa+wxlX1zFGKZ VdPCzM8ihWR1GuOz640ZVAx5JJwvhqo7J3IBiONltgjiO/gs1wy6YIBrLxx5QjqWoSmm g37CTJ2m/iMKKOj/ciVmHj5udkXM8Dwds1rcZ6Jx1+rnGRwhJcvBP1CDA3Lq/UKAELmg QZxyNsgqXRkonn6lfQs9B6rWZ5PgigoAHGE07e7Fui+5ZMLCARm35LW2WdJDNPf4OEaI x7FcCHJUkQlYC1BZ6EXLi54CHwqEU7sfRE9iEhX5GpIsWKBf1OtxolcA3BAWIM1+/Bmf +ghA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528204; x=1734133004; 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=PvsqZ4zdQ+CnRhMyNVwfKD3vMahPAdqyL66NwgdCQ2c=; b=LnLI2b4WMNrllxr07GHXkluHpPuDNj73PAqnlYNE3w8Tv4VD8e+RDUgDaj8QpzWQ3T bLkeJbI64/mJgQKYthRlueUJDc16jyyt1mRVTO+mx4M4434WnNCei3Vq5/vKv0AR2zL8 iVf8Db+chB/kzs9zTsRm5suq6zYLy6KvysNjFMAx03RKU5tmOXzpuA0c4l74aSP1kiv+ i5xl9Cic3y7xZ2yAN6DrUt3KBe1N5jha8+mt0ZLK1CGQngQPji/fHWeJCBHZddY1Tsk7 Xqz8heGF8LlWiuIJrf4iH9vZTN/E3SbrOcLU8wmmrouoRnIqTjZs55UKN/7imWsF32q+ Mg3w== X-Gm-Message-State: AOJu0YwjauUBSFGdlp5m40bPeLw9iE94c32oJTofOwYq+Ryt0pBoyJsQ cfifp0CY/JkomnfwQB23mHz5u82A9mDg2TKtj/Gk4mpoRRb3DSa0CnVbS44xd4E= X-Gm-Gg: ASbGnct6qwKVTW5r8q3rUU+oPBrYExMCtV/xqFIsgpfXTyR43Mm16ZVDF1u7bpQ+v7X 4PZMrScnUgFm1uIqoO3EcuiJz5aBINxRld47OEjQtK0Npfs9vrVO36/L/02HyHpShnvpE6+eleg f70kmpngccDhJkf0Ns/BcJN48eV34Y6MulLYrGpmhs7iRJ/SHsssGCMQFa+8VfrJKdIZwqIQHEF sAtHXh1khbLnPnBeD8pPRlZJfACsMlmodMaYhbUavgNTJKGCUGWRUrHEpbch6Lw3SneUN3Katon X4qoVTUdxbLEWgKxp1tDpkJOnJ5TLKdvxfu1 X-Google-Smtp-Source: AGHT+IFGS29Afp8GztEP2gTux74eUN5uavYwmHmlfLz+qNlnXPAtqCM4mvAWvAByxunuRvXR/EuEVA== X-Received: by 2002:a17:907:c28:b0:aa5:b4e1:ab6d with SMTP id a640c23a62f3a-aa621aadb05mr873609166b.29.1733528203802; Fri, 06 Dec 2024 15:36: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 a640c23a62f3a-aa625e4b600sm303870366b.14.2024.12.06.15.36.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36: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 02/13] multipathd: remove dm_get_info() call from refresh_multipath() Date: Sat, 7 Dec 2024 00:36:06 +0100 Message-ID: <20241206233617.382200-3-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-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 the map is inaccessible, update_multipath_strings() will fail. There is no need for the extra call to dm_get_info(). Signed-off-by: Martin Wilck --- multipathd/main.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index fa684e6..4a28fbb 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -503,20 +503,12 @@ remove_maps_and_stop_waiters(struct vectors *vecs) int refresh_multipath(struct vectors *vecs, struct multipath *mpp) { - if (dm_get_info(mpp->alias, &mpp->dmi) != DMP_OK) { - /* Error accessing table */ - condlog(2, "%s: cannot access table", mpp->alias); - goto out; - } - if (update_multipath_strings(mpp, vecs->pathvec) != DMP_OK) { - condlog(0, "%s: failed to setup multipath", mpp->alias); - goto out; + condlog(0, "%s: failed to read map from kernel", mpp->alias); + remove_map_and_stop_waiter(mpp, vecs); + return 1; } return 0; -out: - remove_map_and_stop_waiter(mpp, vecs); - return 1; } int setup_multipath(struct vectors *vecs, struct multipath *mpp) From patchwork Fri Dec 6 23:36: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: 13897945 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.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 1E89F212FB3 for ; Fri, 6 Dec 2024 23:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528210; cv=none; b=KMim0zRyXHUweaKzlP1lEEkHL1riad49/QHQpg6rqmngaDky6q+fK9WC8mJ4Gi3PTL2fLyO2LYC2j0lhJNCx/FQJgoqZVN2zpGnSlnDf3uANhEQkxcBJv8DoepE36x85OdjBZXXCOVh9rxdC9SvaSq9lNLBOUNSfOGh1LGDtwiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528210; c=relaxed/simple; bh=99uGPMq0omkWSLWdPVQDfNnPqGwKMmW9f1MHjsiGP+E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tqEF2pwULbTFhhsyShE3XlDYTatTcSvJ0Rmdenll+NfLuCRQcvBCtvzHjdx7EH5mAkcOIMeJISKlr0AqKV6FXPwJ7UslPLJsccFAGQjzG8MjMa95uqKAojTEeWv2a21dAW/tlVmk/sTAHSIiVRzHzNgO585UM6DOOO3COjefnVc= 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=Xd+cOntt; arc=none smtp.client-ip=209.85.208.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="Xd+cOntt" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5d123ac1c3cso2747224a12.0 for ; Fri, 06 Dec 2024 15:36:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528205; x=1734133005; 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=iJCJKhRUhIxt0DsHNnlVHOy+99tf5fNWISYxhL/xf8A=; b=Xd+cOnttF2JmZ2pOCtuSyo9bRVG/3i9au5xAb/HyLYErRHGyqOWb///iXj3qCtTvZ7 BEyzTMDvMew8LbDYsMYB/iLiOqbIcuMROtuQl4hELx85Igudr6jUmHaEt/P/B1gqIbuG 0Uoi4ZliGP4tjtFUNDXJ/s2KP9lobgJCYldDBzG9o5vRy1wFJP7gKXaEzkKsFMR/9H6j 0SRDyhcoxSfpiz5o8rOWbjcs/OghsINgjhr2SI7RkPeH4wBwBhyW/LQrkzc0br+OgtBK Lraz3Xsbf6MbGUlCdXjsyb1ZgChsV3R5QPNB5zEqGTiefa8IvQeeKIQAkeCpeQ40Iaig 1IzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528205; x=1734133005; 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=iJCJKhRUhIxt0DsHNnlVHOy+99tf5fNWISYxhL/xf8A=; b=V6mEYp9JK6Q4zilP6/x+UIjVC1vZLpOXPHosdZscL98Cf02Hajhq1TGJoxtIrGGDG3 p/6aJxv8T/IUuqPboZf0YgllXinDH5uDqEcTD6HsTooleHQaT522CpIEBBKTjK03UN7n JRz4kZTE7/0wqcfP0f0LECuR0gE2YQqfrb2K6fQNEdgnpF6HkCUp6a0Sk8vT1WCxCiCM xY2Qu2GqjHVDBThsXnzuUAPBL8HEMtxpRnx4MZI7RN7pok+WQvh6m/BP42eJqsGlVf9Y xiSFRuBtusgTaNPO5WrwYjF7U978yFlcCbl7dIIfhE3JyKZT0ckdqP/jtgIGl1KuyoJ9 dRHw== X-Gm-Message-State: AOJu0Yy3peyZsjLgzqlYaOrkq2lPmWI1Nxc6oXBummXUEEzpJnpEcB/H CfbRko92Gyvb5RKkJr/h9KQAuPeOYSnTjas6jVAdlegQmSa1Kr7iEC7BtUqk0R0= X-Gm-Gg: ASbGncsR2vtcW3tULBhWshVrBhFo/ATuGHWxtGgNvmW+BGEO7NkjGVBv8aw7CCITjTU qx3YxwzBYIQyvzYmDD2olBKaCTvkduKpE1IN7irWs4PCa6Oxp9BMLFekfzcHMXD947dT//dOfjy uw3qBq31mbSt9B1KMTGrHrgomkPH2Ygcyfrf19vA/tqQ/Lr7eUXh8onbfwfnFrXU3YoXJ+M4oys RfHWN58r1ytMIkB6Q+J6565bLytNHP8+4hSX+FN1FJVvHZSOvwmgbKzZIYdhVB/t+ep4SjeToNW 3ytCOyVxjlrUZnzPlnYFLR6Jak048L+6ac6o X-Google-Smtp-Source: AGHT+IF197EoKhgthcz1+J3N44NxYkLhM9HzV296tI2R9ff/veDl6oYMG5STUHujxjBo8FrQJ4J+Cg== X-Received: by 2002:a05:6402:2115:b0:5d0:8197:7ab3 with SMTP id 4fb4d7f45d1cf-5d3be6bd82fmr3552535a12.3.1733528205233; Fri, 06 Dec 2024 15:36: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 4fb4d7f45d1cf-5d14c799affsm2694026a12.54.2024.12.06.15.36.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36: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 03/13] multipathd: allow map removal in do_sync_mpp() Date: Sat, 7 Dec 2024 00:36:07 +0100 Message-ID: <20241206233617.382200-4-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We previously didn't allow map removal inside the checker loop. But with the late updates to the checkerloop code, it should be safe to orphan paths and delete maps even in this situation. We remove such maps everywhere else in the code already, whenever refresh_multipath() or setup_multipath() is called. Signed-off-by: Martin Wilck --- multipathd/main.c | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 4a28fbb..131dab6 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2446,34 +2446,30 @@ get_new_state(struct path *pp) return newstate; } -static void -do_sync_mpp(struct vectors * vecs, struct multipath *mpp) +/* Returns true if the mpp was deleted */ +static int +do_sync_mpp(struct vectors *vecs, struct multipath *mpp) { - int i, ret; - struct path *pp; + int ret; + + ret = refresh_multipath(vecs, mpp); + if (ret) + return ret; - ret = update_multipath_strings(mpp, vecs->pathvec); - if (ret != DMP_OK) { - condlog(1, "%s: %s", mpp->alias, ret == DMP_NOT_FOUND ? - "device not found" : - "couldn't synchronize with kernel state"); - vector_foreach_slot (mpp->paths, pp, i) - pp->dmstate = PSTATE_UNDEF; - return; - } set_no_path_retry(mpp); + return 0; } -static void +static int sync_mpp(struct vectors * vecs, struct multipath *mpp, unsigned int ticks) { if (mpp->sync_tick) mpp->sync_tick -= (mpp->sync_tick > ticks) ? ticks : mpp->sync_tick; if (mpp->sync_tick) - return; + return 0; - do_sync_mpp(vecs, mpp); + return do_sync_mpp(vecs, mpp); } static int @@ -2513,12 +2509,10 @@ update_path_state (struct vectors * vecs, struct path * pp) return handle_path_wwid_change(pp, vecs)? CHECK_PATH_REMOVED : CHECK_PATH_SKIPPED; } - if (pp->mpp->synced_count == 0) { - do_sync_mpp(vecs, pp->mpp); + if (pp->mpp->synced_count == 0 && do_sync_mpp(vecs, pp->mpp)) /* if update_multipath_strings orphaned the path, quit early */ - if (!pp->mpp) - return CHECK_PATH_SKIPPED; - } + return CHECK_PATH_SKIPPED; + if ((newstate != PATH_UP && newstate != PATH_GHOST && newstate != PATH_PENDING) && (pp->state == PATH_DELAYED)) { /* If path state become failed again cancel path delay state */ @@ -3018,8 +3012,11 @@ checkerloop (void *ap) mpp->synced_count = 0; if (checker_state == CHECKER_STARTING) { vector_foreach_slot(vecs->mpvec, mpp, i) { - sync_mpp(vecs, mpp, ticks); - mpp->prio_update = PRIO_UPDATE_NONE; + if (sync_mpp(vecs, mpp, ticks)) + /* map deleted */ + i--; + else + mpp->prio_update = PRIO_UPDATE_NONE; } vector_foreach_slot(vecs->pathvec, pp, i) pp->is_checked = CHECK_PATH_UNCHECKED; From patchwork Fri Dec 6 23:36: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: 13897946 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.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 8BCF4213E66 for ; Fri, 6 Dec 2024 23:36:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528210; cv=none; b=p5LYna41b18jND90iPrlK2ogCzJuRaOWcUX+UVptSEuDrzSM6AqWAg9ysgrdSqmMEvVNkkSAj4bUcVqK/gkrSGbeqLHKq3kfZAlnVpaZFoaW+JhUGjZ/i/7122rZY+rw28U/iB5DBtPTBwHV3hOu3ppQTbTMjAKpx04s3sLbFO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528210; c=relaxed/simple; bh=OK5JVvaBin33/wnH+u5gj9rO7i8UGEcABa5TF/Yns8s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qUVryXwO0Y/Tg7dPjzr+DJPgrMoysC5C/w9ZXujD2LJwF1rcuQlnOpFXQp5C3QKKUr4OLuXHIGcViRDrQ44CTGPATJDdDSL7GYdt7jGes2ADzug5PWQqsR1umKtBH5uBM54DZMDXi3LjIwS8b/Te1hEWS7z/rJwwOAbr2fBUZ8k= 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=GVgbXNOU; arc=none smtp.client-ip=209.85.218.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="GVgbXNOU" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-aa636f6f0efso201993766b.0 for ; Fri, 06 Dec 2024 15:36:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528207; x=1734133007; 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=Tm0Do27B3CLVTFwAy172uniH+04DzO3Ca0sBEPc3JRc=; b=GVgbXNOUK+UIcQ7+4pnwGwcc7lSyWZk1DAZ4tJZD/+vbwKXI4BhGKsR8DDtP0OOUZj KfVaMGizlGo+e5p3zqy+XrX7wfkWz+BOHpWMciOjVwoqHJlV+tUy/qrhqdtabriRA2Vq xPw83N/f2Ma+OtCZR3KCEtn7riZ2Dnb8TQXng62A5b3HBJNcVFxTA2ItdS3US8fVOS2+ 4KWEilLL169Of7E9G5Iiv1KUgOBzRZ3QTy/WyyKzSl63Prb8xp5abNC+1w02q/OgFjsh IDja3bBq2RzrsHMFFjlMerNVHBTBxOdtGJwxawxaVHoAFOJn3cwDAmGc/pNs7I83L+gU VevA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528207; x=1734133007; 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=Tm0Do27B3CLVTFwAy172uniH+04DzO3Ca0sBEPc3JRc=; b=rzLN8dzr22PrJTKBd8RHQ2kPdx6u3SRh5RImOQr7UHYbFf8BUvSFtAqndXIhXbRMQx gWpVJ/DB5ECrlfHyzFbnJFmQwYXlhM/ce1gHRFTrc2yTgp7aEL3ze5E23YuTadQrueVs SLGC4ap+WFTensIp7pdmwhRTelZA6+OKhVA2fNBm2Z7y8GA9hkPFhVBoF8SVdLNl+d5r Fky4VOmLvoQGJpZHc3kvqk22pz8sTaLV90uc0t1VgZRHph1kK7RnOypvAjLhbmvhC8us D6Zy2ygkSHDdwFMxWHvDy5GJkrFFtIhfO0EnzHaqh2VeZLlriXQIkImBRlwWTQKc80Ye xEZw== X-Gm-Message-State: AOJu0YySsOqtBWazYaaiYYDvKtBVAkuNCvxd/3JtGiEsUfGgnDbWvG08 +PSTQ4ZPfzM1elIqRsFaZecCusecqmbIKXWImKcvk/iZ4KujYoCK/VGgGTF5jwdK92VhzWrR4e3 J X-Gm-Gg: ASbGncv7Sq5z39pSp6EpdkaiE8UQ2n00YtSgpUg2shp/1bI27PN9EnprYAdNamGh/HE BKHJlQmJQKnjxp3iT9o6/3BE8ZjEH10XrkbudWpw5yXiLFWmCHaknCC9oFJH7vrGkI+GRLtBDz3 odKC2GUcO78/x8bab7BTb/bZ8cp8o9Nq5VBLY8AF9JuuN6gV8qDpWGwgJWojfCirag+hhe0SbJw wK6UNiejJFRLGBWrnHSDboVfxLigSnslunZa+qN8shcrNxwQiS2CgAgQqjpxU2VHHYi8IZyQHqz dz8BYU4vU8apjQCFs3w2G96HfJWnmEJW/fhM X-Google-Smtp-Source: AGHT+IE7Kx35BJNVs2/4ktlbDi8MXd+sxIPdGg2c8FOVxVMjEd85VDPEEB2U6g6shE/y6VGE3ovNKw== X-Received: by 2002:a17:906:4ca:b0:aa6:2d86:bd2c with SMTP id a640c23a62f3a-aa63a0ed36cmr304320466b.21.1733528206655; Fri, 06 Dec 2024 15:36: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 a640c23a62f3a-aa625ea28c4sm301591466b.79.2024.12.06.15.36.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36: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 04/13] multipathd: reload maps in do_sync_mpp() if necessary Date: Sat, 7 Dec 2024 00:36:08 +0100 Message-ID: <20241206233617.382200-5-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 update_pathvec_from_dm() may set mpp->need_reload if it finds inconsistent settings. In this case, the map should be reloaded, but so far we don't do this reliably. A previous patch added a call to reload_and_sync_map() in the CHECKER_FINISHED state, but in the mean time the checker may have waited for checker threads to finish, and may have dropped and re-acquired the vecs lock. As mpp->need_reload is a serious but rare condition, also try to fix it early in the checker loop. Because of the previous patch, we can call reload_and_sync_map() here. Fixes: https://github.com/opensvc/multipath-tools/issues/105 Signed-off-by: Martin Wilck --- multipathd/main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 131dab6..18083c7 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2450,12 +2450,25 @@ get_new_state(struct path *pp) static int do_sync_mpp(struct vectors *vecs, struct multipath *mpp) { - int ret; + const int MAX_RETRIES = 1; + int ret, retry = 0; +try_again: ret = refresh_multipath(vecs, mpp); if (ret) return ret; + else if (mpp->need_reload) { + if (retry++ < MAX_RETRIES) { + condlog(2, "%s: %s needs reload", __func__, mpp->alias); + if (reload_and_sync_map(mpp, vecs) == 2) + /* map removed */ + return 1; + goto try_again; + } else + condlog(1, "%s: %s still needs reload after %d retries", + __func__, mpp->alias, retry); + } set_no_path_retry(mpp); return 0; } From patchwork Fri Dec 6 23:36: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: 13897947 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.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 0020F212FB2 for ; Fri, 6 Dec 2024 23:36:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528212; cv=none; b=QZPKtsmlZPSnePFpKSDxNEpNsB1YOPox7UfUM5UYPC4yyLXqUXL/R/a7ysnoAE67b9De6hHnd+WDxGfChIMuhxjyaxTV52Uhxa7lR+Zfzvyfb1hMJniTslX5xptCYP+jS7x9Ms7PaG5AJHabVo8S6FDHn5FrzIUXh9T8MaUMvEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528212; c=relaxed/simple; bh=XF/ICEjUmEe8APKJ/lc3d+Ft3EwAIYcQQmlAFuQUn/I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RZCZohUMKAoKi0qE4mTM4WS+qv/lVy2mR71jD6i5nVuNUe9nXYymefhdDBrLehMhCvivTWw+P8h4mhWKcK/Jfn0PoLd6qAmONpJksnyyA3Cje5o+YSVkd/JlsNnyGWg8Y74niIMPVIPPsmfalUFnrmjQkA3AHvBCOO5fQzIEs2s= 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=XY1vFMIt; arc=none smtp.client-ip=209.85.218.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="XY1vFMIt" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-aa629402b53so304736966b.3 for ; Fri, 06 Dec 2024 15:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528208; x=1734133008; 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=veSSevNJn/GBoZMTmrFIII7vi6M7CueSXDqP/PcBPa4=; b=XY1vFMItKFf1mY/bzHXcHTTqLjfTp1n4b+uoEGC3pmuUU22FzLrSLYgsoNUjeumV08 EI6LJTA9t12gTvIxvZF3TqNfjYsmO7c6M//qXCFBlJfEpVmQJqtN7pN7k3ga0jZWIHIY jdXX4JFvDWwFg5Xux4rtmP6USmvbwPF247ugtM8C9yy4DBD7qi/Bj/6Hlvk4Z2mBtWRg gLtJcjvn2rAwuIN+ILTeuMNiUzp/CPftKSSNxp/7d/f1OBWdlUq52u4KCizA/eicVybk 62v8rV9Dxa8deQ3w4DTw0vViu7lFM3So1FKiIZ5rdv8wK30YHDrbKNkuSeverXXyRdjK u3Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528208; x=1734133008; 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=veSSevNJn/GBoZMTmrFIII7vi6M7CueSXDqP/PcBPa4=; b=UADU4Vjeh7j7DU9bBQvSp4Gc9poOP4Vx8oYMvyl88HoiO0slqNG9LoLhr7fzwAaYuY QjrwMFIZ3jll352dIU4f0kjkzn6r8Y/NwVj+g12LnNOFH5LD4POmWdIqUC8EZ7jUQrh0 GnXR+Vns5zt8Ftn8n5UT7vDeektGGi2uCLcnrUbAB/poD/CzELSAIHX45Unqt+1a1rG4 sOsKHvfVYTEmot/8H5mRwx2PAQJDiWaNGY7Mc8XEeBWXfQYy6xgjRZsJIPDj359niVM/ cBBDVMP0ZVltajrQH3cERb9FJXXQ2nPa9yKikqn92qLqkA7kifB0wCaeG3uNl26IQr35 PEfQ== X-Gm-Message-State: AOJu0YwfIoKm7lDojjaIVnVYU0tGPR/tn+l+py8yK64tBJ/KCApIeEZz E24yop+HpzeUaoAbfecKkfuOs8SemR1wowyHuoRAwk4my6jnylMG1iC7v9BNEbw= X-Gm-Gg: ASbGncvjGcF7AyqVO15pwyg3RGfIM0O579R2fLdb/PsHIKaPf55p07vAos46Ix4y81G Sj8KkxvHECirgFXOIIp66tN1iTeAmFB4BW87Hnoj7sGJID3N5DzRiDTbU1iup5JhTowaylqV1Tf BU+iKVrGIY+QhgFDlUN6dKEaMtcfLLaxV90w2CL9oSF1RlCgpXLOoxlhOJ1HAgcgE7MgZAfE6kv 6PT+WpNofAkss4eTdqDqYj8r5ZpWGJxMAoXYGvDbGaQkwMRjbRrEbhAi8rJcETvZrCVWh3dG+pW eGVqDlc+s/Wfl5ag5VsHKXlPBf2ZQkPxt5Un X-Google-Smtp-Source: AGHT+IF4M82Y2Nj34lEBgb9mC/tBZibx3CxQK1/YoQfZuz3Uk7PhLtK5TjW5H49hM3b6WtcRN9z86g== X-Received: by 2002:a17:906:3291:b0:aa6:25c8:e75a with SMTP id a640c23a62f3a-aa63a088c55mr296571766b.27.1733528208085; Fri, 06 Dec 2024 15:36:48 -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-aa625e5c660sm304156466b.19.2024.12.06.15.36.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36:47 -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 05/13] multipathd: move yielding for waiters to start of checkerloop Date: Sat, 7 Dec 2024 00:36:09 +0100 Message-ID: <20241206233617.382200-6-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This simplifies the lock-taking logic and prepares the following patch. Signed-off-by: Martin Wilck --- multipathd/main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 18083c7..5f16094 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -3018,6 +3018,16 @@ checkerloop (void *ap) struct multipath *mpp; int i; + if (checker_state != CHECKER_STARTING) { + struct timespec wait = { .tv_nsec = 10000, }; + if (checker_state == CHECKER_WAITING_FOR_PATHS) { + /* wait 5ms */ + wait.tv_nsec = 5 * 1000 * 1000; + checker_state = CHECKER_UPDATING_PATHS; + } + nanosleep(&wait, NULL); + } + pthread_cleanup_push(cleanup_lock, &vecs->lock); lock(&vecs->lock); pthread_testcancel(); @@ -3050,16 +3060,6 @@ checkerloop (void *ap) } } lock_cleanup_pop(vecs->lock); - if (checker_state != CHECKER_FINISHED) { - /* Yield to waiters */ - struct timespec wait = { .tv_nsec = 10000, }; - if (checker_state == CHECKER_WAITING_FOR_PATHS) { - /* wait 5ms */ - wait.tv_nsec = 5 * 1000 * 1000; - checker_state = CHECKER_UPDATING_PATHS; - } - nanosleep(&wait, NULL); - } } pthread_cleanup_push(cleanup_lock, &vecs->lock); From patchwork Fri Dec 6 23:36: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: 13897948 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.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 7093F212F88 for ; Fri, 6 Dec 2024 23:36:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528213; cv=none; b=Kiz0EL8dKIKu/Wx2TbhjLWJRWs1rkEzyPznkwFaG37wR1ZS77nnls0MkZwSDabSwGM1FZuQZzAp9CuinffYsT8gc0TKfMS5R/2mGhoCk5XvsJfvSINE/CfeRh+ju/k6F9dMzAANUBC9PwacKaK0S3xzpRki4WVo1m+UeHIh4Tww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528213; c=relaxed/simple; bh=VIfG8jmuXuviZSVXGB//CY62k39Elp1RheGthqyOM9Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M0y4MNRZXuf2dqjLL8AlbfAYzoAxuU1Em0tn6Nk76MZriT0bloHBXdFbTGJjGVmX/VxT3WHe2KMPbhj2Kuv44zMX2hfWTrP/pYEp/M7U/X+wdP7x1yrZp2KzR8ctYXhJvn4avNloXSrz+IGqM+bBoJJ+UtR8orljlV9pEKRDdSE= 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=GxXNNw7J; arc=none smtp.client-ip=209.85.218.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="GxXNNw7J" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-aa628d7046eso376356566b.3 for ; Fri, 06 Dec 2024 15:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528210; x=1734133010; 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=oUlNbMqwz+xDVwPO4V5lwInDa87ZyAkls4oZqTyVXlM=; b=GxXNNw7JRRQGnQRQyw3V6m2wEAgrNQnZtF49KCTgVYuOJc2TgR58zGaeOBkF97XXJ4 Ip3HPjp3a4G1HvWuQ035bosgeJagMUFBugkreZYdHnbdUiD8+ZUWcLz24Ka0MWTMHg8G DzcOAFVjLj2ywUN9yUHOvGCcufMNv706We5SoCiaC4yZnO2f37QoGstKF77sGitPbHSD xVSwiNvMh/bVoxyBLqhN6khHZX5xa7ZLgslCuPMjLN8N7vcGikapS6T9Kg999wtFIaPZ S8keRMBNaF5wx4kpfzTB2dJPcsqQNnSNXLNgQ+Oja2CewHTE8t65liTqKW24ZWtwxd5Z m+QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528210; x=1734133010; 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=oUlNbMqwz+xDVwPO4V5lwInDa87ZyAkls4oZqTyVXlM=; b=TQLipvHwHBV1+5BQ3DlyaEVErZ1eCArU7rCgC9MpHQXkjHEBE90yU1jLJ8rWNhOKvC Nam/bY69VWbjCWjUPglqD/LAJSAWjGeeOSn1sZkjwU20MSpdNZ+bC8Bo+DjqFVo8Dml+ XAkrkOXC3nKCDcnUuIkpAf0A3mcd0QdL35Xf0nckcWNIvYTguv9LI6AUTPeKT4FB42In UiFCfCytkGUx420P2U4Wcfw0TJg1jvPHcSA7hTUXAdheaSoNWlI3AJ9kObXg6/W6oCjh OpC2Ti5wAQIn1/4xBzMLN6I/rrq5joJUpLf7eGHKv9cPWk0dl+dkAc1dMp/f87yMUJZN qg4g== X-Gm-Message-State: AOJu0YxpDg1CnX0G5IiouHWx96qyDqUHVwysFGq0hNrf0SkqBaKCP6UH d9gBu/ltmVPrYfDIkJoHSBSQt7juaQhrozc9bghVqi72pHgZ139O3Z92qjd6gYc= X-Gm-Gg: ASbGnct8B5C+sivmrsPI7SpZP3am1NPMKT2NcWMzNFRL2JRurASXzLkK8hL9hFp6hBh Pg+QLFIHx/AE2vOv9jt67Kc3dQ1aMt6FuhBwzSUnTum8+YXvanUtYs2bN4iPfCmOpz9rLfcKruU DadxzOSv93sVYuJ+rLf9Y3Gc+zzDM84Bvj3cw5RPN8ikc0UV98IcWLlfl+DjndZS4Ul4MJ4tU5h XcNDSJszKt8TCM2FAb5nAEbo2Zw+//Webd47aFXhrZBEuEGRSnBm8Q3QR11bVn77dK32wJ+zDHi JbFM26QsT0I3T7ipSqfsFU94pSA6n1jR+EbFikig X-Google-Smtp-Source: AGHT+IHvwaNATeeTM5HRzvoOdkVTS40mzQ254fehiEvCOn4TqMoWSJ7iTe9ZbwepErSHpBFgEkFd2w== X-Received: by 2002:a17:907:3455:b0:aa6:3b8e:e079 with SMTP id a640c23a62f3a-aa63b8fbf44mr348375266b.37.1733528209532; Fri, 06 Dec 2024 15:36:49 -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-aa62608d2f0sm302651966b.145.2024.12.06.15.36.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36:49 -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 06/13] multipathd: add checker_finished() Date: Sat, 7 Dec 2024 00:36:10 +0100 Message-ID: <20241206233617.382200-7-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Move the code that handles the checker_state == CHECKER_FINISHED state into a separate function for better readability. Subsequent patches will add code to this function. Signed-off-by: Martin Wilck --- multipathd/main.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 5f16094..354fadf 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2978,6 +2978,20 @@ update_paths(struct vectors *vecs, int *num_paths_p, time_t start_secs) return CHECKER_FINISHED; } +static void checker_finished(struct vectors *vecs) +{ + struct multipath *mpp; + int i; + + vector_foreach_slot(vecs->mpvec, mpp, i) { + if ((update_mpp_prio(mpp) || + (mpp->need_reload && mpp->synced_count > 0)) && + reload_and_sync_map(mpp, vecs) == 2) + /* multipath device deleted */ + i--; + } +} + static void * checkerloop (void *ap) { @@ -3050,15 +3064,8 @@ checkerloop (void *ap) if (checker_state == CHECKER_UPDATING_PATHS) checker_state = update_paths(vecs, &num_paths, start_time.tv_sec); - if (checker_state == CHECKER_FINISHED) { - vector_foreach_slot(vecs->mpvec, mpp, i) { - if ((update_mpp_prio(mpp) || - (mpp->need_reload && mpp->synced_count > 0)) && - reload_and_sync_map(mpp, vecs) == 2) - /* multipath device deleted */ - i--; - } - } + if (checker_state == CHECKER_FINISHED) + checker_finished(vecs); lock_cleanup_pop(vecs->lock); } From patchwork Fri Dec 6 23:36: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: 13897949 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.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 E44B3212FBB for ; Fri, 6 Dec 2024 23:36:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528216; cv=none; b=crqtM7mQ1DE60eyst5oStOVe+sP/6+TCdDdjHKodIhuagIHVaKkSMHXuT7Gxk6Zv53yktRkWtPqRjYvJB21+b8cxbI578bRNQj7NmZo5oAsHpCMnwhV6QgR65gPDP6o4Al27SYqck0YMGCsa0dMldSNvXSi/DvpVoaVMe2GodiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528216; c=relaxed/simple; bh=VM9RZVmeh0u/cxmPfPWbpX7ErJpy7NWNplo7By4btNg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YE03CVD4WzauLSKudfuu/ae5Jp+bft4O7i4c3gHTBO7ge9qrAszZZzt3zLhcKNRCOST3fI6lsFF8uGzib4BnXGzpH62E6jtUpZ7aHdpOkhrBM3SdRizVu76VaRGhxDmL6D+4SGCd13WKFEK4tagaBrfwmPoQWN2SmOytM27upyA= 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=bvGtm4ao; arc=none smtp.client-ip=209.85.221.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="bvGtm4ao" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3862df95f92so826437f8f.2 for ; Fri, 06 Dec 2024 15:36:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528211; x=1734133011; 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=+OACd7f0gCpXI8Vzu589HrhuxASgEy1RetfktqqkSpA=; b=bvGtm4aohcpJwZslBWAoxMRrKpvhhSk6c8YyiMuYnFFScUuAdr6iKC9rhzmw4/mIr3 uR4IINV4XXgzIYw5pTcv4Z+SdK4lOKzSeYk9A4T0rMfj1/9mxTDQLbPrVLYdK3z9gHJy 9pJ23HMNbPxflocgrfqTv50nvErwtzqOGE/7E7E3ZS5QNXa8pTPeYHdHARV+XCbbW1vw 2MbgZkzxhE3xPHF9PznXg9Ufzok8Jm3PHudElDw3O8GzNA+nUgoNBi031u2nliijBwlA ++Zgdosyi1dKlg6nLMIk9vxbeGniVvTQQYI7m9B1M0Pw0SoT+t8vK7ZyxogE6hbL0w2a NuWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528211; x=1734133011; 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=+OACd7f0gCpXI8Vzu589HrhuxASgEy1RetfktqqkSpA=; b=TUR5UPgHqFOL5wBM/ZRYdQE4VghfM9tfXyOqG9p2gwV7AJYqqm2waehIc6K57v+qpV 6ajQ80PlQ5Ghv0xEey5G9hujzKdu1ZcgdDBLybKuGhfBZPqHaAcOEyICNOLmtsfQtG2v GdABtFMUrFPOnSVOuY2hVvfBwCh2EDstrglLFbvVXOu+Y+5OEWVEUi6ITtcVST7EhPTj 2Tf3UsxJ6JuAwLi2OMRMbzqI0juLzEiJ+gInYzTUeF7jgDhnywgFzXKXFvZahEwaKxJj ZUp5pCGhapfaX5sKnMnAWIHUmlj138lmG4/9ZGcNIwHYfZGtex8MIMa0j08TODMO0DOD vp+g== X-Gm-Message-State: AOJu0Yw5JL9gbYa19TzVdBKD8Gc5CU2WRX20IUYBML0ZborPcB8RxrGd cVIpeLylmD9gC+J8UQlA3uNkbnQV12OeMW7k/a1T4qUrlCMvasaDeS1TkngHdMg= X-Gm-Gg: ASbGncsZ1NlO0EyE5fGcphBsr6zl7Q2E8jr4iyPs08yYvEsNXGYqRfYTvhFccNJggoi SRpbbqpsiybx0elsG3KH06aOuQP6QL8U+vBYuuPfLYc7kMhJkVuDgPrOzZWhLL1wq26xLCKV5ff 4OdR9Ur78JkCL9liNWVdDOzcoSSUCrmctojrEUW06wmvjSCp/9p2ipIOquDLSaF7X7aihGVWvwg 9EjXXjiH2Zir5dilf4H9ufPNjhPTWyaZVVPOM5aOqOqX81WcDH3CiESbOyBXDPRiEFFNFop/PKk VHfeslZ+fns0havaKSFUzun+/z5G5gNlmQA9 X-Google-Smtp-Source: AGHT+IGosXMY6GqEjLV+ilH9uYopJRfWOCU1igeSwhqUOUGKIJS+gmIHAzSx2x+Z5kviU3ih9xdofQ== X-Received: by 2002:a05:6000:717:b0:385:f4b0:596 with SMTP id ffacd0b85a97d-3862b3632ecmr3704115f8f.18.1733528210925; Fri, 06 Dec 2024 15:36:50 -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-aa625e92a58sm304239166b.48.2024.12.06.15.36.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36:50 -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 07/13] multipathd: move "tick" calls into checker_finished() Date: Sat, 7 Dec 2024 00:36:11 +0100 Message-ID: <20241206233617.382200-8-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-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 various "tick" functions will only be called after CHECKER_FINISHED is reached. So we might as well move them into the respective code block into checker_finished(). This way don't have to drop and re-take he lock when all paths have been checked. Signed-off-by: Martin Wilck --- multipathd/main.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 354fadf..7e844a5 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2990,6 +2990,11 @@ static void checker_finished(struct vectors *vecs) /* multipath device deleted */ i--; } + deferred_failback_tick(vecs); + retry_count_tick(vecs->mpvec); + missing_uev_wait_tick(vecs); + ghost_delay_tick(vecs); + partial_retrigger_tick(vecs->pathvec); } static void * @@ -3069,16 +3074,6 @@ checkerloop (void *ap) lock_cleanup_pop(vecs->lock); } - pthread_cleanup_push(cleanup_lock, &vecs->lock); - lock(&vecs->lock); - pthread_testcancel(); - deferred_failback_tick(vecs); - retry_count_tick(vecs->mpvec); - missing_uev_wait_tick(vecs); - ghost_delay_tick(vecs); - partial_retrigger_tick(vecs->pathvec); - lock_cleanup_pop(vecs->lock); - if (count) count--; else { From patchwork Fri Dec 6 23:36: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: 13897950 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 27772213E74 for ; Fri, 6 Dec 2024 23:36:53 +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=1733528216; cv=none; b=RM+RBvNvR9iAxx+GDbu8glwwDj9whiLxYU9473l01UM3rEAjGdtI3lVr/3SU/4/68gKaw0GYSOdwekBZRxkEv1lNZcWFUcuBzGa+aZnhfqkVVKsfRC8HGOwBKwNq/U6XL42ePi8knZgj4jD2vAH6trCofx269VBZyUk8aBItlhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528216; c=relaxed/simple; bh=QoYAfNYJvLd/TJckwCG64F8GWIrNQCyslJfU7rQGdjQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=faS+EBO1W/vW9mSaUT+yMF0cltbMpu7GKvW1N8mujc8+N0NELcTcbJevcIZH9M6xX04xnpVqWgk+wFlJ8zI8qcCcqMUGB44/uLrXWU6qOMEXC35oO4HsODA/AGpP3YljV5lZxiTgax/xAeIxTgYaZbWtT0uaLzQLinjjBqdlBi8= 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=H250VejL; 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="H250VejL" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-385eed29d17so2044825f8f.0 for ; Fri, 06 Dec 2024 15:36:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528212; x=1734133012; 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=m+ZChgxxwjJP0AvgnYxkAg/5ApCP3lML/endeze60rE=; b=H250VejL4wp7wwVKJ4N5ZE871i0Y58YEuSmhZapz4AjbCtjqOL70dKaZmReax4UJ1O VfLs7lxJy7ZKcCt/LuCplAI3ScrhUMg70OBci2rhz/o477sqRz1eV083qKVyLc4fxgN4 6phmQ3MmrsQlQadvFMobQOJyjks16NNrhPTD6qHiGWnA66xwsNUFSJmTElysEKv83MHC WvdKyoD3L3x5LQp2GgiXTPeCaNc+aT17unX5kQ94TvYnORAXL3DwTBcELp2Fq64uwiMP KMCboG6vkK5GgN9q5Mtm4X2levIY9++vOYPpKLS5wjEwfRfi1nlebG5lJYJU4yr8SLC1 fCig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528212; x=1734133012; 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=m+ZChgxxwjJP0AvgnYxkAg/5ApCP3lML/endeze60rE=; b=TsEfMM23WqofEUkoeqwq+9o+kTbOiKKcPVd0vIMqdy53uAsUsJ27FCtVEeDYGgmMOM mI6rMhFsLy04DEnGCdRxLF5puQZNJrbouzQSn+gDwoLJk6lJ7DIm6E7VVoBxm8nfjMLs lih6p4KFYcSP3Jd8UIDY3nsTELdhHKCqjbLNfvPiU4ihc16tUa5DLps1Eu6mLCfiUNyH AvFy6cJOCEVD97ykHMdmW+zpxUar18YviWWRXdBzcoFBce4Db49JovTyI943iF63IlON HZ57CAaidquIcJSoZ+g5kI8Ww8htKyBQk4ttK/kioPh85ebopz0XGTYW8XQxntBpGnkY 7bcg== X-Gm-Message-State: AOJu0YykY4M7VkIGyM0qx0PaQX5BG8np6shv/51XlnIb/7iFReUFnkW6 GmmegU+YPK8Cy6msCjqlHz+qNj7CzmBRBzE6+Jnl5hiXXgWIMd5kStwL2HGoiRCLEE0W2y9bEst U X-Gm-Gg: ASbGnctHDQL0IrWsFmfPaWp9c/ZYhRUXRlJYt9YYjOkqTRSbCR2taqRIOj2b0txnsPw EAN3Aj41Mf11tN1FQh3KsODdHoedOQEqRH6/MAm0QoxtDxu7sJ3gp/GiHYA28oz3vwiL6oNF0uV q/hihg/cmVheuJizl42Zp8ewqQjyLt12vjjkQT5RdvEOvMsv6wE2MkMx/wSdnjpTPdFLXiZzeez aejz+slHscv4g/CGhD74BxyFKsnV/bnNZPGJdympyHdRycsNW+EhWjaj511ry4eqM/umlSCrR8+ U55SUWFE/YNCV+IGi6cZe2ou7STgrdx1HCnS X-Google-Smtp-Source: AGHT+IGiwDtJPqAnYyN1Az7PDTtB4iIJ98t516OYQA8CbwgJehaPXwjVAlp/6kTe+F2WykHWKdPSYA== X-Received: by 2002:a5d:59a2:0:b0:385:df44:12cb with SMTP id ffacd0b85a97d-3862abd8ac0mr3359714f8f.0.1733528212340; Fri, 06 Dec 2024 15:36:52 -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-5d3d871f1c8sm495561a12.13.2024.12.06.15.36.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36:51 -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 08/13] multipathd: remove mpvec_garbage_collector() Date: Sat, 7 Dec 2024 00:36:12 +0100 Message-ID: <20241206233617.382200-9-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This function duplicates functionality that we now have in the do_sync_mpp() code path. Remove it. Signed-off-by: Martin Wilck --- multipathd/main.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 7e844a5..43f6cc8 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1967,24 +1967,6 @@ enable_group(struct path * pp) } } -static void -mpvec_garbage_collector (struct vectors * vecs) -{ - struct multipath * mpp; - int i; - - if (!vecs->mpvec) - return; - - vector_foreach_slot (vecs->mpvec, mpp, i) { - if (mpp && mpp->alias && !dm_map_present(mpp->alias)) { - condlog(2, "%s: remove dead map", mpp->alias); - remove_map_and_stop_waiter(mpp, vecs); - i--; - } - } -} - /* This is called after a path has started working again. It the multipath * device for this path uses the followover failback type, and this is the * best pathgroup, and this is the first path in the pathgroup to come back @@ -3002,7 +2984,6 @@ checkerloop (void *ap) { struct vectors *vecs; struct path *pp; - int count = 0; struct timespec last_time; struct config *conf; int foreign_tick = 0; @@ -3074,18 +3055,6 @@ checkerloop (void *ap) lock_cleanup_pop(vecs->lock); } - if (count) - count--; - else { - pthread_cleanup_push(cleanup_lock, &vecs->lock); - lock(&vecs->lock); - pthread_testcancel(); - condlog(4, "map garbage collection"); - mpvec_garbage_collector(vecs); - count = MAPGCINT; - lock_cleanup_pop(vecs->lock); - } - get_monotonic_time(&end_time); timespecsub(&end_time, &start_time, &diff_time); if (num_paths) { From patchwork Fri Dec 6 23:36: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: 13897951 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.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 875821C548E for ; Fri, 6 Dec 2024 23:36:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528217; cv=none; b=eY9w3TscfZAupth1lQV7bSH8r8ifU8ph4gIUp52b+BSdJH+EacMzMtZuDXamDM4cfQYkacsqlJtD6eZ0ZDonh01uSeYBRE2xS66uXUZU+BBflyMUUTgi4HZToJ1bpAepPR+zbutnaMhIoY3c7Oe0VtCsAOAhh7+0R683+PmoPXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528217; c=relaxed/simple; bh=pMVMuBzDze1MWK15sIgadvckJC/NFQmCszLmIKyLMBc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=trj3/EZdmRBgt86MixwCa/FgLEZt1KC8EWkOcybkIVGdyN+SP1AxV9YCuGZTMpcqoeBJMiCMul7xinZHmgaPN7RGUJly4RfIjh0FklogJj997nCT/dwjdYYMROjWNGoG64P4EgHrVdhRztR/QJ2M/0fmSGoMkRNN0Y6lnD3H05I= 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=gtYqZwk2; arc=none smtp.client-ip=209.85.208.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="gtYqZwk2" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5d1265ba5a8so2873906a12.3 for ; Fri, 06 Dec 2024 15:36:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528214; x=1734133014; 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=HiNL2RQ+pkTynN7quJ/s9dBLGd1J9lVKVh86hlt8Mm0=; b=gtYqZwk2/t2gEaXK3t/kzZPpBIljQLoqCzy5EIXv02Vr9aK57uAIJka3I2gIsOIvq5 8HdlDA+PGzBZ7SeHGOA7d4W0xzpX1QGxjb30xD9AjWJTailfWWQVe6wAhzZ/icdZn8eL Rnn+7eZ7B5P2nE1nwB7dml2rJlElz9iK1e9I9WnGKGD/6c2nCQXyBAchYqnECzx6SWVs WGuLVI7H8CP/t3mB+WkNGyR0jwfrt9ribUruvkfSzRBTpR/GP5GlxOl6C4aHqS64dhUJ ck8+tlPKaSpviTsuY8yvZzw7X+Wtze1KYafwgr66b9bkR9keJAN1IEggEnELeXAQNL5l bW+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528214; x=1734133014; 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=HiNL2RQ+pkTynN7quJ/s9dBLGd1J9lVKVh86hlt8Mm0=; b=w9pi0Y0HBzxBtPo1DFaylQmkn6B78kGBrECMGE7sWwG5uAlb8MwnW2x+PkxjnXR30v +sQlSqjCOTqfFdVQFAlPguyKLBZIXh86VWaBxV8aaNlUnaDwLWC4B503i79l3kg+hCFi hb1ZCnsUrhBlLPj6UaWTMCxJ0/pDUxt2f+LixoX592dL/1MhPJhmWpGKk7htXePy/P/a sUP7Z+Jzs6r81iT/zsypCi5wT7mxrRVcJyMNrLreumpyNleL9mt0ficdzoANnUhtIsXf B6XoBh4fogO+3XMlhqkRscJuTBZ0Wf6L+gBmFtROGpb993sHK7b57xYC5awqPoc/+gxI HKjA== X-Gm-Message-State: AOJu0Yw7tZEBgMlgCEcN8iPoItRhaDg+e/5tGAeXXOAg/AxdDov/idbz A0Z/tCTJAcSGC/K2Jv+rA5SeRyH+6L2ym4EFt7/F70f9gTbO0fZnojfMDuv1BYs= X-Gm-Gg: ASbGncvxCNi19B2TnoL2i/ZCF7Yhr/UscE0KvrRspUxmgxB8Rpngrfts5+4Nv9CY9xw ufwzg7f2CD3PySvzSnc7otyJRneajuaLpAcT7SwHaRjFptoIxuJnK9FGOn4a4f+o07SefYFrLXO J549Wlj2CDbufCztm0Wn5hyNLUr7gI4V+78zinI153RIXOrWBsw1MYL2IDjiaXvqUGImbe4eeec TNQBdfgzxGzQyQDDD4lZ4RKoH8SI2ixWvCieLW+ol+1VDwNDrPJwAq7wavDlJxI7TXyHhGzQMAq r4b8JgkMOHrWXLzba8+JfexgHj+Ak+kYbiK4 X-Google-Smtp-Source: AGHT+IHSAbrQQnEnp+0CE1G8V6XR/LmWF+w06c5oy/GyyraD/m/5A8qlf2xqq68mVNKwkbjmmeY6Rw== X-Received: by 2002:a50:9fcf:0:b0:5d3:ba42:e9f4 with SMTP id 4fb4d7f45d1cf-5d3be6fbcc0mr2862900a12.23.1733528213669; Fri, 06 Dec 2024 15:36:53 -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-5d3be740b07sm1622616a12.70.2024.12.06.15.36.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36:53 -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 09/13] multipathd: don't call reload_and_sync_map() from deferred_failback_tick() Date: Sat, 7 Dec 2024 00:36:13 +0100 Message-ID: <20241206233617.382200-10-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead, move the call inside the existing loop over vecs->mpvec and call reload_and_sync_map() from checker_finished(). Signed-off-by: Martin Wilck --- multipathd/main.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 43f6cc8..8425354 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2058,32 +2058,20 @@ ghost_delay_tick(struct vectors *vecs) } } -static void -deferred_failback_tick (struct vectors *vecs) +static bool deferred_failback_tick(struct multipath *mpp) { - struct multipath * mpp; - int i; bool need_reload; - vector_foreach_slot (vecs->mpvec, mpp, i) { - /* - * deferred failback getting sooner - */ - if (mpp->pgfailback > 0 && mpp->failback_tick > 0) { - mpp->failback_tick--; + if (mpp->pgfailback <= 0 || mpp->failback_tick <= 0) + return false; - if (!mpp->failback_tick && - need_switch_pathgroup(mpp, &need_reload)) { - if (need_reload) { - if (reload_and_sync_map(mpp, vecs) == 2) { - /* multipath device removed */ - i--; - } - } else - switch_pathgroup(mpp); - } - } - } + mpp->failback_tick--; + if (!mpp->failback_tick && + need_switch_pathgroup(mpp, &need_reload) && + need_reload) + return true; + else + return false; } static void @@ -2967,12 +2955,12 @@ static void checker_finished(struct vectors *vecs) vector_foreach_slot(vecs->mpvec, mpp, i) { if ((update_mpp_prio(mpp) || - (mpp->need_reload && mpp->synced_count > 0)) && + (mpp->need_reload && mpp->synced_count > 0) || + deferred_failback_tick(mpp)) && reload_and_sync_map(mpp, vecs) == 2) /* multipath device deleted */ i--; } - deferred_failback_tick(vecs); retry_count_tick(vecs->mpvec); missing_uev_wait_tick(vecs); ghost_delay_tick(vecs); From patchwork Fri Dec 6 23:36: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: 13897952 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.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 C1BDC213E8A for ; Fri, 6 Dec 2024 23:36:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528218; cv=none; b=ITMLgyf0XqTRssFFX67ykU7rrDe4IEjUMYvrcPoX4n9V2V+FpfQdSgXwakBCU86FcQzWFcDzaxk/5sb/kxAAIpfrxUDPRS6bBchnsDKAwxxqaEhQQM9G7esrITvuz6r1p925p1a/KWsEee2cEpwMQg1rM8kC5o1btEolBnIIak8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528218; c=relaxed/simple; bh=l6SC/jpGQaefnzqXbcgUuZAJpoows7qZvlwO/1AzCaE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t4/EUWaFkHGdiFS08AVXP6Wicer9eE4+fLQVB8QOouE3ybE+3UBxZAvosVSbi5UjzcoJapcF74i3HwBDYxh9FhcJjG6hAuU+JDy93aksbZRh6+g+5nc5VtMf/oC0LM8wILmsKehdh7rXErzrZ2A1sqLrXvAQE/J8Ld2Zlnjwbmo= 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=eZ7u2v8k; arc=none smtp.client-ip=209.85.208.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="eZ7u2v8k" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5d10f713ef0so6657980a12.0 for ; Fri, 06 Dec 2024 15:36:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528215; x=1734133015; 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=v+d+XUK832XvlbtJeH+2ZHBRzFYINiQsf7HIrK0yqbA=; b=eZ7u2v8kmTL/nwPgAfD/gwS8a2Wv/pHNWlhDBm7JjO4Za1GCL9P+rhDr5ASI7atjPd LMYe65obPFpxWOJOodWurN4EVZMlUJVMx0DiC2K3xLtaWFIgq57l8Ux6lg/YlZXnMa9h iCfUuCreJafan1huUfdUrMwzMB2n2pQbTQYhLxmL8DtiwABtWb9AW9+gXi4lmTwtO6JJ +gcc6h4cbi2DU+OZfVUmpPQfuHdLcVZjM7KUaqve3OTQwfg9usb9GYQESPK3JShiD7iG hQnWDFPf+10RGsRElmPmjMz4rAu6FSS1HzjF/6+CKWxRFnYaSLLBa1eQtUqjVZoqG6fS Z2mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528215; x=1734133015; 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=v+d+XUK832XvlbtJeH+2ZHBRzFYINiQsf7HIrK0yqbA=; b=DeBnPZci2erMNLAfkGgK88xUSSAW5sUCZLmHXPrMmkyDM6qEHLZ13rPV1l5K4MM66s uASQ6YVfqU7JsqsV5Pqgm+XnMqlFO7WXkZdVpRhcF2UhO5bsdOna7YJ3scbTTZQCw9b5 0sbAIVoS9Di8Pu32LgY5UMgAFBnQq0ZHL+cdeG1sMUQws4q3WzpLb4ffEIyuYs+ZKt+9 0sEl9kr8n/8pnOQr8nxpRb7BVn7ahAPq/CcLWxBSNdE8hTOIqoPz2L1cCb0GZtgEnzTB riHURQxNeZpDfChR9YtS+9PQUJZ9uiEThUVmRW/AXjBjASzC6m0TfSutMtKXcrplO7iz f4nQ== X-Gm-Message-State: AOJu0Yze4+8GHKkTSrHtu8CVuKyLwhb6kRqg8yhr3IjQxm1VaMS+h7l3 g+0K2yte7e+bgGM2cemj8k2GfzyEmwqZxSUMm/Dmw1nVt39xzmbfwO+2tTk2shB/5seTJxgdOK5 K X-Gm-Gg: ASbGncsn8jDtLaPu0/MsNH/Xy0WIQdmcz51qblKbR6d0pAgW6xsFcuL7tqEDHcR2gVL nIxuHIDijzx5ytzxOXOD0aQqIdNbq+7UlPdmZ+7WZNWC5TJDpW3sIt4PFSBg+aH26Bo8KDvJW5Z rv1fqPsssbxpP5tzC7hjG7YVjQ1uw5AOqoW0leE2YWpqwa7bG2uRjrEurt5SH1E4z/H9xt9gJoa c7RpMbAfBNCRljQRlW70IpCySgu0N3yFYaCy4Fm8buF2bmFWeTQ5NjLNkULOxZ1abvrhNtYKr9L +b6mlmehi+qA30gs6A6HZk+f+KqRO7nPRDAh X-Google-Smtp-Source: AGHT+IGlXAswTLo7zT5zN3vW7Oem6p4lpLTr2qH9kyRUpnPaTKEfsd/bZoT9W8Hg+QnybOiUPN6KbQ== X-Received: by 2002:a17:906:8a4a:b0:aa6:19c9:ad0a with SMTP id a640c23a62f3a-aa637626ac8mr476283366b.29.1733528214827; Fri, 06 Dec 2024 15:36:54 -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-aa625e4db4csm302704766b.34.2024.12.06.15.36.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36:54 -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 10/13] multipathd: move retry_count_tick() into existing mpvec loop Date: Sat, 7 Dec 2024 00:36:14 +0100 Message-ID: <20241206233617.382200-11-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-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 | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 8425354..4cf5493 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2075,21 +2075,17 @@ static bool deferred_failback_tick(struct multipath *mpp) } static void -retry_count_tick(vector mpvec) +retry_count_tick(struct multipath *mpp) { - struct multipath *mpp; - unsigned int i; + if (mpp->retry_tick <= 0) + return; - vector_foreach_slot (mpvec, mpp, i) { - if (mpp->retry_tick > 0) { - mpp->stat_total_queueing_time++; - condlog(4, "%s: Retrying.. No active path", mpp->alias); - if(--mpp->retry_tick == 0) { - mpp->stat_map_failures++; - dm_queue_if_no_path(mpp, 0); - condlog(2, "%s: Disable queueing", mpp->alias); - } - } + mpp->stat_total_queueing_time++; + condlog(4, "%s: Retrying.. No active path", mpp->alias); + if(--mpp->retry_tick == 0) { + mpp->stat_map_failures++; + dm_queue_if_no_path(mpp, 0); + condlog(2, "%s: Disable queueing", mpp->alias); } } @@ -2960,8 +2956,9 @@ static void checker_finished(struct vectors *vecs) reload_and_sync_map(mpp, vecs) == 2) /* multipath device deleted */ i--; + else + retry_count_tick(mpp); } - retry_count_tick(vecs->mpvec); missing_uev_wait_tick(vecs); ghost_delay_tick(vecs); partial_retrigger_tick(vecs->pathvec); From patchwork Fri Dec 6 23:36: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: 13897953 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 EC92D213E7D for ; Fri, 6 Dec 2024 23:36:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528219; cv=none; b=gs7QJLBBCaCyIkI09e83ZlGIFklY78Ea0XwmEe7kNZbXvf0Ex3sYIvKMtJUkZ5ae6hrFbu+p/1MzmJ8c6AUqQRbr+7yQ5ZWMjxWEO9ANbHBaP5C5oG+m6YN5VoV4hL/MunIaSi/Qt+cWkbHLJlEI6jKBpzqsivWQPACFwE6VSf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528219; c=relaxed/simple; bh=GfC1nm9+X/faPxfcqZ/PB/BecgIqy52UXFPltpeQmBU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Igusd4ggEh6QCGXoTrnNz8cE356xkzeKhkcvoyWDNmM9nbaPG543jWUTO2zSrZgu4GARX1uGZwKwrqyKq7S9s9JZqQ5FPTaosTfa85P/oFRGau0co5UGU/Tgxug9be/A/xNeI9v31RWBGSM7lvRbuN3dcKK9PpryGOn5hgCD8ag= 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=cACdxTFf; arc=none smtp.client-ip=209.85.208.54 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="cACdxTFf" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5cf6f804233so3108715a12.2 for ; Fri, 06 Dec 2024 15:36:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528216; x=1734133016; 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=QJnxfetFbqLwprc1wQl+h8lTOcL+KxH/Cdw1Ln3cl9M=; b=cACdxTFfEIpO1HyxjH6uObTZJCPclD0meIa7ITq+SgDkuLTEo8vM2tKnABuwZzqj99 JteoqISrRkjY3U3nJrx5oettUq96cfkBpCm8vi+A6W8sh70NnOVNwNO7XBSo9jm/6aSy QETAr5dYV8lOjrpWQvanNjGcT/AzGDHL7zItRb+1cS6DwljL2FyGTFVNsKjiEIAwH/BO Z3dCeLEjYx5ZBVFRTjnd23rxU0nTov3buoUilftmYFs9TEPhorib3OBCtB7sQYKn+RfJ Yt3SmT+q/WUdMAKRfpzuO1vuYNsnDeUAGwN8yj/duAqPNpyR9fENeEzAA1IPhbqQiAYD vCLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528216; x=1734133016; 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=QJnxfetFbqLwprc1wQl+h8lTOcL+KxH/Cdw1Ln3cl9M=; b=FqF2zjZHdlFyNH/NlYxGF6vYoVvb/RN/qenOjj8cVnzLNJfCEfzA3H46MO3TcXt7wZ 9mypJk2AKviDe8fLjdD0wuIEwqBeFmhaxzacGGpjqX8MmkW7z2JaRdgkjEC/Ut8SZpZ/ MfD80Ye5IW8mHlgLjnP0fYtN/3oCk6oTmtGJygRtNzCj2UIAz3IbV7PhNhaNli7pGs3U qYpJChWS8OMDwOJbTnnK3uhcY/GTrZ/2y9ZfRuYUaLhwrjCy+kWIMf68L7Tuq9015N6M 6m3P+wrOku3bJ34iLpl0iHyoD36jtNcnOunA953WmBZPYL5p5nVZTS3YHLkUZn/f0ekN Hmag== X-Gm-Message-State: AOJu0Yz6+3o7m4Ej0DzuhksBNSk6PqstQmXSnT2x4kyDc58Spt11M5L7 1XB6A8K7Lej9v2qsMtrSl4eYKTc0ygCzw2wCi22dSfhb/YfIocRfEkKTjQ+gxII= X-Gm-Gg: ASbGncuqOLb1raKy8tpDnULsC+UlJcCStvQU6ELZAhCWA5heO0dx+HV67LTFo98ziZd F+4zZmGWqob1J4lHRNEJf2TW/3uSfP/5CHvWRRMR+NhK+472f2KTaFiC1Y9w5symNgpVJHXTdqF lJC36HRc3fzZYJBJNQx6dTTiqUmEGRgYv3MNl72qAb+yTh8GVgCoOWOBcO0kqssCcpt5wYqfnpO 98iSEhfBh7h/4eYCF9hADSBOGmV3zVO2J9XGu8i4RKgpnkj7JnBvujWvJgz+KCH9LMqcUK20BbB 4fw90WLCUExU6hyoqzvndyHsyzaDwQSzyjc9 X-Google-Smtp-Source: AGHT+IE3q4iPeOxtWqzRHx9ZF8jWFgMPR7ZFBK0DDS0xLNWwEcJdAKTFUkKNcq86oFShA4b60No35A== X-Received: by 2002:a05:6402:2749:b0:5d2:7270:6135 with SMTP id 4fb4d7f45d1cf-5d3be75625emr5076828a12.33.1733528216065; Fri, 06 Dec 2024 15:36:56 -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-5d3da2c242esm314268a12.33.2024.12.06.15.36.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36:55 -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 11/13] multipathd: don't call update_map() from missing_uev_wait_tick() Date: Sat, 7 Dec 2024 00:36:15 +0100 Message-ID: <20241206233617.382200-12-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead, check for missing uevents in the existing mpvec loop. Note that if the uevent tick expires, we need to call update_map() rather than reload_and_sync_map(), because the paths have not been added to the multipath (see wait_for_udev handling ev_add_path()). Signed-off-by: Martin Wilck --- multipathd/main.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 4cf5493..4478cc9 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2011,29 +2011,19 @@ followover_should_failback(struct multipath *mpp) return 0; } -static void -missing_uev_wait_tick(struct vectors *vecs) +/* Returns true if update_map() needs to be called */ +static bool +missing_uev_wait_tick(struct multipath *mpp, bool *timed_out) { - struct multipath * mpp; - int i; - int timed_out = 0; + if (mpp->wait_for_udev && --mpp->uev_wait_tick <= 0) { + int wait = mpp->wait_for_udev; - vector_foreach_slot (vecs->mpvec, mpp, i) { - if (mpp->wait_for_udev && --mpp->uev_wait_tick <= 0) { - timed_out = 1; - condlog(0, "%s: timeout waiting on creation uevent. enabling reloads", mpp->alias); - if (mpp->wait_for_udev > 1 && - update_map(mpp, vecs, 0)) { - /* update_map removed map */ - i--; - continue; - } - mpp->wait_for_udev = 0; - } + mpp->wait_for_udev = 0; + *timed_out = true; + condlog(0, "%s: timeout waiting on creation uevent. enabling reloads", mpp->alias); + return wait > 1; } - - if (timed_out && !need_to_delay_reconfig(vecs)) - unblock_reconfigure(); + return false; } static void @@ -2947,9 +2937,16 @@ update_paths(struct vectors *vecs, int *num_paths_p, time_t start_secs) static void checker_finished(struct vectors *vecs) { struct multipath *mpp; + bool uev_timed_out = false; int i; vector_foreach_slot(vecs->mpvec, mpp, i) { + if (missing_uev_wait_tick(mpp, &uev_timed_out) && + update_map(mpp, vecs, 0)) { + /* multipath device deleted */ + i--; + continue; + } if ((update_mpp_prio(mpp) || (mpp->need_reload && mpp->synced_count > 0) || deferred_failback_tick(mpp)) && @@ -2959,7 +2956,8 @@ static void checker_finished(struct vectors *vecs) else retry_count_tick(mpp); } - missing_uev_wait_tick(vecs); + if (uev_timed_out && !need_to_delay_reconfig(vecs)) + unblock_reconfigure(); ghost_delay_tick(vecs); partial_retrigger_tick(vecs->pathvec); } From patchwork Fri Dec 6 23:36:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13897954 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 269B5212FB3 for ; Fri, 6 Dec 2024 23:36:58 +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=1733528221; cv=none; b=DWltz38j9jqZ5xAue1upIqdQ5A2sFaRmDWsGnsdce/K3Zly9IqgWTADLwCWU09DVR6MaYUqu+YpsCMC/YzkMEwZ82yrlYj4kw0IOyoMIzKo4Pf40U/LBEm54VlKU35te0sxcMnyXaNChXefSWziZv04mT7VN4L8Yp4sk2ly1eNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528221; c=relaxed/simple; bh=TRqhWHgH+AzImzjo3waFv0T9gLn7dfgtOGPpGqmkugc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VnNoc4bxl/U543VBU/qgA6ZVWCkwqGvxfkzpAvnCzwtkZYx+q32KwIikzwFDJ0RU+18+Mc/hjnS3fsToMoRQSb+5s62hmg5pseAMK0JyvTT0sz0IMVdfb0v/1rH93+gnnYHzWzde+RhxDPjiZtxoPMs/hhiLP2QC+EI85YBahPg= 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=TaAZgWlb; 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="TaAZgWlb" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-434e84b65e7so1976845e9.3 for ; Fri, 06 Dec 2024 15:36:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528217; x=1734133017; 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=u2Ee4y7zBb9XuPKxkrgzZL0Igd4w44GZZQWAh8Lp0rs=; b=TaAZgWlbObLIkN1sLbYoiUr9OdcelfXBrvKtF5r3tXVWFRmkv1KZVkfqtJzmOL3n72 Cdl0Ax3ILX/yeuGyGw0b0xbJg5nW9zoRej3FDWe0WCIh+SVuZpSoZVxeY7haQtxfRMCU b86pMMEHdI9RtXZ6M09QxEL1IO3pXC2Z7y464fOPDUMotcZiUgBkFLSGMwHvsPx6A4Al I3JJpsfs9WY7omsZHrlVvu/LGY6SITTHr14i79z50p3Eza9ZzDzHRPt19JA8c07rZqO1 4s4DVXTNlozTmDzdlsmuUICGJp0Vm3UNoX5w59FlfzD0slTACe36StuYO/gY9DQ8/TeC wZXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528217; x=1734133017; 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=u2Ee4y7zBb9XuPKxkrgzZL0Igd4w44GZZQWAh8Lp0rs=; b=I01/IiIUNrAl1/yQprcpqQsZ8x7vB7h4SZNUv0zjGPHapSn9j13yLd2dG5FKG+LkGH ytXJakHplmHALzH0wv5+u+XoXMIJT7jKJYtVSpbfWQbWoxiL/9+b5Pg5uROXYCHOASBJ 92FAheg4e8daDXcBKQ70SxVQ2fXvUHoHy4jp3rLecc3iH88RtF7X4RQwuWFLwF2XKuok +oQ2nLYTCgxtTGxA82ewmx3uFzMRSTQvOeANS79B2gSlhVtRN/sjtBqZHwsbUq7Urf+A jESqNHMqJvfcM8norFBn2r5WJgt8GpkS1asQMuhhKrQliPZvT3kIZ6zETo6/aCfH4GMj p57g== X-Gm-Message-State: AOJu0Yx87Tfeoby2c7DHS0nsqMvHKdpojKXulXynYtTLCK2AQdIUQg6H pw4Ic5R7cFfqTMrj0VfLR645/+iem+JaqmmktJGWcnVWxbgHJxOfW/ltxKORKelL2yx+T6fCYji / X-Gm-Gg: ASbGncsD114MjfLePRbcVp1w32/tlZ7bGZOW1luyCMzcwso51cPwf2dUjzYETg4ZRl1 i0SwH/g71G8F6vTY8bVdyjaO6m9w6/Hml14zcxRbeHkTX5OLx8yk3Fy7mw/rASblu5hrK5bhpKn MlWPD5tIYmffELuFZtKnJSaE/CW3VklnYbAGOZZw2aQPake4VYg/Y1ALyPHtqQkddxdESqvZkC4 9iwAJ/mXVHkJ9x8bA094mFxhvQS8ehVGPO7t4vCKDa9psV9F45+BE4rTiHpxFvFOYzXMCnr5WID iW6Ms2tVcuGPrwx8M1VOa3dgl3NpK/keMhPG X-Google-Smtp-Source: AGHT+IHtWenoLuiqq6p4/lFYrzNPq5L5jEdRZUypKD55JtdTyC6H+FmmXmsh2s/GXNaq5bt1gYdV6Q== X-Received: by 2002:a5d:6c6a:0:b0:385:dedb:a156 with SMTP id ffacd0b85a97d-3862b332737mr3863032f8f.6.1733528217243; Fri, 06 Dec 2024 15:36:57 -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-5d14c799224sm2705203a12.69.2024.12.06.15.36.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36:56 -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 12/13] multipathd: don't call udpate_map() from ghost_delay_tick() Date: Sat, 7 Dec 2024 00:36:16 +0100 Message-ID: <20241206233617.382200-13-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead, move the call into the existing mpvec loop and call update_map() from checker_finished(). Signed-off-by: Martin Wilck --- multipathd/main.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 4478cc9..e48fa79 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2026,26 +2026,17 @@ missing_uev_wait_tick(struct multipath *mpp, bool *timed_out) return false; } -static void -ghost_delay_tick(struct vectors *vecs) +static bool +ghost_delay_tick(struct multipath * mpp) { - struct multipath * mpp; - int i; - - vector_foreach_slot (vecs->mpvec, mpp, i) { - if (mpp->ghost_delay_tick <= 0) - continue; - if (--mpp->ghost_delay_tick <= 0) { - condlog(0, "%s: timed out waiting for active path", - mpp->alias); - mpp->force_udev_reload = 1; - if (update_map(mpp, vecs, 0) != 0) { - /* update_map removed map */ - i--; - continue; - } - } + if (mpp->ghost_delay_tick <= 0) + return false; + if (--mpp->ghost_delay_tick <= 0) { + condlog(0, "%s: timed out waiting for active path", mpp->alias); + mpp->force_udev_reload = 1; + return true; } + return false; } static bool deferred_failback_tick(struct multipath *mpp) @@ -2941,7 +2932,8 @@ static void checker_finished(struct vectors *vecs) int i; vector_foreach_slot(vecs->mpvec, mpp, i) { - if (missing_uev_wait_tick(mpp, &uev_timed_out) && + if ((missing_uev_wait_tick(mpp, &uev_timed_out) || + ghost_delay_tick(mpp)) && update_map(mpp, vecs, 0)) { /* multipath device deleted */ i--; @@ -2958,7 +2950,6 @@ static void checker_finished(struct vectors *vecs) } if (uev_timed_out && !need_to_delay_reconfig(vecs)) unblock_reconfigure(); - ghost_delay_tick(vecs); partial_retrigger_tick(vecs->pathvec); } From patchwork Fri Dec 6 23:36:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13897955 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.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 6D226213E8E for ; Fri, 6 Dec 2024 23:37:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528225; cv=none; b=brXncP97Jb7Nqg3i0WznFXpSTKVwcbaLvVPrXfCDMxvyQBKD9cs5tNzdo/VdjlxywDK/mrBVuUMMqEEv4kRNYnvcvANfqsXJR9ICnyfcCbb/Dhf4tM44lFY1xNaY8lWB54EI+PzhhU2lcSV/FLJeXfBKZo6g1yNbEhjMkU+iezk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733528225; c=relaxed/simple; bh=v03/2E5UHyrKAtE/Wf+QAqPICQVH3pcMfg45GK6zrGI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jtlfuXqN4xqxBgmZv5IlmfNxXoOzG2sOuW/hMzH1y99OkHke19E0csgSr1MQgpE96xfasiVNQIbn7u9TkE8zSUAzF0ZFQHNtYZ+LOLsr4Iin+EdBPXl4RwSdS0HNjucA1tqa8tacgiyLjKPrC19VLvqlwuxR8x4HNjp3Xboaebk= 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=P8bGJWx/; arc=none smtp.client-ip=209.85.221.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="P8bGJWx/" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-385df53e559so1870193f8f.3 for ; Fri, 06 Dec 2024 15:37:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733528219; x=1734133019; 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=Arw8KiEgZEyIOEWH9GlV55ZY6YvkqG5QEueUyzNbHoA=; b=P8bGJWx/Q6LlDa0LVABZOQu+5vDQq+N2CNqM/Pz6zX6EBNBm19JMANNkjB7+A37IjM MA1jaDSkdw9vQum7T81NK9eF3MbCJZXcE1y1iFshSJcdjDZ6Btm1emWmBeWKgG88j1sf 9gx+psBgVemU3VVxDb2SCrU98U0gS2eydbFwj1oKJIFzMC4FnIrua3LGGUqIgndCMWP3 W9qpAbK1Ag1IoBAVgjGzXqobbQmksA9FZauLicX4YfOze6miLEkUgIL5MO1+FFGV9vk9 /qUqmeFOQCZrYwp4wvi5FTdwZ4jZcojRF+TcBwVod5Ees2qVExl9KB7TqpbupquFKS1j javA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733528219; x=1734133019; 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=Arw8KiEgZEyIOEWH9GlV55ZY6YvkqG5QEueUyzNbHoA=; b=czC33L5aFpULPLyidgq2WlH9ngQIj4foq1ENgZPjMA5tgxHTHmIt+5uIT/iDfud3MA y/F7/FGsXIApVrIT0GZSVxu26OKznX5+nWw+S/HwqTlDVpUkn+A1NyLxABMivpaH09sV HlKLbV5jr80ReRYmgd6ssBA/UlllUZTNnzLChyiHfI+BlUW0u+QPtmicreuh6nZOEMFP Kw+VF6zEZTf7baQdk+1GnmqkG2iQHlfx71DB6CzwkJuMTg/gIElIgyEojGt+CU8rzQoB tBHDyC1ygCtxMyMixn8GTKE7/w6VnLy82FFjnMVOMsiCTEbum22w8SyNrrqMg0vOPRMM yLrg== X-Gm-Message-State: AOJu0YzUFJ2mFRRHhWWQxUX+s6G9vklGcz9bGkSiKJ2EZJROjZ5qSg1O ibdUJqbYN5fHHlg3ZqrID4Xm75/ArprfXcb2+lbEwnKzrI6gXPg5NwRPsZkKpbU= X-Gm-Gg: ASbGnctbnSZlXlAwEZrwkBMVx4C36r7ZLBapNAG8gq8gFMKG4QLPEWrknwH4VGnylSn Udx/wlksWyW306I+Vq5aVAFFQdIxbliNhgCJ0FV/lCf/gNPDnk3GwvxNmUVtSPhNPYfXB7soi6j uZlZWLyMwL3mtpme9XlW72SR921HsWlRDIxotwh0FnELz2SOhc+KJp5grGadNxJmuwUafrjfRqG m+2JTVQqt14TBFPuETIXh5vA7UGFedZ/GPzMPryU4pQo2yVqGKI1PJ9FDgN+HEjijkfPJwD02Ih giEs45jXnk6wj18chtSqOszjwapFdqvuGHjP X-Google-Smtp-Source: AGHT+IH4eJ1YkK7JChR1Y7UZNcTK8xAe0vNju7Sy6x57FOw4dEyQ4qWk63+DugyXsAXXPkIHOFEyxQ== X-Received: by 2002:a05:6000:2d12:b0:385:fa33:29ed with SMTP id ffacd0b85a97d-3862b3cdb30mr2799315f8f.47.1733528218647; Fri, 06 Dec 2024 15:36:58 -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-aa6260abca2sm300927666b.155.2024.12.06.15.36.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 15:36:58 -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 13/13] multipathd: only call reload_and_sync_map() when ghost delay expires Date: Sat, 7 Dec 2024 00:36:17 +0100 Message-ID: <20241206233617.382200-14-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206233617.382200-1-mwilck@suse.com> References: <20241206233617.382200-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 While we're waiting for active paths to appear when ghost delay is enabled, we do add new paths to multipathd's internal mpp data structure as they are discovered (unlike missing uevent case, where we orphan the paths instead). When the ghost_delay timer expires, it should be sufficient to call the more light-weight reload_and_sync_map() instead of update_map(). Signed-off-by: Martin Wilck --- multipathd/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index e48fa79..8cca0ce 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2932,8 +2932,7 @@ static void checker_finished(struct vectors *vecs) int i; vector_foreach_slot(vecs->mpvec, mpp, i) { - if ((missing_uev_wait_tick(mpp, &uev_timed_out) || - ghost_delay_tick(mpp)) && + if (missing_uev_wait_tick(mpp, &uev_timed_out) && update_map(mpp, vecs, 0)) { /* multipath device deleted */ i--; @@ -2941,7 +2940,8 @@ static void checker_finished(struct vectors *vecs) } if ((update_mpp_prio(mpp) || (mpp->need_reload && mpp->synced_count > 0) || - deferred_failback_tick(mpp)) && + deferred_failback_tick(mpp) || + ghost_delay_tick(mpp)) && reload_and_sync_map(mpp, vecs) == 2) /* multipath device deleted */ i--;