From patchwork Fri Jan 17 20:27:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943959 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9F5D1A9B35 for ; Fri, 17 Jan 2025 20:27:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145674; cv=none; b=jQ3w3iXkUqEzJOxrjOnW5kyJDCTUFEmozW5PzZ+qsTgJ4lwTI94HoO+7duMoDf+lf5lUyEezkF5DryFatumH34kLwNkUtve841slvQdMSu4aK1C2aRzm2Y5dc272AFZRZcrQFN/aBJT0FtQd2r0zvrjJ0A16bwcZ6B8oHwkM/rQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145674; c=relaxed/simple; bh=mx9FCNoo0d/uPokublpadfRFC2BTsVSJkkff2e1vtyw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XJJA1vFinCqX+MF46nk8x/L8hmm8ZWC+VTtpB7P1ivTKb44l05WU4480O1hHNJ4Ciej8f2c7YebWvLnc9nso+9LCGM5AZfzb2FkHsjQqt22QCWgeJ5qKpyswehSHKtocR4r5tYMWDZONRfO4u3sbGJlSCZhiY5U3fWjL7qhxj0c= 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=BgLauj4X; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="BgLauj4X" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-385eed29d17so1417869f8f.0 for ; Fri, 17 Jan 2025 12:27:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145670; x=1737750470; 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=cJ0ZegHoOh0cxTfqSdDN2GCuoOF3B9WnLGcL5GyVqeM=; b=BgLauj4X9tqQD4rIQwUOdS9+D8Au0eMrV59dH/AmxuKvT5Srh2qPN33U/8Swng3pUR tRtSlVayVtXAGeeJTDduTtEpV2tbkctNxJwx+QOwq3F+FTefqKwHbkHGmFLKhywsQR9g 0brzJRgj55gKcK+5z9kpMMw2n0qR3crEbI0EobFifLUZcxHeMwrQePB31lIM4rDZBB8N IG4edlFkmBCg4NVCjIA31e55/yh9mp13UHojDSRYcekyXVEog1kmaaD37JZKCBbG/VV0 3mDOa6dY4Ut5zorc1PrwrT5oDZeZm5cgK1Sb//qRDpDLqduQ66aR85ocSf+hvH8Lja/G 0blg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145670; x=1737750470; 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=cJ0ZegHoOh0cxTfqSdDN2GCuoOF3B9WnLGcL5GyVqeM=; b=WX8QOXjha9mgLxkU+tiXVOo3nTJVrURXJiIlb1lbEFaMSUcBEA6L/NxPkMmuW6EuVQ qB3MH+ZHonrHfYp6KZ0cAM5Vqs31YTvFF4lM4kKr5QeAGMXUUuMal7y6K+w/CCwPm2VB dRfGjfDa727ZuZ8zLsTKl0odWG6Oni517Cdjap6Um9BB+mN8i8uZuvSi2PLjXL+PZN9x ZFHl0MNMot36ymkshQHYYq/TGKJ9+uMPwvoeX+4QSREl1IbDcEiyBiJAIeX77EBSXR+G ItKp1QiRa5rWUj2q/bkiSwndXUoxE7pv6uutIYdr3saYzJKYuNEm73N9Fq+pZ9uTirGa IzHQ== X-Gm-Message-State: AOJu0Yx7dmuUjBLhKqPe2uMnje20yYOjc3+3WJezu0/rSce8AkOh6w8o CLRRA3mBPfGp0FgB5qAoarNvIfKD+WfoUngzE4/z5mAqMCmt3a8l3qBBEmuzGKQx86OnqXX6k48 v X-Gm-Gg: ASbGncvCea7QHqPHy3hbW1C6MFsowS0Qgre0x5G7QaHDB2h5u2+gQxJnGil/oJQUiM1 hXbzjodFtjryuOw9dim4nozDhqie1Y+grtv+0jLDO+X9gnFMDt847LM/LboihtCCP+212sykeiK AHUlsuQn4jUZQ0W7LN2N3G4q1H4/ol3eGVWOl37SKe2wYuLo9M9tiNwVMcpoVrTspDN7WiAn2Ir ykcUUj6fEl316S/jUGB9VQmcUysFYPerFJLeYnkS6WnWE2aXgCrSVTLlCA5GHRtE+QpIkhiaFFH CVXtEX0etpYa03jA1WenRLb+Lbz2e2ljSHQkZy3Hdd0= X-Google-Smtp-Source: AGHT+IHYuUYempRdGg8AC/lhZFLvPenkPtm+xAZrVuVVnUJJvfhjXIdvb78TUiBL0l3AW5DD1Wvm3Q== X-Received: by 2002:a05:6000:1863:b0:385:ec6e:e872 with SMTP id ffacd0b85a97d-38bf57a6839mr5496027f8f.38.1737145669929; Fri, 17 Jan 2025 12:27: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 ffacd0b85a97d-38bf3279388sm3318558f8f.75.2025.01.17.12.27.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:27:49 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 01/15] multipathd: don't reload map in update_mpp_prio() Date: Fri, 17 Jan 2025 21:27:24 +0100 Message-ID: <20250117202738.126196-2-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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 Reviewed-by: Benjamin Marzinski --- 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 Jan 17 20:27:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943960 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B35A187550 for ; Fri, 17 Jan 2025 20:27:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145675; cv=none; b=GHLzEW8aOtz/deQ70tuK+ni2p08ZPKdgkHLat9W8kL+JoMYzjD+gjGtne84WRoDjW5KUiIbO5qv8LTZr7kDrvEx7Tw35VeHHXTfkA/j9PvTJlz9wLUmqDZhiShvsUCkBthFwzwGz8++PoI6zg406wEixiJECex7Ux45aNzXHMhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145675; c=relaxed/simple; bh=1LL98hFy0UfV7enFAIetQFkfpluoICYIqIstLhzpcQ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pHD54rzzmW301NpMxMlkXBrDQRvGfSD4M7TSWF+JKaKABXxoEoWk6ciA1Ldo0xyJynxr/gb/YVUkY/f0U/RKB6rShyeUBzshNE8azEG50W12QI3AC/NCutsBfHtnPSqfKONxLqx/N6ktSEtlwgkhICNJ5qoU0QkUFO9AgG9ebac= 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=ZNF5wwXR; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="ZNF5wwXR" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4361b6f9faeso16119655e9.1 for ; Fri, 17 Jan 2025 12:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145672; x=1737750472; 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=yX8A4x2HFwzmK8LTslJKGzzqABVfy9N0g2Xwi7+Yb18=; b=ZNF5wwXRki2w6GVBy3mpQJXyORVMPBhXqebaJaZy46epNDzCW7OdFGvZMXYV5lQRQl V8PSg7Me07VNi+5/hmYX17gcDZz2JvShrH9PVLuBRREEJwi3p3MSrdOH3vlQIUEu2/b2 k2D8JiLOszQMP7ZWzMd6wTsNP9BqnnZXVA1bpQ+3fSdjRIli895qb5/ORA5KD+iT0xJ3 RZ5qKnXsgk/rF7XB0571dy+TsDPh3R4R8soF8Njj8qNjUHfl6FHCLgae/tOm6jb5nEPb omQJB3EvrRPb3u+Pdt4WRbH2+4gMLCxOXLpMzxNcfXPtc2ERAJT9m8wqAAmq4WSITfw1 GO4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145672; x=1737750472; 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=yX8A4x2HFwzmK8LTslJKGzzqABVfy9N0g2Xwi7+Yb18=; b=o7UYrwyXxGttZQKXbFJ+ImeMYeWz4Ll9vZJUhRSsCEZpOj+A3Wt2Py2DYsy8OzE97e ncOsFhIAxlK8Tqyi2b5YDXN3EmTVmkCaYpUw8CEFmkrYxhDc6OPnXXJuKqDBCZzWgptU o4hc+4GgAbtXleu3CVrHer595QJNnL22NdXPvo6OlFFqQ+JB5fulPA4LK1ka3qTiy9T0 3B/P1QdOcVFyZHRDKJmLFi93kcn+fnG7v9+WzL4ytn4OvIyIXiZwC+tGldftUa3VvF5L D6uVUkvRDCg3pT9KMfwYm6cn6O8P5e64kcTeiyzQoR3KzJOqgfmG0Tl8fejuC0jBIBg8 yXVw== X-Gm-Message-State: AOJu0Yw+yrsw/UTW75+we+iL5Cih+4MIyQY1AhmZBlyMANZIxdUw5S3d +g9PhWzDUXCnASD3yow/SYmDKfdun978Fcq6s7JT8uw6BfHdzVaXy15wolOQ5so= X-Gm-Gg: ASbGncv1hG4iTw/vdc+4lRDq8KcKtPA2Cyzaz0rzsfp9f8tYtgqP6CgJ9ApHc7aem19 CpHgmwYaxDw4L8quXsuAwqIJvFsKarEOsxxsPz59PkDA9nZYtfsPePLlWMLLFvgW29cNY10b3v3 qniZDczxVfMYWeaMQzkwne2r0wi5f5Qjj0Dj/Y0QO8ozingCuuhywCa/nRFPBfV1SA2Zl94SpyA 0/xEdnVSHdPljCGaqIfk5NFE7ZVWJQnIv8ZOmSxfKuRCp/Nu6lYiVQUDH81Ukn5Qu9Y+eZZBU5u lKYzQpcvPMdNjI0Iru9MA61IPF678IMC3AWMdtfRPEY= X-Google-Smtp-Source: AGHT+IF8xfkql8H1NYWRQh/Sk3vmQ3EOUJyeIFKqlFUHJhbNgJCNpyfn+YWaDpushCQY3R+Tm780uw== X-Received: by 2002:a05:600c:1e09:b0:434:f2af:6e74 with SMTP id 5b1f17b1804b1-438919136c6mr39858535e9.15.1737145671534; Fri, 17 Jan 2025 12:27:51 -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-38bf3221a6dsm3282171f8f.25.2025.01.17.12.27.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:27:50 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 02/15] multipathd: remove dm_get_info() call from refresh_multipath() Date: Fri, 17 Jan 2025 21:27:25 +0100 Message-ID: <20250117202738.126196-3-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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 Reviewed-by: Benjamin Marzinski --- 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 Jan 17 20:27:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943961 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CB291A9B35 for ; Fri, 17 Jan 2025 20:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145677; cv=none; b=PwYGoGuJqc+nlX47PYJvLdub/yXMLD0LwGHf1BAQWjvdUbhQhq12oVRtwTguoJspH8xQyvHiQWzIw3GeU6GnuJxaF4KY+uHP22nOtNqUnokvqYG0kuACyrN8uY3fQxerk3i9CsAg6GOl5fMiFpS4eij9SypiNdLSyfizHV+ccxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145677; c=relaxed/simple; bh=sZOHwAqDpipyKxKfNoAlh8Ak0TAGqtVc1Ii71Bqx1y4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xb6RSd9/uQ9Ewge2oI/JIHIPDLlXjUO8M2jtVS4SU03+Foxm4H8aU/1TLMyj/uZCth7i+RIw6UC0hLDR7p0bjiantuibN4kelgGoPBCj70IzVfudCRYKR2Gs8EM/Ah4wW44ZNNNDZ6B8/kL5Ynr2Gb1yWv7lyNvDBsthdPqHfEk= 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=IzQSIasq; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="IzQSIasq" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-385d7b4da2bso2238961f8f.1 for ; Fri, 17 Jan 2025 12:27:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145673; x=1737750473; 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=RX46TXlaWZ179jdb2ilM9hHCnCASlGV3qH99y9qJfr8=; b=IzQSIasqeK8A9UU+6WEYdKJ7ah7IiSYmTDO9O/0JDcHrSuqypzI00RVspL7VM3LcEI sOn7CWAP8i+it4fN/kCwyS+hW4kCRvAwG86PCHNqQ9d6Vk5CHG5CyO4//BKIpr76YX6F FKePu1vHKS0G4JFMYocqJYtDUZ8W5zpQFnHon2RvPSMu+BW5/BjTprhCULnaLhJ+GKFB jjAY771BQAwPmQNtWDKZANotJF/dN14/UnRL/BUQKFFCnA6qC7uveZ3eGKDlPQHPNGhM +V+wUNSdVmrG0O3TCJhk0fgTtb2eD7yw6f/SsapqQQQVl6n8tYpk3O5XiBU8fFmdbq3w lf3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145673; x=1737750473; 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=RX46TXlaWZ179jdb2ilM9hHCnCASlGV3qH99y9qJfr8=; b=N+9oLNtZ66HR2tMWq8ETDfNcM3TQBq2NtQkSCzCDO3toZyhopTZbfqrn4WZa8HgFfJ WUYf9gKm+qBrBMbQ3A1WlcwxKGqQGCRSmV5L0hi06d05FXvpZi7QB+meANJl15XNC0jg jX5AA9ODB69Pho0sovFVMWk20gkEemQusXkmT2KIEu7nylnQkQMiWO0+3Q+mSYYwDaJ+ BmA1BDtaXO3eRL+cXtzmYwLZgeyk2Wd9Lx1jpLN2ZjxX2slZ9EvDmftBM4Xc0hyrzgHQ afyN6jA9SD3t8yu+Jqp5SZsMcZs2cXYqMEqBozlAxhJwCxoc99srR/FpZmdrPFNgA/Rf vjXg== X-Gm-Message-State: AOJu0YxWTl3QTrae+LlBR3WlSRT3YAN1B58oQRn34X/f7YhZhvZlvTle /8ts31PpP4kdrrbKVbgBD1ap0RnJW8B8s8/AfTk6V5sgEIuuztpQsSn0a/7LT1JHVcMDmCs2YbZ G X-Gm-Gg: ASbGncs5k04eQ4U7wzVKbAHdzT+IQbdrCPq90Ruif5T2NAXvV5+Zj5pdJ79Gq/TzMlp 4HuTQrG705p4gwVX3coi/VraT+BfEZ4xIYdOOHuLAN/UIDwZmrKdPdkDvQ9qHJ58boKPAFGqdOt sN/lQekPlXWeucKo1WYTbYFtAI3OrqMcZtABgnLjFfkODSoERSWvARfqkkx6CODBh4m2ZF2TyHm Wit0+BHJGgyde2hTUDenq58/cZ0UXZAJ3UO7Kb7k9e6iUlQjjoaFWg/SxQ/pnlvvEM7p2gAELCy 6AUuh0qva+wlIuC8IK1LNQCFT2YTeVwL1CnHRY+0Kcg= X-Google-Smtp-Source: AGHT+IFXQvTg5q/AW3MrxAqwqt5fkeCGbmcUjDoiDhuldlGis19JRj4Se6JUpUcVUqCG7fsD9/NkVg== X-Received: by 2002:a05:6000:1f8d:b0:385:d7f9:f157 with SMTP id ffacd0b85a97d-38bf57a749dmr4544306f8f.36.1737145673243; Fri, 17 Jan 2025 12:27: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 ffacd0b85a97d-38bf3214df8sm3359932f8f.4.2025.01.17.12.27.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:27:52 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 03/15] multipathd: sync maps at end of checkerloop Date: Fri, 17 Jan 2025 21:27:26 +0100 Message-ID: <20250117202738.126196-4-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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 than calling sync_mpp early in the checkerloop and tracking map synchronization with synced_count, call sync_mpp() in the CHECKER_FINISHED state, if either at least one path of the map has been checked in the current iteration, or the sync tick has expired. This avoids potentially deleting paths from the pathvec through the do_sync_mpp() -> update_multipath_strings() -> sync_paths -> check_removed_paths() call chain while we're iterating over the pathvec. Also, the time gap between obtaining path states and syncing the state with the kernel is smaller this way. Suggested-by: Benjamin Marzinski Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- libmultipath/structs.h | 2 +- libmultipath/structs_vec.c | 1 - multipathd/main.c | 26 +++++++++++--------------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 6a30c59..9d22bdd 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -471,7 +471,7 @@ struct multipath { int ghost_delay_tick; int queue_mode; unsigned int sync_tick; - int synced_count; + int checker_count; enum prio_update_type prio_update; uid_t uid; gid_t gid; diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 7a4e3eb..6aa744d 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -530,7 +530,6 @@ update_multipath_table (struct multipath *mpp, vector pathvec, int flags) conf = get_multipath_config(); mpp->sync_tick = conf->max_checkint; put_multipath_config(conf); - mpp->synced_count++; r = libmp_mapinfo(DM_MAP_BY_NAME | MAPINFO_MPATH_ONLY, (mapid_t) { .str = mpp->alias }, diff --git a/multipathd/main.c b/multipathd/main.c index 4a28fbb..e4e6bf7 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2470,7 +2470,7 @@ 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) + if (mpp->sync_tick && !mpp->checker_count) return; do_sync_mpp(vecs, mpp); @@ -2513,12 +2513,6 @@ 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 update_multipath_strings orphaned the path, quit early */ - if (!pp->mpp) - 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 */ @@ -2918,9 +2912,11 @@ check_paths(struct vectors *vecs, unsigned int ticks) vector_foreach_slot(vecs->pathvec, pp, i) { if (pp->is_checked != CHECK_PATH_UNCHECKED) continue; - if (pp->mpp) + if (pp->mpp) { pp->is_checked = check_path(pp, ticks); - else + if (pp->is_checked == CHECK_PATH_STARTED) + pp->mpp->checker_count++; + } else pp->is_checked = check_uninitialized_path(pp, ticks); if (pp->is_checked == CHECK_PATH_STARTED && checker_need_wait(&pp->checker)) @@ -3014,12 +3010,10 @@ checkerloop (void *ap) pthread_cleanup_push(cleanup_lock, &vecs->lock); lock(&vecs->lock); pthread_testcancel(); - vector_foreach_slot(vecs->mpvec, mpp, i) - 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; + mpp->checker_count = 0; } vector_foreach_slot(vecs->pathvec, pp, i) pp->is_checked = CHECK_PATH_UNCHECKED; @@ -3032,11 +3026,13 @@ checkerloop (void *ap) 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) + sync_mpp(vecs, mpp, ticks); + if ((update_mpp_prio(mpp) || mpp->need_reload) && + reload_and_sync_map(mpp, vecs) == 2) { /* multipath device deleted */ i--; + continue; + } } } lock_cleanup_pop(vecs->lock); From patchwork Fri Jan 17 20:27:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943962 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 36A7F1AA1EC for ; Fri, 17 Jan 2025 20:27:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145678; cv=none; b=LAMBtqcihTKUu/Ucfl7f3rSO2HBWnGSmR+elopJ2w/5zUNMOvd6/xwvJ3dDMh4u7KcWtKbPwW/nqezTTr3MHZdkLRu/pPXn5KKwii2fraBZPu6LOzAIG9qKqDSz0TuvOB1e3Nw/f6QEWwKV+FAOEP4M0u7MFViRI1Vk9+GVC7g0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145678; c=relaxed/simple; bh=+zTaLe2bFCzQIAa1A0FI90UlKpQIZD0lCAuUmCPuTJ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JDORReJXiF9KeQL9DABYkhy6TvzpulOF8XnGgXpvbmzuDT1u8KDdv+xcaP2+uzfTfRZEUCpDD7KnkadouViNds3aP1qlasp9KHxaUH8JGUq4NDf+nCSjgawiXOe90lgZxTJHTmNDAnnRM4UxmwLSlTfAogfIv6bVij2t6S84GC4= 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=WkZOqpSr; arc=none smtp.client-ip=209.85.128.47 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="WkZOqpSr" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4361f796586so26842625e9.3 for ; Fri, 17 Jan 2025 12:27:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145674; x=1737750474; 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=bmsdbMUdXouyCIUvFDb9rT9Wa7Cn3qSpvlZNyHArD78=; b=WkZOqpSrGuBjGXsA6b8M6ubZ5mnwQy2HepPtBkI42eOrCL02GjqS+rrfP32bnR3RkE awgz8hPxpyq+4j/c6x2okGuz1SBPWjhFHvTI7if9m8VUxC48cvAuRmWaoFh3V98Pm9yk 9PO3/aKg8BQr3LlqI8TujrIujcAknGfp5/x/6hdDnNsK5yLonqlk/IjBT1jsd4F6wK4w 8kq2+BsBCSVupquvyBevrxgackbjDo5PNrwWy6jhF0AsHv40LnNw9LWVUWPeXIuzb0gv n2v29MlLKwTZT8XozCT6A9sAP5kvGoQrmjWsEYEm/jkKFaQusmOqwIonZKGKsQnfMZ1d xESA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145674; x=1737750474; 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=bmsdbMUdXouyCIUvFDb9rT9Wa7Cn3qSpvlZNyHArD78=; b=lLgr80eoIuiTQCPj++/GLmxRIO0xyytdG1iwjHweaKyRQ4p74DxQCxAVOpmlYUbpr9 hO+hajzJ9l+0JSxQI52m8ddOiVHQSW1gdslNM3CM56RrA3w0+H995D+NY9g6qMlOMZM0 H6Y6o14BvWzFB5Gp6RjE101iFqHot9NrgQmIRidQPO3yoN2jjT46IW2q72moK5hpsG9k 1uPIRSrpi9heNDSx13XtdoyEJngKWVLe3BYTJctPMPQma32o/8Yzp2l2JdL4ph2NnQQv uy8U3ARKmUboLpOxlkg73+Q2RIWoOlH6CsP/MT77HaEjAmKci2V6iXi33KczpD9KmYhB gkhg== X-Gm-Message-State: AOJu0Yx3yiBu7FyAA9PvzlTepNCYD9/TgGJjEtgf0lXv77/4flnOgBSn HZmmVcwj4lVPlr96eYytTwA4iSqxOSK7xKj0Cfj1mKfxSWFJ+th+BL2VhJ2QmBrAR+RywaRKqeg C X-Gm-Gg: ASbGnctw+bKggGAS58GxN8YfT4Jpu814Hoyxme+kN43zl/8fP06n0bPaACQKW9b4MMs 5zlCQOxVCBaNbnhZ5otjNue4Nfy2bbWyYQUmAT0JX3jkOMCOfYb89ptvvkPdcS+3DIHwNnYbg7R hCGyrw0ZI0cUxSm5cgYsbA7zrnvRz0e9cq4gYb8s/oQysqM7tJ1p6GOgO+K973ojIvyRhDH5F2q vcPIfW2aPxTDzwITNMQZJFwQmDXmo9tmnyP38FivUCBVar/cxZViRpwFwzdZlhk8roN6iwtgjCq SvLngWI9paCmfBfQGeNT7r9BMM+RTGAD5L6NLmUnqBE= X-Google-Smtp-Source: AGHT+IHlGm64DYoPx0sySMqMkF1D1e1fw10DdJrs77iOW79NsRyIKqpzhLEfETixTYR6s/gkKJ1iSw== X-Received: by 2002:a05:600c:4ed4:b0:434:f586:7520 with SMTP id 5b1f17b1804b1-438913c5d53mr42709405e9.6.1737145674315; Fri, 17 Jan 2025 12:27: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 5b1f17b1804b1-437c752910esm106956115e9.28.2025.01.17.12.27.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:27:54 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 04/15] multipathd: emit a warning if a map remains inconsistent after reload Date: Fri, 17 Jan 2025 21:27:27 +0100 Message-ID: <20250117202738.126196-5-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 After reading the kernel device-mapper table, update_pathvec_from_dm() sets the mpp->need_reload flag if an inconsistent state was found (often a path with wrong WWID). We expect reload_and_sync_map() to fix this situation. If this is not the case (need_reload still set after map reloading), it's most probably a bug. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index e4e6bf7..ff3031e 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -3026,13 +3026,20 @@ checkerloop (void *ap) start_time.tv_sec); if (checker_state == CHECKER_FINISHED) { vector_foreach_slot(vecs->mpvec, mpp, i) { + bool inconsistent; + sync_mpp(vecs, mpp, ticks); - if ((update_mpp_prio(mpp) || mpp->need_reload) && + inconsistent = mpp->need_reload; + if ((update_mpp_prio(mpp) || inconsistent) && reload_and_sync_map(mpp, vecs) == 2) { /* multipath device deleted */ i--; continue; } + /* need_reload was cleared in dm_addmap and then set again */ + if (inconsistent && mpp->need_reload) + condlog(1, "BUG: %s; map remained in inconsistent state after reload", + mpp->alias); } } lock_cleanup_pop(vecs->lock); From patchwork Fri Jan 17 20:27:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943963 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 D64701AAE13 for ; Fri, 17 Jan 2025 20:27:57 +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=1737145679; cv=none; b=TlV9EXL0PSzofLvFvYKeZAmAPhrik6zVxPfzRhf5GJZsJBuPtuWK9VcB+atYyHMpS+vzOtZ0NtReiFyC8k20EBIZ2QXyXXuRt3fALkmHU1Ip3j7EKv/QOqmq/CkStGNzQrl/RIZACvOAtkeljwhwSlKICcNwGW60y4b8OkBDvvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145679; c=relaxed/simple; bh=myGFqqHcQLi1SYKR3C+dvtXbPkaXowosnZeITNlEB5E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KaYr0sdtdBOw2rKsDi7az1etVh8JrLhyS0QJzQ0v8kfv2tseJDU+9yWrMFbccYL/Ul4Q6N4fg2mxsZg87xQa5rA5j+T4+nDKGpSJmV3RraQryqxfBvZW7/Y5MOOzmdkc4m8RyeQRIOD+Twh0e4ui847zzui9qvP4Hz65SxCtsts= 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=M0+g66Ix; 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="M0+g66Ix" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4361815b96cso17215315e9.1 for ; Fri, 17 Jan 2025 12:27:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145676; x=1737750476; 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=fitHqImlk5TTJDF74Epkv/FvsB4bp2n7kksfYCUEsMY=; b=M0+g66Ixqk6N0fPeom3p5JA2AiNFhhqvEFEdonZ7DyyNKqRS/xk1YyeYHRaanFXsaH 5Z5Qc295CRJWu7ltzcDOwlb8Str+vJJinAE4sI1L+gfQ9Jr8MYEISGNn9+g9yRO2gcdy Ul8DpGQh/OgO2zqovXiy8ydzJdGAYYl4HPuY6i59r43HFl8vjEdE/ztXWvUZxxkVlUpf Cc7+oxt2dOrTHkZ5thLglHTuXBTYb+UAY9j8TRXe/NmdLv+6r6eLsM1UhHgkL3kQE1UO m50C8Mhxd5zq5L2LmnTF6qpXjZVXZ9uttBVhNM/V02eLdoMkTD0XIAD0qL6XjnAYxb9d x3+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145676; x=1737750476; 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=fitHqImlk5TTJDF74Epkv/FvsB4bp2n7kksfYCUEsMY=; b=TYX7GagUbDUfxJ2GNIJWmVK+5yqVhnJNGfHW/qt+NFt+vybY7XWzXJfjXBRswxI4Lt UQK0QQJJ5sZ+LxYIxTIJ/+rOcawiQq/fXXxazJ84uqVnRZiM55hJ8cw1dRzKErp8s4RM KtR7NrwP6/ZAVsd7GOFjCSxx7uj2RdN717F29uW5tMi9NSz2vhPP2lArupS3BhnfSpuz Mbnt/sC/V4VoNrwGarHsNCm5jMicOpj1hU4I5HXEYVM04fsC5v3KPJrew+PlKzhMtWgi aqDLMhB2baNxhMeHLh42sRrAgKIx/JT4b63MaRMKxHx1sDkWYeRuBRYoAGy65zAQEltY 4klw== X-Gm-Message-State: AOJu0YwZZafvsT2c+5aUl2IC4y121CqPCPmej1NMVZjk7d+/0RK559tT 8gBoNN+Q8OeEDyby1UC/wjn8Z+5DQG9kKKHJ6MXYNMxOEudE1JxPakO/GbHP0Us= X-Gm-Gg: ASbGnctBiQsqP72ua6fWNGoufV/NpCqexyL8rzR3sD5+oJGhgGTLt/sJDjZ2XccIosL yJ+CiSBfrbI/2VQ+q55dvKZ1NRkAXCcojQwDKshNk8jPT2MDS3OUfgiJFqokT35vOurXpTXpSjb smwhQ9a4O/mCnDp2CtheNjcDbhLOzrRMB3/ztLCyQN/JU8GNje8O9TtFJDJYbfYpwMEc+pWAKfd rYXbSkusQxH4sgZdaa7TvAhm/HsFdGnxRxmlOYNyifWU8gqm9kyHnHRXZGfm9iGhxb8D3HK5NMo IBgVJwUcX8UxNf2IKXsvH58E9eLtCxwUqSKr3/AwJnw= X-Google-Smtp-Source: AGHT+IEo8D6vQqhSxLEUWxVEW/J/Nc7DGJ2ysFZPzso+QRmG7SwfLkb+Gb+XY7iccHsHXENq5+EgfQ== X-Received: by 2002:a05:600c:1386:b0:434:f2f4:4c07 with SMTP id 5b1f17b1804b1-438913de07cmr43028395e9.15.1737145675882; Fri, 17 Jan 2025 12:27:55 -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-437c753ca42sm102105685e9.35.2025.01.17.12.27.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:27:55 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 05/15] multipathd: move yielding for waiters to start of checkerloop Date: Fri, 17 Jan 2025 21:27:28 +0100 Message-ID: <20250117202738.126196-6-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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 Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index ff3031e..25aab09 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -3007,6 +3007,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(); @@ -3043,16 +3053,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 Jan 17 20:27:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943964 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 5352F1AA1EC for ; Fri, 17 Jan 2025 20:27:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145681; cv=none; b=faOBxmoZwfSBGFf8Az6IjU3O7kyuZvWa0Qj5npB63jaCoX4F7sA5YKnOSXoJ0tRJLxg21ooNV2ntQvsYmu0pmDexxDbMZKYSqTitKIxM4AXcnME2XNkXFQP4VEvZ7ovnpI3CT/zI9USq+iBAleop9i9LMc2j0c2xn9H3NTXbK2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145681; c=relaxed/simple; bh=PxNkpUcqDnUp0eMQkZDvPNQTPWo8bXoH73pgz+aMsfo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k9GyHVe4uRB3HE6A2d0xapfy0CkIyWjsLOWRFbE/mk7Gcy8j1MN7a9v7XjlWDqLn+7Zx68M/z0lFMh/tdmlWoWNQaeA/Hayrho9PuDpJBBPq2kgRMk4eCQHEzWjBgMCLVwtY84XPfFa0lTIOg55VjGoAyCRGRTh2KJwVu37pa7g= 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=KCn0CLmG; arc=none smtp.client-ip=209.85.221.47 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="KCn0CLmG" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-388cae9eb9fso1397096f8f.3 for ; Fri, 17 Jan 2025 12:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145677; x=1737750477; 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=19BQLtmNh4CRhfryyvO3w4ODKlMauyNxWNqaWMZphHs=; b=KCn0CLmGrFauB6Q/QkNeO+hHHPpCOl+ds0HtApGEASGhdPMvN+7sSv5+pzrynR4vn6 KCYiDUjV7GsBzkm9RF9sa+cvLFy+Hwg7d+IBVfEYEKW/dpSi92o5CeK19JM+n2aSMmXT /gEYPPVlB9ek34FO+pYf2YDv6E/hccFn9yxupLgxCaKgSpHtPgAkDtxrvsV5EG93lN7O i6A+3UUwCfjsYKpwgJClLC4B4rqsulvJDa1PCPGt/946Yg/v1Q654KiKukRIFYGrJV0e vFjgzvLu1VWl+8CQ1SlV+CFVQ3EkExpviJTssFUFImifirx6nAYJMUbb6pIFKKX0ZLlz SrWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145677; x=1737750477; 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=19BQLtmNh4CRhfryyvO3w4ODKlMauyNxWNqaWMZphHs=; b=i20vLBnHErQFm6uQ1xdzjRf+M+wLvKjEjauqRlSDMOyTbPrJChXXh/mHe50m67+IQC sdc0cDQ8IR9xAnx4HaW/Jg1KoyxcDbjFZMnHCWrJ9ssAt3xIaITuAakju8Bj0kVvD72O Wf58C/Cjn0xqHprlCVvgnK6vZ/ywV/7Juw1Zw9n8BAPAY3KaqPKZUfO5m1ZMwIzLGXSf B9p30AbgtA/KCQo+JMiXCjD/03VJtcpwa/xUmcRotw8zn1Dpl6SjAZ2Dm0Iovu3tmHji gPqNmhA7DMwri+IKXvQHQMPOOqUh1nCBvW5vvK9M30Vtq14iaV2rLBnQIT6AAj/OtsfT C53Q== X-Gm-Message-State: AOJu0YyWVpgVmXad4lK9iLeuzPprRUEy21sZDE3Y0+5YY8SMTUZm5SqJ V1BzHJiy9dznxZyGAonNfhupEQ9MbrXfJ7/WQonxdPaUF49XT6acNiPYunSVEZYT4UfYhwHlV7e O X-Gm-Gg: ASbGncvlI29Uwks9W8fPYnrEy+eAM5E1IEAbvcyAn0T0oljTKjOOYWmlvynl1+qDuz7 wZP1RvclUCge5tJuRaow6Gk2U5imqwDS0V7BnlR7kvyO13t/MEV9ioPL4+/0uuim0r0pvY4zSIh //htz7hAgfaoqajRtCp/a/3olBcI/+FoTjKsChv/t6qKggspca9FhimlcAkuVDK55PfyYhkS43I 7cssQzoMNLC74HgJi01EB1XgJU7yiTX2AGkbm2YSNpGSu8+p7xXpH6pbFBmtwZoUrLMpP7i8pYU ibzuUBqugGAyAQrlEIC7NAWeJd6R8kj+0biHUlw1XS4= X-Google-Smtp-Source: AGHT+IHuNw6XiUsTHlC1hTK9hwzxbKYJtEpbmxvLPtaFjyq0REZGqBhMVfFt5nhifJRLO4H7ml0hYw== X-Received: by 2002:a05:6000:1565:b0:386:41bd:53a3 with SMTP id ffacd0b85a97d-38bf57c0716mr4016424f8f.50.1737145677507; Fri, 17 Jan 2025 12:27: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 5b1f17b1804b1-438904131f5sm43270665e9.11.2025.01.17.12.27.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:27:56 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 06/15] multipathd: add checker_finished() Date: Fri, 17 Jan 2025 21:27:29 +0100 Message-ID: <20250117202738.126196-7-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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. Replace the "&& reload_and_sync_map()" conditional by a subordinate if statement, as this expresses the logic of the code better. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 25aab09..988c82c 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2967,6 +2967,29 @@ update_paths(struct vectors *vecs, int *num_paths_p, time_t start_secs) return CHECKER_FINISHED; } +static void checker_finished(struct vectors *vecs, unsigned int ticks) +{ + struct multipath *mpp; + int i; + + vector_foreach_slot(vecs->mpvec, mpp, i) { + bool inconsistent; + + sync_mpp(vecs, mpp, ticks); + inconsistent = mpp->need_reload; + if (update_mpp_prio(mpp) || inconsistent) + if (reload_and_sync_map(mpp, vecs) == 2) { + /* multipath device deleted */ + i--; + continue; + } + /* need_reload was cleared in dm_addmap and then set again */ + if (inconsistent && mpp->need_reload) + condlog(1, "BUG: %s; map remained in inconsistent state after reload", + mpp->alias); + } +} + static void * checkerloop (void *ap) { @@ -3034,24 +3057,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) { - bool inconsistent; - - sync_mpp(vecs, mpp, ticks); - inconsistent = mpp->need_reload; - if ((update_mpp_prio(mpp) || inconsistent) && - reload_and_sync_map(mpp, vecs) == 2) { - /* multipath device deleted */ - i--; - continue; - } - /* need_reload was cleared in dm_addmap and then set again */ - if (inconsistent && mpp->need_reload) - condlog(1, "BUG: %s; map remained in inconsistent state after reload", - mpp->alias); - } - } + if (checker_state == CHECKER_FINISHED) + checker_finished(vecs, ticks); lock_cleanup_pop(vecs->lock); } From patchwork Fri Jan 17 20:27:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943965 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9FA01A9B52 for ; Fri, 17 Jan 2025 20:28:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145682; cv=none; b=uf4fd1ibxiMSy4SoX+4t3EXiAN2PO+v0TTltcLVTLuc0YFPpiSlc80iM/etp6cvCQ8/B4m+zMciK/XzhT72IDr3CNL/jLYUzHeGuebvLWEGMwAzZL1SH6I/jybaW4hkHgNehcvSexB2eDcD/Mi3QYEq3nintG/Yx9ofBSLOyaqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145682; c=relaxed/simple; bh=2xmApSNY73wVcjIg9Xipl58QMg975cjU+ilKCEQbUW4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=klSj3/ZbXh0DscXf1SWyo5+qs1VIUodzMuTLoKTqZvl8vb9/0THVR2xALfRkvVfILOYM30oqAtpUSQr9BJY8yskFg8E2hD6sQlaiQ+qHc4efz3Q4kF3xcAZ9McMn33Hqpi6ePBlZNGw5qtm9DPyo16363i5EoT2Jxl/F73hoA6g= 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=X2xVyPCh; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="X2xVyPCh" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-38637614567so1265699f8f.3 for ; Fri, 17 Jan 2025 12:28:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145679; x=1737750479; 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=z/lHZv7D6PTcIHR09f+jlqhvya3sYOoetOQz0YobJJg=; b=X2xVyPChvlMRgmPQtfdC8wsqPpN4fhwoDEtr+Ob7M92LtzPAJj5gI9w7OEcydTj60I U2bnabESsUSbSrp5ym8FCmiILRgd2hNx9w+0HkwA87okvUmlN4I9+kClGcRNNA8hYE8c fFv515mMB4lfI/3qdXt8oj1MHQmc2IubFOo9m2hmNUJreBBcQZE/mE4My4f60X3XyH/4 cebMkozEWffJeJfBSC0SIKvtBjyLKOt100iGCUH5NaI8CVHfckoYEG/e3cZbUXIalfV7 OBypwYCKfmDSTlABfdFrJk31oE9/lDOTnSF1NyJWpvxQi8ae1AEm6NEFXZ9NhNIteoVc I9ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145679; x=1737750479; 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=z/lHZv7D6PTcIHR09f+jlqhvya3sYOoetOQz0YobJJg=; b=eqqo/Dj6kGwvw8b5fMV18sTTy0KE+Gi5klf69ApTPdRxtBb7yX62qXXwFt3lQjRFF9 r13orACOhGsJAnsi9H7etWlPTAFFVATSwlTDCRkS7LwrR2nNRxgbQpZOqjzWpzxsq19s 6tYQS1eOJQZZPaM0kO+tYHqq10rM1Y08OLSQOMewJjpSgj6yPdIORajqO8ElDagF3ldf V8LwEjjlGP2r0EDj+h+QAkV+vn7+JJqUXCbCGBcasFtpCZ4a3T2GqjRVvXVmPc9IF/Oi /6wZ2j2DYce9ckFf7UirtKtx+1dUCRB4t9NGFdBJqucgPsS47m24/WTDyEpaQk6xHpqh 2avg== X-Gm-Message-State: AOJu0YxWKenD2MROTx7cRw5tB99gWyZFgjqKuWAp+fkxcjknTlWQIi5J rkv1FXm0tDQL6PHDe8lZbw/HW5p3zVLf35Q5Vh793TwQM/XHZyOpbLm3PTCZYOE= X-Gm-Gg: ASbGncvW4DUkY9F0YILECFHb+Y9Jj87D3T8ZfnCEBfeamaTm1rcaETysEYhMBisWk0U 4j2br5FpvNqbX9qqheBKYLMDsy1DEE5EF+i/2IGiTDw4n9eOW8WqshH84v9FAoE/cSRRH5HD/I8 wuTsHR0J98GLWwiagWb0ckozjNsI/TrGxzwJ7IXko6iXAGN3ptJ02IpmZ8TTWwMAxPIxVL4T4zm g/lSS7YuO6sN4Qz/TQ6DNaq3LAHQAYp28RMiu51IIODIT0sHdwzvEYSiNUwBZAE5qG1lgHn/Z2S RA5TqQJRe++mq6YaXpP7coQD7JYgScvveqrncguQbvc= X-Google-Smtp-Source: AGHT+IHVbQcyKhboT2hSLsr992t2n3c53v31iLA1IgGzpbKGwT9AF9jjG5+nD2NMTTjLkRPLyR6cNA== X-Received: by 2002:adf:f4d0:0:b0:38b:f4dc:44a9 with SMTP id ffacd0b85a97d-38bf57b3ba6mr3651376f8f.41.1737145678990; Fri, 17 Jan 2025 12:27: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 ffacd0b85a97d-38bf322ace8sm3374808f8f.53.2025.01.17.12.27.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:27:58 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 07/15] multipathd: move "tick" calls into checker_finished() Date: Fri, 17 Jan 2025 21:27:30 +0100 Message-ID: <20250117202738.126196-8-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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 Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 988c82c..6df8769 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2988,6 +2988,11 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) condlog(1, "BUG: %s; map remained in inconsistent state after reload", mpp->alias); } + 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 * @@ -3062,16 +3067,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 Jan 17 20:27:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943966 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 83F9D1AAA05 for ; Fri, 17 Jan 2025 20:28:02 +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=1737145684; cv=none; b=asq8yAS+3ViknO4vqm7aQ4R9rzkYQXLL3a0q+GnjKpsYTqRhLKfOynW51pRcEH2KOxHHPQ2jmm2n53c3Bx9WhYnI+EGPDJEctQQjaI1aGcCvbPvjPHmaVVUxpnieUUmzFuOIpf3VpbeuDxn+CScMyZqJfZcnIAphsY0+goKbZBc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145684; c=relaxed/simple; bh=/I6EUDHeb4xacp4ztvBF8ffpTYDG15T8Ci7qcb7Bqu4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=COSVgD+85qjlUjEgOfMC+INZRc5gAczAKFcUTagWTkWWw74Is+F7yNRKpSzg9Yb7awLek1n89SzFjObv4a50bK3UztT0MyXp1/OozWxQaIouxjaJuojvxDhpCysoF92TA8Ve1SBDn+56xYYf80XjN9tFG8U6BRr7BQ/gAUc0YfA= 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=OmgFJkRg; 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="OmgFJkRg" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-43618283d48so17473165e9.1 for ; Fri, 17 Jan 2025 12:28:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145681; x=1737750481; 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=iokqSG1plG4aytu5apWJLGCl0kDl59YYmG1ZOO86fOA=; b=OmgFJkRggF7eRhJ9rnRv+CpJRRoBVN0JMZohMYZedvTJbY7Gkm6R4zdjfl3VNzXH0i 6ZoEWctLdRUCwGmWEqw3smBboVz4tatBs8GG+VnHL4ECEinoGEPTqma5+v0M/NPpBHDA +W+fx2P0LY2thAXIN/FYuWLQX/DPqMxAPzSkmPY0frRZmC/9ukZy/xl5Mu580RHwi6wN vKE6JbS888D4ogC3dVjY3K2UC52uo3ynUCfd3a9J8rky9vhzkLIPy6azIAvqVz9Ozb1u 8/4ffqvE18bZZT12BVnJRxe55w9TejBRh7Gy91i1cNiv4WR1H8NVMfJlhyWgH119m6gl kp7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145681; x=1737750481; 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=iokqSG1plG4aytu5apWJLGCl0kDl59YYmG1ZOO86fOA=; b=mRxQk73RpKDMjOotvLzdDkr/iVAXuMrhHs6id8Gs2y57jcp3lGao1tjY0leSR+L05h CKLngDh/Rvr2FxK9bPAGyPO5EaLTVyVMXgrJFcWt+rWL3soXAquMR1VAOTJaG02R3zlX AzqjXUA/RqxgHSxjevZWC4ail5njUqRi6/JrsrcTsOtIQZ4HMjAAbQ3qa4/kyD3Cgzww WJoaE8B7HIP4DMBdwwfoFFoohhO/K2ZUpZH2GMQAGzrohOta3Vj9YG5XYm5T+MFPjOdr odbm1rAIZ9kB06ND99YGLxID8W8g9NyJLHhcnSceqAR1a932irSV0Huji2LxM9CfrgQ1 5bxA== X-Gm-Message-State: AOJu0YxjRI7OVzUTyIcUfpC1fg3vrd7jjHK561676N0JPcHL8HyNmLqG YO4U3RSuJdLK7ZVAIMsE+4S0spe4dY/xAhFmd+QdHq4DW6TsC9EyiSvuJqnjw68= X-Gm-Gg: ASbGncv7e/4rDzwar20N2sLqG1/Jm9D8mdh3F+YC+MQ9D+APvi8X/QkNEmV1xFGXhYI B2Tt6jF6E5O76paqqJ5ZZGLiRyYWqvdXsajjLQIBq+90d0LmKaXECUaRYUDGV4KEMEgj+ZpJUXl SN6sKrC85rZTQ8r/ZWejIS7kuJvea29ETUbzkwsLAYNqlAU7SBpAPYd2o53H59hk2vqxWMMTUZr ACQo7aaAmUyecy12tisDHmiSNlEEsaIx6LzcvCytdNoRmH3Ak3QaRi28wD6zf3kwX3y5ZicMQSs SgTzc/d5ttrV9V0k58cBJsxmkY2rwz6U8964cwpCOoI= X-Google-Smtp-Source: AGHT+IGj4oaFqjKZeS0lGKk1lIVti74jwHFsVOXHuPpyvY8cXrzX/W9nK+fZi9GRX9+kR2457rBmBg== X-Received: by 2002:a05:600c:3420:b0:436:f3f6:9582 with SMTP id 5b1f17b1804b1-438913cb729mr44778915e9.8.1737145680465; Fri, 17 Jan 2025 12:28:00 -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-437c7499884sm107255285e9.5.2025.01.17.12.27.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:28:00 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 08/15] multipathd: don't call reload_and_sync_map() from deferred_failback_tick() Date: Fri, 17 Jan 2025 21:27:31 +0100 Message-ID: <20250117202738.126196-9-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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(). Note that we can't simply put the call deferred_failback_tick() in the "if" condition, because we need to adjust the ticks even if update_mpp_prio() returns true. For consistency, use separate bool variables for each condition that would necessitate a reload. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 6df8769..8c2712d 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2076,32 +2076,22 @@ 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)) { + if (need_reload) + return true; + else + switch_pathgroup(mpp); } + return false; } static void @@ -2973,11 +2963,13 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) int i; vector_foreach_slot(vecs->mpvec, mpp, i) { - bool inconsistent; + bool inconsistent, prio_reload, failback_reload; sync_mpp(vecs, mpp, ticks); inconsistent = mpp->need_reload; - if (update_mpp_prio(mpp) || inconsistent) + prio_reload = update_mpp_prio(mpp); + failback_reload = deferred_failback_tick(mpp); + if (prio_reload || failback_reload || inconsistent) if (reload_and_sync_map(mpp, vecs) == 2) { /* multipath device deleted */ i--; @@ -2988,7 +2980,6 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) condlog(1, "BUG: %s; map remained in inconsistent state after reload", mpp->alias); } - deferred_failback_tick(vecs); retry_count_tick(vecs->mpvec); missing_uev_wait_tick(vecs); ghost_delay_tick(vecs); From patchwork Fri Jan 17 20:27:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943967 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6D641A9B52 for ; Fri, 17 Jan 2025 20:28:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145685; cv=none; b=GZjPQuF/57SUvGkLZ4RkzVosxgZRHP7f4BzbSPZOdMYC14g21ZsBlwoVVNw+kU4Kgd/hlANGLGQDgjm76mrn0LJj7U4o6dVsQVJ6aI6tHKyFwr1Q3pyS7/DdyExZdyQuid6gtqZIZTc0gBoRh3oKA/ptv/e49AiZ6ASmKouuYZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145685; c=relaxed/simple; bh=AnDLC+v/JPNkrtIf407oTYN5QdxSdOtQtFe+B6fXHic=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rh9u5mrAgcU5hxeqRV8OgljorTcvUd3S2j60MkqHSIdCDjIcFDF0V5fHsae9HQlnfPtZP0cvSOIOMGWfnZ42MhJqck4PnLRRGuFIp/IY7F0ummp/oeojdQh2wcyLbttO0jO+CbhXPlwOMUQmhlH/Cin8whptrnCkF71Kj/Ob+Go= 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=PJhALILc; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="PJhALILc" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-38a8b35e168so1759003f8f.1 for ; Fri, 17 Jan 2025 12:28:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145682; x=1737750482; 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=MMeQ+PvgWZsNNmZZXLtk8WAXyCPBDy2vQ6OusCTBFlE=; b=PJhALILc8o1tWHMpWinXMHRlrk+8/6whHoHvdwEQKtejG7auLn6RIGcnfLbdfSx6M4 VT3SgvI+b1OH8lt2KnD2lrnxSo+9a3Ma02S24ie0zNZPF9NZn927K+//aDb5wFNv0Ekf pa/Mgvwd+P1pd4X1zmow7FZiMxRZZZCHImxzUUDqEupSG/PgDeStxg97WH0EVxsBOr3K rz5XwR/Fwsq9YbCIcVxH2t/WP3iipJeP3I1paNEbPMSGjOWOz7I/16tQ755XnOxUjylB efs7dsBsN1CR5jZ/kZ+CqWFhbK9BrQgQIgXhHzlHrwT/9Cr7rTT1uxcdRM8Ep8nz8x+U 7p6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145682; x=1737750482; 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=MMeQ+PvgWZsNNmZZXLtk8WAXyCPBDy2vQ6OusCTBFlE=; b=KP8tw7PzNvy63ryWLTOUd07sa8+ryjfc0f2XXOK4V0f6P6HsDGlX7cRvvQqVYRem4i HU0pQIC94xNXItOM6PV9xEHLL19E6rWzpipG3PQMkgCQFpmY8EWFCD/0nBVI8K6jwcY0 VDBUzj/9NV96YyOPL3/jV+8N9uL6ELdN5xcuqDbwK4MRa5xeRJe0zg3cERcWkGw32pMD 3LGTnlfuQfGReLQeXsUQTo3owPyjgoZtvQxdzGT27+d6tMH+5exutECLmtaFVe4HctKo mZzN3itrgGe9cJ6Wb5S3fNKivRiCwHOb2b80k2Qj1y5s71wicyp7yXDLujPfbdkz1VNX DN6w== X-Gm-Message-State: AOJu0YwW5CDFUGthHWo0vTxPXjXff6+PLNUDhqO3lIS8j3ylMBXfZwZk DNGVOiI+WrmCOxIWvXQmOHZDb3NVtB7VCo4OiixKjyY5sbvFl6L6GsgXe+SfrSo= X-Gm-Gg: ASbGncvNLoWfILh3AymqD6RKh9G7VsW1ECugGRZZTyL484uTI31MGYz79F0bvZCxhV/ i6RwH9c5xkQfOTYdX/mjkWI6Ewx+M4EiBgfkJ/GSQpBkhl08HIXjmNPfB9aZ9AoH3vsc7BONpQo wdy0yZbxmbHKkGmgRGOw/tJMoxoJdhMIpSN2+ENBdpXMIjEr4/OJ3ERPu40ppzrK9HnAND15oZs A6/pBcxtHvKIpiYpJ7neCvKYPxLPRhVe/qUYYUqRGWKB0klZ6oVHEzRAUV9C0vQxvsyWwaPwPib aFoFTJOrW7jcLGPVbiGXToig9beo4efGXEakTtaAtXY= X-Google-Smtp-Source: AGHT+IGDCTdqpS0oNa8VtYUK+RZGjJ1fGrOXu0Nl4ZNqzrtujnmets1+nbtPRSe8u09wncp/pm5gug== X-Received: by 2002:a5d:648c:0:b0:385:f892:c8be with SMTP id ffacd0b85a97d-38bec54290dmr10006548f8f.23.1737145681913; Fri, 17 Jan 2025 12:28:01 -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-437c103f0afsm62738645e9.2.2025.01.17.12.28.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:28:01 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 09/15] multipathd: move retry_count_tick() into existing mpvec loop Date: Fri, 17 Jan 2025 21:27:32 +0100 Message-ID: <20250117202738.126196-10-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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 Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 8c2712d..753f48c 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2095,21 +2095,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); } } @@ -2979,8 +2975,8 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) if (inconsistent && mpp->need_reload) condlog(1, "BUG: %s; map remained in inconsistent state after reload", mpp->alias); + 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 Jan 17 20:27:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943968 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E7641AA1EE for ; Fri, 17 Jan 2025 20:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145687; cv=none; b=RIU7PufBIp94ztGtKQ8WgEp/m8C2am+M8LkaF9mOZAiNZWiECVr93Zx9GBUK2LjuTI+o4GjHlfSaLogd8VF7/hJJmuHlXff+q90QSXG7uBTSikWLm8nJdfcg6/GHa3/6AWUtzmbzK3Izvf2f/jUAqHCZwB/50Fu+c4dIIYZZn4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145687; c=relaxed/simple; bh=PQq3YN8k98NGU9J71/BJVmtnmIZSPl7ppr8W6Xw84fo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pwIt7zZHzDie8EMcY5SmWFINnbxYHFokYcbP5d3XuMYAq0YxWfZPZ9x7cAOw4AcXw9hxyyBo67jxgX4QlA2AkfO6wIc5tPg+sLHzvICrs2lIHX0jfLngzpYArF74qMHO1x2diNxVQRlwMt6GcTBVe/mOU0oQUGg2M80f+we66GE= 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=gapB4EYo; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="gapB4EYo" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4362bae4d7dso17507155e9.1 for ; Fri, 17 Jan 2025 12:28:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145684; x=1737750484; 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=mtZEbBUk8iooZM6o9hfD7+70jt04crglOHdK3Bq9exk=; b=gapB4EYo9PH9bwUcQzJtqBN7ctZ4rF92n23mXSwQB1pLXUFaVg1q6bCBQB6p2jgnoa PGEs0eJosY1g0kwnUPUAY12sF39TxAWlskg72uN44HQqXjbekoJLqz+8qoBCSTAsxZ94 lf9Ce4JP++xdAwkJlCTDDgZxrxQARUu+Ny3JcIJkStVrpLvvxzmnvRWmgJXYAiDl75vY vpWQ3JzbsHzdhB/n2vktGD6A2RXn4C9ijOIzrwQPphimmtx5O1kFjXx+pUwGdIu7lIQP 3Qh9f7guIp2ytvAX9uOBMZ8w20x93OjuZtDSz2EmXw7Svf+Nf8bdQGDx7Ra2rGOOTnGk htmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145684; x=1737750484; 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=mtZEbBUk8iooZM6o9hfD7+70jt04crglOHdK3Bq9exk=; b=bMUFNR3rDS8XGn1CbvOnRyXdL7xyhT1h2Mwr0ndj+nvJbzBEQY9p0GXmpocIvVUso/ SGWxXlr5j+MGQGBgWJhyTY8tNuTYvUHBxRv8iuOG6fb8uGqLww2n0xapzs4D7/GKBx5U /1/Vby0NAE8q4XefGkYUPMOml6BG1FmCkXgl8ZHqK5LdzIskInhBO/v90zAuEA06Jckh 0PsTQ3heOGMKw1RLmUcGCr6NfNfXlWCLzXUhhaYv2TVsxDU/+KQKqgP8VUDxSDE9wwxo 3UFs2JTKC/QOsKwpB6k8lim11WxEoB3BUYYH0xTnOfJkcA4L0G1txx3rC4+fIH+ZEJfE BAKA== X-Gm-Message-State: AOJu0YxF90qfWlh1VsO0y6nx2F5E50Zstd6wLc8G4YJy6rB428EcEo5k eOT5HxwEPriZN9nmt0VXCB4YbaIrHLt7kUri11nsHM8Y7Sb9AG/T5aC3kTGbKC8= X-Gm-Gg: ASbGnctvDTMqDA8vzixb5n2EzLVu/8Sgr7C2zUdKh/apYnC/+C/QsVX1qGW9QHNl0lb upqk3YHb4RWmvrSK5b2rJG/cgLK1TLhdenyQ7oC2COr1fNGssbO9OITEx4JSnZ5nYQ4YNvGiwG2 /CxPwa9naPpNJg0r7J3mmHU0jK5xAa9oFRySMAizB46KTgqghi3v28Q5syHzRNXnPUliMjiDihy gfidX5fdjGh17X/ndbIi0gyfCoF81WVc6wee+Fz2eUEGEeBg5CcnKglDUaKaegfRUzhYOTyuqn5 KuoRGVx/PPrExuEnDd3Z4g65U/+fJn0qEiIJmK1feVY= X-Google-Smtp-Source: AGHT+IHH3k9lxl0icOVYqKsSAHoiOLIiBpPPGfsUc7E4PLXz+H5PdrYJPdA2+oOxXT5YxXes4wD+6A== X-Received: by 2002:a05:600c:1907:b0:434:effb:9f8a with SMTP id 5b1f17b1804b1-438913ef2c5mr45212625e9.15.1737145683678; Fri, 17 Jan 2025 12:28:03 -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-437c0f03984sm93151665e9.0.2025.01.17.12.28.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:28:02 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 10/15] multipathd: don't call update_map() from missing_uev_wait_tick() Date: Fri, 17 Jan 2025 21:27:33 +0100 Message-ID: <20250117202738.126196-11-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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()). The set of actions taken by update_map() is a superset of those in reload_and_sync_map(), thus we don't need to call the latter if we've already called the former. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 753f48c..2989cb1 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2029,29 +2029,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 @@ -2956,16 +2946,25 @@ update_paths(struct vectors *vecs, int *num_paths_p, time_t start_secs) static void checker_finished(struct vectors *vecs, unsigned int ticks) { struct multipath *mpp; + bool uev_timed_out = false; int i; vector_foreach_slot(vecs->mpvec, mpp, i) { bool inconsistent, prio_reload, failback_reload; + bool uev_wait_reload; sync_mpp(vecs, mpp, ticks); inconsistent = mpp->need_reload; prio_reload = update_mpp_prio(mpp); failback_reload = deferred_failback_tick(mpp); - if (prio_reload || failback_reload || inconsistent) + uev_wait_reload = missing_uev_wait_tick(mpp, &uev_timed_out); + if (uev_wait_reload) { + if (update_map(mpp, vecs, 0)) { + /* multipath device deleted */ + i--; + continue; + } + } else if (prio_reload || failback_reload || inconsistent) if (reload_and_sync_map(mpp, vecs) == 2) { /* multipath device deleted */ i--; @@ -2977,7 +2976,8 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) mpp->alias); 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 Jan 17 20:27:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943969 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 EBBB61AA1EC for ; Fri, 17 Jan 2025 20:28:06 +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=1737145690; cv=none; b=sCFbzZ4Xv5pnjKSv60e5S/cUDnO1dGVO2Xf04wz9K3f9ig6URtItzT1cPTRWh8ag+SJ1q/IxWWk5eLmh1evjI4DH0zPdaiFEiv26TQrpuo7gGDwjrdR5sJiIYc4+GGFclGzDkFsnnGYAAkSCFS9AxcAkw9Mzyr34hhYTxNo7KnY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145690; c=relaxed/simple; bh=TXvHX6rD9UEu17Nh5kcx6HlH+kWUAnrqiphXjY6ZfO8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g24RSLyYAn5QOf9iIdbrP/m2yC4yFBVZo0q/tJyW+EpzTkivi9oDPNrkGYJqjpuK3G7KeGivZD8cqz13YFXBJHYmGxZY6TI8BnFESdOouMnkyJ6wiS9IkY7d3ZaMR/yExu62CNLG12mle+mdv7iSkmDIB0xk3vTghrYirPMXiak= 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=QwWBRAxE; 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="QwWBRAxE" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-43634b570c1so17586425e9.0 for ; Fri, 17 Jan 2025 12:28:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145685; x=1737750485; 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=3FAQR0CloH+Vym2Qp7L6fu+O3qTMs67J2krPs3YCWAs=; b=QwWBRAxEnaIBunSdyobIspWpzgz3Jyy7Xfg3Z9oIveQg37ZsEMYQOahEVJgu2oJWNT fM6j62gRyBtZ5Bd9GER5TQYUYnElrBboXh/sxVdO8cAP01Veh9guYeugfk3f23evnbrS C2P1qOKtUgYHZ9ZekW8l779+RC+nSdc9QJR//zrpvO/rlFQOwTEug2zJuJO2YlyUnPO0 usIUOPB8GkFReW4hj11eDb7nVIxD/sC1gLGalNBPhNROjQsT2+zbBk9/Du0iezJa9Hfj Rb/YXFfpQVLJFnzVOT3dQuCsAgmIMGWWJmRkGbE5Ucl/yBxBRrR6PoJq9mpwTg9m3V39 s6Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145685; x=1737750485; 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=3FAQR0CloH+Vym2Qp7L6fu+O3qTMs67J2krPs3YCWAs=; b=fM+yASzCu2BEEHOZY+gmLJABXb6L4iwnNiV6TojlWS3QgtZjbpSQxHhZ2Dqu430r0H W2s/4JuBh+TmAJFaWktABzySiVXNBG8oHlvcd4QOgoKWchZSelT5pYBKY1qgLMSuRIYJ KhoxERu2/oPeztt2gd9OLIp04MZqHKVgXehMucgYDtwIzmv0yRE6swtC4dOuI6MVrvUb tbj2rtAKoufdUbudxfYOdFSvCEYHzfVk9GmCsblk+8XBmNly63MoyGH0nobm/3AYwmKd jR9DMdPjKkAiy2dlBUppw8wkopRTumgkJqWAoZ/CdMQRvBMFSJdXgVgFkHhrZv+4Ayrr XIrA== X-Gm-Message-State: AOJu0YwkbfMN5wCUTdxI2syZfThUS3geM+Q+bfco+dJb7ZyZEbIVw/iA 2J3BuIrHQcPDWY/RvQEceUqZR1z+ff+Ok0ce+2Rr6vDGD0qf1kiP0XZspJ4gxqM= X-Gm-Gg: ASbGncv3MEfgv5N+zBUSxow/FstbCf434xiBeCBLMamn7hw1G+RpqagzcL2sEFEVaDb 9FBUy1Ja/ds7J6wP+/C94fBzErqt5AnuXhok9nP6P2cufyeHZ0pEzzpJDyVEhMAzx4E5UxdyZE5 rtQkHoL8wzbjKpYwDLiMRCwshdbqMilt8TN6yOilyKhe2vxZf84pSjqiht1dzXjNiucSegLC7lq TsR4M0QjksBw+EWKRgwbv1M8WEJJnzeD7tTaab+lqBpjcVM2I0veRDaRmCipu+bKGKvcnvEILZk MujX8bObc+dKmS7LOUNxpDnH+TWbUAhSt5PwGV+uc98= X-Google-Smtp-Source: AGHT+IHfvaYwFEnMZCD6Ui/qQgMnztKuN0IcItYNPkJrlZRMyXNrZRiAyf0DZHfzQ/lZfmy0nBTrZQ== X-Received: by 2002:a05:600c:3d06:b0:42f:7e87:3438 with SMTP id 5b1f17b1804b1-438912d91admr48038195e9.0.1737145684943; Fri, 17 Jan 2025 12:28:04 -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-437c752910esm106960055e9.28.2025.01.17.12.28.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:28:04 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 11/15] multipathd: don't call udpate_map() from ghost_delay_tick() Date: Fri, 17 Jan 2025 21:27:34 +0100 Message-ID: <20250117202738.126196-12-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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 Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 2989cb1..176d9bf 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2044,26 +2044,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) @@ -2951,14 +2942,15 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) vector_foreach_slot(vecs->mpvec, mpp, i) { bool inconsistent, prio_reload, failback_reload; - bool uev_wait_reload; + bool uev_wait_reload, ghost_reload; sync_mpp(vecs, mpp, ticks); inconsistent = mpp->need_reload; prio_reload = update_mpp_prio(mpp); failback_reload = deferred_failback_tick(mpp); uev_wait_reload = missing_uev_wait_tick(mpp, &uev_timed_out); - if (uev_wait_reload) { + ghost_reload = ghost_delay_tick(mpp); + if (uev_wait_reload || ghost_reload) { if (update_map(mpp, vecs, 0)) { /* multipath device deleted */ i--; @@ -2978,7 +2970,6 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) } if (uev_timed_out && !need_to_delay_reconfig(vecs)) unblock_reconfigure(); - ghost_delay_tick(vecs); partial_retrigger_tick(vecs->pathvec); } From patchwork Fri Jan 17 20:27:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943970 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.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 7A50F1AA1EE for ; Fri, 17 Jan 2025 20:28:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145690; cv=none; b=YMh8IQb10OTp3raAhOhNDfVsYveBI9VERX7KUNsiwWstx6RKOrSzTpEdo2131MvdgWzsc1UZTYhOdpKoXnD6paO7dX4TLmTgaw35niGvQEl+n9EfaOzqZwfftLqogaCtbEUcvF1vOOw6PGp+ZLDAbPIbR4T7xtBxntF1IYgdd2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145690; c=relaxed/simple; bh=vWCCqSymVQVZJjUaDKlnAIn/GTnVLywSJ81chCvk9Ys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Etx1Cc/SslRWSud7Jxc+LgW6nDOBy+uyWRVOxkYwy1H1XbYVtYgMirdJ7NnKYBA+nuLHa8W9YSIkq06HZeBFvOuKZMZ//KTfoR8unUrIdiY0/MBMOLjJ2iaz+718peXjEBA0IXgwCZe6BKsxgZamqQYiIjRVabGDz6gLPNQ2dIU= 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=Vcm/VU0R; arc=none smtp.client-ip=209.85.128.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="Vcm/VU0R" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-43635796b48so16255115e9.0 for ; Fri, 17 Jan 2025 12:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145687; x=1737750487; 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=7X1RAB9tHrujYQWSoZq/+1EvABXkN+c5dE+6ufibWnE=; b=Vcm/VU0RkMFA8e8DlSsdmOoGN15c4mH4StuPVjjzLkqqdtJDZx2i2BaPtiWOKrSems GtUlSi4bXpRE0MNUmdtxbYJUCA2a6x8QJieq98kJmwHcSP/+Wf2zScb3peyJFmckih1A /AZ1lq0LPgA5SWvXQtncUDjp93bvIYO8dKMpdY48W9+6IXDgKW1IN9mrkezv1yY9xmHO AIDc0Uq8ijflp3JrnVV64jj1emUQ9xmG873Z/+RD/DGWfKqtuCGlyXgldG/RGIyZ5KaG GkOMTR63+G53qNOF9bxLWtiKoc815wBsCuOJbd7quaY0jdH2oS1ITnx81ekmZbgCjuFU VMlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145687; x=1737750487; 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=7X1RAB9tHrujYQWSoZq/+1EvABXkN+c5dE+6ufibWnE=; b=TvStyhxP5cxKCEG6h/lp8cBWLgCsrxyfiI3xtPLhSlpdvK72z+13IfUjXugVPx6e0j 5gzlJUb5qEFeTwNQKskbwTpU18euX200BWV7Oo7PbmuTtRfVnGH5HsqJrsGfR+S5B5vZ 8XciWaCHKNz07MbFwyn1Z2zPL8eSjBpZok9VSQcbZSsxCbtm7H+Ci7fd0akd+NoG/YbS FVQM3AH4itIBnXX3I2YOv9UxqTbdcG1YAy+0/bOIDD0sXCDIROye+Y8aeGKR4QPgv0y3 rMTCmsf+GmbF4Wh53V8UoMqiMyKi5ChPPYnmcFMQT/dBqqUuAhy5Yo8aq6IsGaxeSQaD Xp2w== X-Gm-Message-State: AOJu0Yw2x9M5jKh1Deud5SccXmtTgAVvFZhYTm2Av5CKC04az/K801Nm 9pnZEqS2oBLEyFrqt7cm/8ACbBFmbCunsCJXDcV0dNc0ztbQho+FBQ5sJPX4AWs= X-Gm-Gg: ASbGncugxJD5ZvVw9ZY34Ht67EF3qP3DtPFKPLsNOKwmZZ+6hxGKEvGT1p9bH4UwWa9 kIohZGb7l/PZY35FR7GslkGDDNy6cGnqemiANbmBYzps+r3ZgAlaBWP0Rf70lsUSsZkexwUZONa g/gdXJzc9aJ0Rrxus1+vLqO3KCyb4vQPVK83FYqj8dtqb0sLmnPr1caoTnKWrZFG1jlUQm+CybB VN2e1FPbCqpl33avSr1Jxu6tZfdpYWueXZhucszCaSjDBWSF4o+1hda4yi4syxvrTIIN/SU2qk3 qnNpvDDiOyECjz9EeELpJAkcOzwxwapv53/G/LV6FCo= X-Google-Smtp-Source: AGHT+IEGRda2LntKUBBZ+wbfr17D5WBxBrBgbHAtoFmAXdqM/zzmkh42I43W7B1Hva1U238MYUDDpg== X-Received: by 2002:a05:600c:3d89:b0:438:9280:61d5 with SMTP id 5b1f17b1804b1-43892806237mr29965525e9.5.1737145686549; Fri, 17 Jan 2025 12:28:06 -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-437c74ac604sm104017515e9.13.2025.01.17.12.28.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:28:05 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 12/15] multipathd: only call reload_and_sync_map() when ghost delay expires Date: Fri, 17 Jan 2025 21:27:35 +0100 Message-ID: <20250117202738.126196-13-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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 Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 176d9bf..4063e82 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2950,13 +2950,13 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) failback_reload = deferred_failback_tick(mpp); uev_wait_reload = missing_uev_wait_tick(mpp, &uev_timed_out); ghost_reload = ghost_delay_tick(mpp); - if (uev_wait_reload || ghost_reload) { + if (uev_wait_reload) { if (update_map(mpp, vecs, 0)) { /* multipath device deleted */ i--; continue; } - } else if (prio_reload || failback_reload || inconsistent) + } else if (prio_reload || failback_reload || ghost_reload || inconsistent) if (reload_and_sync_map(mpp, vecs) == 2) { /* multipath device deleted */ i--; From patchwork Fri Jan 17 20:27:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943971 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 E7D3C1AA786 for ; Fri, 17 Jan 2025 20:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145692; cv=none; b=uQJU1EjDf76bW0w8CqXu3kPASomf4u3nBFSiZlNwYgLDDTnUXDAh4DusQHtCf9YNXo8Njxn/P6tgSI4a9gEvjgesJUbMqwipCeiuVyjz3GtCBzIgzPU8rDrr/GGKjXkwixowWAzKz93SvW+JkAVh+o5JLru+z1U2o/Px0M5fOPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145692; c=relaxed/simple; bh=FAXAm1J8YRS1gWxlemXx3kNV5741Cdivd+wuVBMlhRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GP6Ktfc0awwjOrHQldlovw7Vtf7rDSENVTKl5q4laYjJyBLcjJn/yGKhUuEUeuU7V5U9NZi/jSaB3fLa5s1Rk1gJ4e0L85yWhEGtAgMurKMBlRWo8hn+LKZzLy1Rq8f00yMgrJ3c7nGeEHYNCkOt08xPX3BGCh1S7/7bKSycZYQ= 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=WdNDNSar; arc=none smtp.client-ip=209.85.128.47 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="WdNDNSar" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4361815b96cso17216205e9.1 for ; Fri, 17 Jan 2025 12:28:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145688; x=1737750488; 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=SsqlaGkhrUAicGMTeUUETjsiwQu1kbZNgtHvHlRy5SY=; b=WdNDNSarFvj2SxpjPfDc/c6HhjXrhApn94z9mXmaqAFN+45RkpEh5OjKQF/hA/Rmvk 9IpqPOJ4PZscpCvn2w0LoUQB8wYM0jGAzDQ4lxaTdfaIU2x/8Oc0jJrSKmqXhp2Q6aGu /AcIPUAjYFG4coRqGtEMQ7os5EpsOCgVuQ7MtUNT0jX7tV31Z+lTdn3SZT1cEm49f453 F6NYFlla9dBlYOO2VZsuYaOyp5YtjV/bjf+Cn/rAMuqT9YNIn7I6kZr27Lz3EjYN/zHw m5ofh+ddyX3znzATCM583fAYYH2KgusytrsOMRF+AwTTW4cqnppWE/8mm8AQWDjdV7Rv 514w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145688; x=1737750488; 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=SsqlaGkhrUAicGMTeUUETjsiwQu1kbZNgtHvHlRy5SY=; b=YFJ6yh6xE9byvvcu9VD5M6SSmimtNyqoaY8R4ASTaYuLSMhJnUhmu2oqVo0DKMh8wl 8m3LKx0wGOspGd8V8n2Av/7ioCCmXD65mVFApxYlrynSGV5gh3AbTKK8mI1gAmVoPWKC 4Rnszrk2npNAYdse+Ywi45VoFir+2HEgR+irVkBKEgvviLbDykblwWvntUvTjOmAmDM1 L/ieGaqJnIzN905ONDyY4HiNYan0aT8giElh+2my1uzD72z0PmuONqy0hFxsjOC74PUM aymRPbWcn1Nm77An7e7Sqsh/iZs9qYTNTE9LeXtfzNml3gMiFYXwVbUl+OWa/j7TJCkf qcbQ== X-Gm-Message-State: AOJu0Yy72/rzijBVyf+KBv3QDh4XGofdE5P9tahuZBDGUHqXeZIJxMSt ja+66r7ZE8aGfkEprkdBShteS4kCmvHGmE0Db+bk0EZ6lY2M09Kma3eAY41rFhU= X-Gm-Gg: ASbGnctZId8a+Fx/1csq5FBc2/RktJbZAe3HcbCqlfVdGb3qg7gQ3g2zmJQCdAGeaua DW6Mjz4CwXm5jrVdABZcaHDqsTO6VFfvn79Bxmq4LT1hO1IH2Z5B5f8BNzkUFXuqGWyM9XauFZ+ 51MmFH8SQBXxn6vW011yWz8WAzNImhw2GQNRc0BiYJ4Al4GvbuPn+KVhzgYlZ7R9FJS9IYZrLzL 1jlPyY/ak/06GVlmYafb4G5PGkKoDqltfho5b0vp7i+xYbYePKxmfjaNezgEbzREg6OIdSjHGjU V9Ayd07BwteirCPrgqeEQb2Si/q8tXmT9vpomhcy9ng= X-Google-Smtp-Source: AGHT+IFtJElpGnK9+VrwHBgVblY+FsGIgYL46m7lhyy9aHewB0iUzE7K731jLoyCofkeZfQt2syzbg== X-Received: by 2002:a5d:6d86:0:b0:385:e38f:8cc with SMTP id ffacd0b85a97d-38bf59e1e56mr5375255f8f.38.1737145688134; Fri, 17 Jan 2025 12:28:08 -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-38bf32755f0sm3370260f8f.76.2025.01.17.12.28.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:28:07 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 13/15] multipathd: remove non-existent maps in checkerloop Date: Fri, 17 Jan 2025 21:27:36 +0100 Message-ID: <20250117202738.126196-14-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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 update_multipath_strings() returns DMP_NOT_FOUND for a map that we are tracking in the checker, the map must have been removed by an external entity. Remove it. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 4063e82..792b94a 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2413,7 +2413,7 @@ get_new_state(struct path *pp) return newstate; } -static void +static int do_sync_mpp(struct vectors * vecs, struct multipath *mpp) { int i, ret; @@ -2426,21 +2426,22 @@ do_sync_mpp(struct vectors * vecs, struct multipath *mpp) "couldn't synchronize with kernel state"); vector_foreach_slot (mpp->paths, pp, i) pp->dmstate = PSTATE_UNDEF; - return; + return ret; } set_no_path_retry(mpp); + return ret; } -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 && !mpp->checker_count) - return; + return DMP_OK; - do_sync_mpp(vecs, mpp); + return do_sync_mpp(vecs, mpp); } static int @@ -2944,7 +2945,11 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) bool inconsistent, prio_reload, failback_reload; bool uev_wait_reload, ghost_reload; - sync_mpp(vecs, mpp, ticks); + if (sync_mpp(vecs, mpp, ticks) == DMP_NOT_FOUND) { + remove_map_and_stop_waiter(mpp, vecs); + i--; + continue; + } inconsistent = mpp->need_reload; prio_reload = update_mpp_prio(mpp); failback_reload = deferred_failback_tick(mpp); From patchwork Fri Jan 17 20:27:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943972 X-Patchwork-Delegate: bmarzins@redhat.com Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.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 358EF1AA1EE for ; Fri, 17 Jan 2025 20:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145693; cv=none; b=fQW0GGkuuxipBRl7g6koB7kI0fmpPkuk2/5M4PhXaJINYomI8hx/WZ/EOw62y1xgJsV6FbIh82u79O+NxvL6Xjnh+UfS0fgfg+lSdHtfAOXiphyvaybWiay+oT1JMJefapVGVVAPUGL4AJVOUqRsAhXqSDQAStydaH1ZSg1E/Fo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145693; c=relaxed/simple; bh=xHUkZazwHyAeG2ZMNzJppLmTlvbRddij360Ud39JZwk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PSvXgX0XC2Hkd/vQ/u2XBbZ1H9tVQG07+rTiJ9bCJ6bGxEU9oxNmtgxBIQLn8TpAuOq+aWXGx94Q7lEZfxb1Ozg2pbidcXQlWRS47M2KkCk/3SK9QYCAu8d1rW+G+wRNbro5ANM1ZdqFaVwHCQQvj/+A5LAJl1Sf5a+8ctWpLZs= 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=BOQoJH0W; arc=none smtp.client-ip=209.85.221.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="BOQoJH0W" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3863494591bso1336376f8f.1 for ; Fri, 17 Jan 2025 12:28:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145689; x=1737750489; 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=8Jn6VGB92oWmdvSOIXLOBrkwFqlI6GUN+yj8zQcJ41Y=; b=BOQoJH0WI19wMm0nfLXZXjoo9fCqz7bfNdC+vAOBrzvkCi4COBcFqAmUDoahZk9XpE yYL+ftvV1mbR5ODtQ/BMcsQLI6JE+YYyzAG4+cDM6fhyYyRl7gO7VBgA9onN2X8L1JsS mmOD0SpBBrSeWftdS57C+2MC+uGhslLsyf7zNoAnrF5p5lG3sGlLrrKTXfh1BJnwwL0U VsME5t1gPEsUMtfXSmOmxUYEMgoqBXM8yJvPwpE2SA/x2kZB73zRwP4QgovM4jl2rzwS FEn1Tnnam/26Oi3OoGgibDIZVrT8vlEhZHPiIiWka53+zg80JzLfqkNJqJfPgefu5QLy QE9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145689; x=1737750489; 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=8Jn6VGB92oWmdvSOIXLOBrkwFqlI6GUN+yj8zQcJ41Y=; b=u8Oac13W1cqX/75tUIERwKvnMBrvQhC5RV2nG43+XNRbxE88DstWW9V/DEkmKf7Je9 /ZagQrH34+qa8ffSkf+md0ycCuFA7zu6IqT0kySapmT1Aexgo+S/IcAYy+JzOza6mQzT Hmf1yTM4zPr0p6rt5Gr8XPXADHgE7mCHkl9LV1K7Upfh3Wf5RxLhFREk6UnmX1IDSsN8 SPBmE0Ax6jZJ8qRo1cs42aTWFGlQ+KG0da0RrSS/Ig2PI5hJf/BIe/v5eG8ubvbB6gO3 OeHE1M+bCauHiH6ZePE5P6iktPE5SOtjehShUb2FuQsKz0NLBarEnFguP/utpPH/we4Y hV0Q== X-Gm-Message-State: AOJu0Yx67TQr2I1azypgpXd96A4qcQ6bBN1CGOmawd1SB4zhQhaUev2e wWH4Ltl/aIkZwRRoXyj4MMT4Vi4kpan1sK/DA/7HOMVbsNSEsdoLSJ6krGCbO7Q= X-Gm-Gg: ASbGncu/Z8jHFzey5lemjCR2MPu6M9VLcQ3A+KPEIUE7TfEln+9QDH3d4iIyNGDeQK4 pQVrBOUj0Z5o7gq8ahge65DjH0ONmCzKeGdSQk7vJDd40sWh9ovIRU945S0SvLMR2jKCKEotXyU moLHdTVkjCeFUFWmsgd2ph8XYSpSnoG+LcBufD6ZFp5//24VffGZUQfuVSADmouQKiXn4fNmoIZ aD7G25qK1a6QlVf3IS/YMuCfm3Q0JevDTKLV0OBjlYGT34+IDuBGbT+BNoiFD1qZS7nks4jDnwh RwpdW2XDt2NoUKBNde+RVgT5I3zP9qjYRTvpc5d4DUk= X-Google-Smtp-Source: AGHT+IFHJfWZMtxq7nT9c4IrZ2Ke9cYInCf50b8yJimUl5ZazhH6IhGhnMtCebl6Vl+Cj0l+b7FBQw== X-Received: by 2002:a5d:64a1:0:b0:38b:da32:4f40 with SMTP id ffacd0b85a97d-38bf566e69cmr4270162f8f.2.1737145689310; Fri, 17 Jan 2025 12:28:09 -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-4389046bab0sm43257205e9.38.2025.01.17.12.28.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:28:08 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 14/15] multipathd: remove mpvec_garbage_collector() Date: Fri, 17 Jan 2025 21:27:37 +0100 Message-ID: <20250117202738.126196-15-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-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 checker_finished() code path. Remove it. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- multipathd/main.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 792b94a..310d7ef 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 @@ -2983,7 +2965,6 @@ checkerloop (void *ap) { struct vectors *vecs; struct path *pp; - int count = 0; struct timespec last_time; struct config *conf; int foreign_tick = 0; @@ -3050,18 +3031,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 Jan 17 20:27:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13943973 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 AC85F1A9B4D for ; Fri, 17 Jan 2025 20:28:12 +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=1737145694; cv=none; b=JqLe90MmYKeF9bhFpvMcGNGv27rOwX9KD+q8Oc2m9tMKsYF1uYjJ3HtfVJvFYOimY9/ju6XOcM3w9T8+iSIgIAhQAvkyz/eX7ZYqDlHhq7tPdnO+FTY2A496UFvLX4MEt/wdcScfKBizu2/QgoqbYpIMSFrxU/t8nIQeGuyMghI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737145694; c=relaxed/simple; bh=fdB+Fgxlk+RDksRPcgzJPFGP3POrrXtb/LhA6De2azs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B1ttjk/L+yhiGbXZ5KFbvOxwTvog6HDnZ+Z329a3zLZHFb1QJg0UD+dzJ4J+3cBKnLVLn9p90AzS4xo+jhRC9YcfalewQUwq3PYWp1XwOutAD1Zl/cMybaVL8PegDRdmEXjJI+SF/MaHlkY4z9Fp/19dWhZ4z7mHV5i+Zn8TmCA= 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=a1ZUYZJ4; 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="a1ZUYZJ4" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-436249df846so17087495e9.3 for ; Fri, 17 Jan 2025 12:28:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1737145691; x=1737750491; 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=i0fkqNdLYiBF+RU51RO+V2INehDNd1zCcP1iEidomaA=; b=a1ZUYZJ4V0n/YfPW4tUFMnYl32J8m3uYyHANuT9BwXwrACbRb9aLZ7Gvtnx8thScSK /v4HjVjfA4NFgbPCc9TF72SK1V9eQ8ox8pOYXOp4Sn+qizhxjrx89PaEbuqLSVXECzK9 nN4b45d2TjVE9yk6u3pxl0/nzycgatsoNre4iXe3+icoTCElxbrO32FCBIulF+EKd2iM oAXmMPBF7UZw5nyoXB9FSE/QfHQBEgCAjf+stHb0Zqc3DTQJVtzbXLo5nUOjTn5FcOdR YnXoVO/lrueond9KcgQGTIM1g/II0NgSWWsVmAB4mUopTEPlBokTU+8ElPoKuomW8elx r1yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737145691; x=1737750491; 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=i0fkqNdLYiBF+RU51RO+V2INehDNd1zCcP1iEidomaA=; b=STIQJg2ejAeYEsqNL/dBPQAetid27dYXLcTCVje1m6IZGW/Q4ecL4Mn3X5tXrF3scv CfB33TRoojRbbpTHWvroThdxd1BMfAfNBIfmzfv4TYyw9BEG3BMsbtCWQljGXg5FK1dG e0Hk03ag4H1XPUkhn97CvZAczaH8dMGp4E0e8qeiBp7qt9RcbafSGpQI1mPJcvUcF+56 dR29gPPrvytup+P7J+YQfydmrnLGs1kitaOHsXt+DaBWSha79dAjfLuQpBoJregXJ64s gU5OhWy2zar+373In2cWKce64WCMVYzjD4zrsG0R7/SqfjzSM2UmZ8/79BkHptkcWhOS Kh2w== X-Gm-Message-State: AOJu0YxegnHxxh4olDdpzyjO6g+oDQM1fqKc0DhaTPF7Ru7Sg3hJyLJZ jbvhpmGxO+LUbChmBSZN0O8i66jvSxjWGKjoVdDSW8fKa9jBcWUww1I778tp8Vk= X-Gm-Gg: ASbGncsAaV/HqrsUHQ2nxLxgNset5SkdurVRXXTmL4SMhwGxKEgL2n4/EXfVF04r3WJ ELT90RYvIwvPfMHenGhLFiZ69xvuFbc+yn79l97q4bNUJ9O+7e1Wa9Mfm983VO1g4pp34MT8BXp h0oeuP8aqMEMUviexG9mhnizEDivkU8M9jPOu7nsXmYOA2rsBAAzUCOWRcbMXT67aXiUqqtNSfZ 2l7bjcGUXNsAxJntfg/j2WHQl2cvMsnDO0dPtnvJVCk4HiYiWaj6bYUWJ5n/x6pTPP+lqXvsjNJ d5s9Xj+fQFKwa+aoEwNQNWcUtHe//vKSJNE7HqP3PlA= X-Google-Smtp-Source: AGHT+IFX18sIVs8IIX4yFuk1VMwCQzqT3BCNJGYu8Xh3F55MzTCqEEbTW8e9IteqoMvlKP1XfrIKUA== X-Received: by 2002:a05:6000:1863:b0:38a:8d32:274e with SMTP id ffacd0b85a97d-38bf56551famr3788641f8f.5.1737145690754; Fri, 17 Jan 2025 12:28:10 -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-38bf327df12sm3381147f8f.92.2025.01.17.12.28.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2025 12:28:09 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Benjamin Marzinski , Christophe Varoqui Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v3 15/15] multipathd: enable pathgroups in checker_finished() Date: Fri, 17 Jan 2025 21:27:38 +0100 Message-ID: <20250117202738.126196-16-mwilck@suse.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117202738.126196-1-mwilck@suse.com> References: <20250117202738.126196-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 multipathd calls enable_group() from update_path_state() if a path in a previously disabled pathgroup is reinstated. This call may be mistakenly skipped if the path group status wasn't up-to-date while update_path_state() was executed. This can happen after applying the previous patch "multipathd: sync maps at end of checkerloop", if the kernel has disabled the group during the last checker interval. Therefore add another check in checker_finished() after calling sync_mpp(), and enable groups if necessary. This step can be skipped if the map was reloaded, because after a reload, all pathgroups are enabled by default. Signed-off-by: Martin Wilck --- multipathd/main.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index 310d7ef..98abadc 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2917,6 +2917,34 @@ update_paths(struct vectors *vecs, int *num_paths_p, time_t start_secs) return CHECKER_FINISHED; } +static void enable_pathgroups(struct multipath *mpp) +{ + struct pathgroup *pgp; + int i; + + vector_foreach_slot(mpp->pg, pgp, i) { + struct path *pp; + int j; + + if (pgp->status != PGSTATE_DISABLED) + continue; + + vector_foreach_slot(pgp->paths, pp, j) { + if (pp->state != PATH_UP) + continue; + + if (dm_enablegroup(mpp->alias, i + 1) == 0) { + condlog(2, "%s: enabled pathgroup #%i", + mpp->alias, i + 1); + pgp->status = PGSTATE_ENABLED; + } else + condlog(2, "%s: failed to enable pathgroup #%i", + mpp->alias, i + 1); + break; + } + } +} + static void checker_finished(struct vectors *vecs, unsigned int ticks) { struct multipath *mpp; @@ -2943,12 +2971,16 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) i--; continue; } - } else if (prio_reload || failback_reload || ghost_reload || inconsistent) + } else if (prio_reload || failback_reload || ghost_reload || inconsistent) { if (reload_and_sync_map(mpp, vecs) == 2) { /* multipath device deleted */ i--; continue; } + } else + /* not necessary after map reloads */ + enable_pathgroups(mpp); + /* need_reload was cleared in dm_addmap and then set again */ if (inconsistent && mpp->need_reload) condlog(1, "BUG: %s; map remained in inconsistent state after reload",