From patchwork Wed Dec 11 22:58:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904301 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E2611BC085 for ; Wed, 11 Dec 2024 22:59:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957981; cv=none; b=G3UZC/QWQspxgQHjb0WMFxq/fAe+VFVDlcZxrgtfOp6dnnyzZv/YR6zPF4g/eMMVquynkdMYBNOgj0cfLzcWMdCSxpJzurnUKe0rilFf9tRnOyMfH0ZtwKXR6g55WtQzVtdditjCSMeifjSs0B7Bbehei9GNbPI/PPNH/W66F8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957981; c=relaxed/simple; bh=l1zcAdauQ5HWKjJElzIGYPbPGwY5spwBFDiUUilZKww=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KVHLYmhKnRrDuZvlEqgegyGhtGJiqkIBlTsYWDDLfDS4G1HvtSKgMpAPHgYP8vE6UFqHyXezli9g+spm9u1n/PkztyLODDLjTRikZfmarZGfOQKDTOjD/DPJGYOh+hvp5+aIRi+UjbpvDVAj9OraoMmMz8VvkWrIP3/s8ICJmvo= 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=Y4mv5DsT; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Y4mv5DsT" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5cf6f804233so9284225a12.2 for ; Wed, 11 Dec 2024 14:59:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957978; x=1734562778; 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=mqFw13jiQyGBvKaQM3cuMvdhGtZMk5NrzcPULqi9Gao=; b=Y4mv5DsT40ZyEjhmFC9LypYNp0ioTTa2vvbIwr9dYFAeonVWVewy6SrXZTyCXmMf6P 4FjP4kS0NnJd9mOAOR3PI0VbsA1vFD2joK+Rwq/E0cC9SP0wRstpzvN+IHAYaQd1bRNV oiUohXAXQ+1AM0F2ro3tadiEUkjGSctS1ukmKNqLb+LfC+mvp3Ti94zrwadBGUN5bc2z 3uDcGbpxVEd+NdcABAJ/qFz86tS0PhrxqxGdUYgD1EroZ43DAWt2KvQDU13AlPDGGedG cThd0DHtbUjxrqMejLFvDqe7/Y4nOZYmGqAGuRfASSk+IlHGbc+6DoIewBlm5rU040Th PvxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957978; x=1734562778; 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=mqFw13jiQyGBvKaQM3cuMvdhGtZMk5NrzcPULqi9Gao=; b=T3WZuvb+QlWgYBCVWtuKezb5aeBEiDXUxKIKISMGgyVKBv398nQMxYoxXSa+w1sAg8 MtJXSAJe4IzVP3xmWk2mC9ihRa0d/MXtIpziDzEadMXzzUrBdyy+IPQ+Gr7T9utigFfk BdK0+wY0H593B6FzcWVQUDxpU7EBI1PUz03cPfYHuZYCgA4lF5d91KdIuoXsi2ShI4VR kUyXpawhEhwvaOcAf+sNgaMfN1B3If75blUDwZfNN0cN2hqlfWYSHojvJx0e9/QYtYIp H10Sg/ENiblp456v/iNIhyh0IZjeNbJPGzyHVkJxgOBpJfLOyk6VdhbDJ/iTzcrsuFp4 3AWw== X-Gm-Message-State: AOJu0YwZWSY33FUIoIGGBcc3lcxbTsy+9GG5uXHegq9J2faKVVZ3DPym +4TXY4+UM1lEe8B04/Q1UE28ukX8M+ahddH3NlmhzazpGmj2Ns/7oQW0waFw+sk= X-Gm-Gg: ASbGncsLGu+b+zdU65CLb2pIgNxuqiHkanH2aBk+xwZCtXRxIxQ1bNe1d9FW2FjC5Kw VpFW720bWSa6rigvwxq/DeGbXCYIyKYK46x6olzGMvfOYEPrLIvDDCEfSmjphlUrP/3Ab8x877/ aCcw3+czymwZQalAhpfjylr87cPygUbcjT3t+QQkhbXC96p3wdaH9doXlT1bbD0RwLs7TzwcIvy lCF0MgwjcDjexe/gNg3CdjBV7IrHCo26tl1gYKl4mRxQhxFPD3TCF0SEy0lq9wziReJ9BpYv0Vv vq/OXfY/SPIeR6mPhnWyCZZ6UXEDk7dFKPha3sM8 X-Google-Smtp-Source: AGHT+IEoLflzmqd05uUiRtpZk6OC1xZTsUhI08b4OVVIuW24vbDxtBEufRxQz81u3VQG5MT4XMSMPA== X-Received: by 2002:a17:906:9a95:b0:aa6:5d30:d971 with SMTP id a640c23a62f3a-aa6b11419f5mr384629766b.11.1733957977466; Wed, 11 Dec 2024 14:59:37 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-aa68880b344sm516989866b.184.2024.12.11.14.59.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:37 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 01/14] multipathd: don't reload map in update_mpp_prio() Date: Wed, 11 Dec 2024 23:58:56 +0100 Message-ID: <20241211225909.298770-2-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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 Wed Dec 11 22:58:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904302 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3BCB1F2389 for ; Wed, 11 Dec 2024 22:59:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957983; cv=none; b=TiW9rOjYeCT3r38oxBEwE+kb6NDFwpFwGHi7uSGJLcK3WkbDdO+vIRLoiqWT0UygurLGduOOQ7WoVlDBm4lF/maFrfu89Gd+aJSfu6ZZL4xKM8Y5c4MyjXpAguQK8DwLMttf3VSbX67hz4d4v5SSW5WhIDHs1dYjEfjCtiWlTTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957983; c=relaxed/simple; bh=R7NFayBjk2BPl8FKrvBqxjsKdR6qHuvgsv5AQtx4zn4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nIniZF0t7FIMPMefonjERglYDwRIy3F6V1pQGDSMoZtueSQLtDi+wTplEB6AWWyUo//lr4/H0Ct6djLREWmFyDZ5ldtwcXc9ijv482knfIdRs6KeWGKn/m2JKgYBV3VxIhnQP1GdMEHueOTpj6edssjLF3KT3Zw8bC0BDCTtE/A= 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=hAUPU9Y7; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="hAUPU9Y7" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-aa66ead88b3so826892266b.0 for ; Wed, 11 Dec 2024 14:59:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957979; x=1734562779; 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=vhGRGkirBXyp8EBWifTH/q8P1dNy28kbRcySFZeUQkY=; b=hAUPU9Y7mw+kw5XyCeLBCt2YcdTFrkKMGpd22fEJLCB5odRDIFNW6wU3eK1vX7HJag bRRM8zWwF/sHJVYv5vKPg2TjP4Z22mYVjjkiJXGICYjRXRb/a4ZlZYM2T1N8FV6dFiuP uAZ8v3a5ZrhSFfBL+bsbz0IfyppF3B0ovG74116ksM3eB7OgQdvBh5TV7u59FsD/ZHGM efy85cxKkn61POwMm/Z/QBtoFbQae2VQxFNtR6h+BLxS12kvKV7C7L5cg+x5td1TUlkl FDrzwjfwWYpuo32dem6AGYHbfhiK9MhuhpzMeLrWUEA1BoKQv3b4Ly93jp/saylIKi5n Blhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957979; x=1734562779; 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=vhGRGkirBXyp8EBWifTH/q8P1dNy28kbRcySFZeUQkY=; b=RTnmv/HaltVWhvbANxZt9vAyfLLNO3rAh9b4NfwNaFY3n3KXqAyrVdBR/iYYHL3thp WTvh599jojhBW4Q6hRml95XvR15f2uWUaz2kudLK09JZmC/PMLVTFTZqFqMWRArd7Frm GxvuncrzvDXeiSGKhwnJbhJJvwZtqNxZ1wEd8oy2H4IbjaGXDnPtiSnw0/EOPiWgEZ4d H4y29ZsaiMNDP7A6SasSF7mkct9jKBynr3bLnP8QG9a7aB8Y4OGPRnllL/zsemHO1Z9o PEpWj2wpB+EIqthUBoBlLVQWYQRL7CDLbgTN9RcoXKH/wir8DNUB1ADtcgqCe0QDUa4K 9eFg== X-Gm-Message-State: AOJu0YyA6hw/3aSLShZWFMQP4/S+xRCmTmHfr/qEuKxxCc8Uqk1q+7et 4O/QcRuVn9QAHcR+H6V12c3c/0nvXmGl+GyDkUzgPmt+YvXXOWvLQPPMUEy17wY= X-Gm-Gg: ASbGncsWS2SUsmaGQMhtR1h2Ljz3NS53fj20OSnkv0toae9T715tQ2i/qDSi6HOVNF7 QPDL+upSHAMoqrbvJfol/CA4mI6uodXXRza9+O3WOLDgzqO6FY4F9TNGPUBkl4Iea7RFUsBkbQJ X8oWKGKpfm1ki7hvjR0/+YQ0fnWUClok65ALZq6phz2yQrjmBOCQGcsheZc8ETwyaAnbx+7VCJS 735o0YJfGjjerQpFLskiuZ3QqmlDnyc05SdzEsGppvofqFLYquoobORe932lFYmO6Rn4HWnq5JF C1+z0ESH1iMaliW8sQtDaw+FJYShQv2E8b+q2NRF X-Google-Smtp-Source: AGHT+IFT9jjCPbfuYFn2CXu9BSood7DWZKNY4Js+xK6j4KAvKUpXxG2yybfpDLAV2n5aq20dVX1cug== X-Received: by 2002:a17:907:93d1:b0:aa6:9017:eaa5 with SMTP id a640c23a62f3a-aa6b13b138emr342491766b.37.1733957978814; Wed, 11 Dec 2024 14:59:38 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-aa6749d08efsm641073666b.29.2024.12.11.14.59.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:38 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 02/14] multipathd: remove dm_get_info() call from refresh_multipath() Date: Wed, 11 Dec 2024 23:58:57 +0100 Message-ID: <20241211225909.298770-3-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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 Wed Dec 11 22:58:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904303 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.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 284CD1EC4FF for ; Wed, 11 Dec 2024 22:59:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957984; cv=none; b=ODsNOzu/pChM+/h4bDt/1wCnrW45BQr+ic65UFRE7JsVqMr6AQ17ID9M53/mnoKnqz3gFRlipWBKB+Lf63rgxHrU/aIKA1lPP0sTDBywR+oAW6VFEcWsZaZuY/IF+c2Mp3dVHtKiOSy0A1LNxJDs15aEG4ksuqamGvnXi422Kfo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957984; c=relaxed/simple; bh=0QDGzQbtPqdNTozXX0mMTyFMLbTLlXtwC/nNVePloHM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cWqLU+ct9e25rFobtUyUvXFtVlFGRvKphqAB3hkT70nz7TSEzFvSQFtQi4+N0YV6Xc4fp58SVzdU38vLILeOV1Cd6tYLO3dIZn9ZlW+fZrERbp5qeYI5d3GJujJMFiFAqVadcJ/+CNPFf7h7uLxPqUlEPtWo0xmCutdRUhYIsiw= 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=eptqk6oZ; arc=none smtp.client-ip=209.85.218.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="eptqk6oZ" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-aa696d3901bso652765866b.1 for ; Wed, 11 Dec 2024 14:59:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957980; x=1734562780; 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=BgPJSin5jP5VRIqUQ9862eG8HLIn33QQmOwi7IYM680=; b=eptqk6oZrR6T1rDDZrp02+tpgS3T9qsUd01AmR1dVuIP+eomJ26WguZtbyQMcaiDjY IY7iW/OI6Ppu4IcyV1T+Adz+L8bDfrNGxDMlScMTOYMWxVpPM76lIZnutc6IFERhCr14 JIb/j1v5qoQwn6lxpxXzacSXpCQxq/YM+d5hczWeIhvc5iCTlaMKOEQY6q/xTaQEUKNh LoU+0xHiFlecZ4IYzvqLMbtQz35VJ4/AAN+qwemrNWD9IuluRo94sU8eIS+ub0N33PQ7 3Q2YtkDee4prqB8hXsIexc7jAZr0cDUodN3ktOnqynIxOll95nHXoMdHwYEsaqcOxipU cFeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957980; x=1734562780; 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=BgPJSin5jP5VRIqUQ9862eG8HLIn33QQmOwi7IYM680=; b=XFkDt2GMD+cJClR9/n0saPrrLqQdZZc0nlLtozOISArFJ4DIYHeCwnI7QDQQncvoVZ 65UvKsrNymOavDrwZiYcutrQ2FwqeJwqY3UPCBwi65L6ggkqlPSGZNYU5imnJQzc9n6w h19aFLWPwuV1pJoFA4nDiv/hm0wB7aIg2j1f11m9s0e3FPVhIZ1amP65TcSPj40GcTlx Cu0O6b1cVbTsO0ZSb+ArVWNmqpUgPckv8UY6tB4divP3i8vvH07iF93YJacdD02Y2Wb7 6LBvnxkh0m/svyFSGETN+ErL3dU3QtXRDUN97oqDe4YPobT0Y6DWoFJXbYmZ3jC4h6JI Hrxw== X-Gm-Message-State: AOJu0YwOj6QHJPtFJNVB6s5rjka0HHo/6KC/1ggVOE5vai2IL9DeR1h7 Vuww3hGfTNeKbe190+ZZAvYN/Fazvk1QlHGIp6X3szJ2faxKiq0BaTJDg9/Qe3k= X-Gm-Gg: ASbGncu6oVKv66l8rr+QCSTQL/HJtwADgYw1laNQSu+RfHjKFBIIiqDcEKdG5nckXXq 7pk3CHu2Fx6mHMPf2BHUpazQZVy7oTs3uY+QeOsg6i18uUUM/J47vDafui1KJrwIDvmvg6cVjwO wTqyJEEnGWXjTioGtWln61OFtsNLYvoIP7zkqQweV2IiW3HXpToCPvwrmQz9Hj7lvd6ybL6lbAl kDa24e2npBDJH3OETjF5Zd/GxRGsG7NljCAylyiweZ2c6k2b1dNG827luBya5SCTsLCHwQKJ/TE K3mg4dJwXVJ+YsX7ngmJai3oaO8geU6UE6a3CdQP X-Google-Smtp-Source: AGHT+IFNUDmpgsw5ke7ZaL48eLNTBfOAPkcikjGaMSE/lQy7fKkuNn3lv48hocbMFy45x4I8x+BBUA== X-Received: by 2002:a17:907:9516:b0:aa6:841a:dff0 with SMTP id a640c23a62f3a-aa6c1b29e83mr137475566b.32.1733957980041; Wed, 11 Dec 2024 14:59:40 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-aa6a263efc1sm326205166b.68.2024.12.11.14.59.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:39 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 03/14] multipathd: sync maps at end of checkerloop Date: Wed, 11 Dec 2024 23:58:58 +0100 Message-ID: <20241211225909.298770-4-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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 --- 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 Wed Dec 11 22:58:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904304 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.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 967D61F2394 for ; Wed, 11 Dec 2024 22:59:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957985; cv=none; b=SIeXfVoHpHE+zYCOiXPFYnMPeKr71Xnq3VIxiqXX4wJYtJETTQonq5oDWdwjEiNAZvryHDP7ktCmlgEA1ANO0AHVJQ1VNChVlB8BR85jDO7WhQIo6qusACTruUeAX/S9rzjj8KkVULOwoWixpkZaAduGM3Rh4N0ETyLAUfIsSgo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957985; c=relaxed/simple; bh=zncBeVa8SJWxODCBY1Fx2i3v0RYUtVqoIOxZUS7scL4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YRr9vwEidFzyLXI2ZL8BWFLwigxXVKxnWPpKpG/ses0pTXw9T82QwWFrA50zQ7vu0vYwWHLw6e+vhd0u8CheB25J8gfh7Pf8LrY18gDRFpDcEB1CrWG72Vtud0gzK8OQk6aCoG1oG7h+w4ErgrSHSbP3K55TcrteIUI3uV++8Nk= 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=NIqjiL8g; arc=none smtp.client-ip=209.85.218.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="NIqjiL8g" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-aa6c0dbce1fso85264066b.2 for ; Wed, 11 Dec 2024 14:59:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957982; x=1734562782; 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=tQjmMhXldlZfCr+r3PXIrFVNcMpsrmW+liwWSbOQGIU=; b=NIqjiL8g+VPzk5KP6+Bqjmcg73buPZnl+y9lVz8iZxLTx8bPtxmlBAJgrVlzr9XxXV JLQn7JNiGKt1lZ+rwkvh0ffJMH3w/e1tmjXPyD/IJVGibj0Fx6m9YKgISIRhiDljQ0ZL swfSnj43MFGhfYbknpsxJJH4srPScksaC9BDs9WT6Su72uhc8PVB1SEJRRMbCuq2uL81 Ld+upCn9+hBSO7+MTuhTwU6Kct0vIC2JvI0cI+teZV0sUB9HYNBcxVtu9wKbe7s19D32 eUMJ/EMxqBvpmEaR0OpMvBLhF7r8uXcAYiZwVbB8HLD/1g2s1NpsCAfM3zJS83lPujel cTxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957982; x=1734562782; 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=tQjmMhXldlZfCr+r3PXIrFVNcMpsrmW+liwWSbOQGIU=; b=sZapi/vCNEedAmL6vCwun9QWdP9o3zmLJdApJP2LpxfqYiyXs0m6s/wew5wd5ZJD3W RUL+2yHfloJjeV0m4b5xUlzcazJN0DeDA/LpIlfnJkhJvWaSY5PVJC9/Vb22HwKQzh1g Kjs5WqUJyNzLUo+8LF8XB2h26NeM4lV2yrlMtlPN/xD6YwP6NuPCF5hP/fJHKY1NAlb+ deJfAw5TjwtiVuTgGHOCFsaHd3RlTWqX2Un7TMCmQbBvnWaKxQOgtpYuG+XCasWswBo/ bSCRTrWOrW8zRezB7g8Ytu88myOUGgxqGxpDPNjD7EmgttAWy6pklWIUhhHnXyiL9kdq 3dEA== X-Gm-Message-State: AOJu0YxGGGyu0SUEf9HA89WevUtxKcZrSZJJ6g9I6h3kbPOVOndN/ei3 KmB9WyBFTABpOgr6UtCtvvRgOCoAy8mDU53KtsBsJOcEl0SZJ7sDR3Gg5PVCrqk= X-Gm-Gg: ASbGncvT1kWPAHf/IzuyKnNNeDzjBetUgQYnH6u4N7HpnGKBL9B3TY6rflcPNpT4MCM wYhG6L+D+4+M32CA6E2LqohY8YUwRcsIBy9NGe6QjVdz9q1LryG1wU+t8Pwg5sb0yuqMH5dPuf7 eGJ6Fs7AIsWJkCdslf0Ga5CrNMNIHD+RUsKNzUIIc+kUJAbt+0D25TNK9mJzpmyb7q4xJ/5wpeA wAXKmzi2a9VoyoKCUvP3QUK1I21NG+HHFWNkWfwkzvj3TN8buGusIqLvLDeZdYdlzfz+ldC3MBU wzhZ0XCu8x3+nvc9gZ+bo90tHeqW4SzBGy2jw4fK X-Google-Smtp-Source: AGHT+IH6AC0NxXfdEUTsALHhZnmVa8WPlU7QU++eNJ9JLA9Dmam2jCM/pOutRC7HEBf4MrVWVkhVGw== X-Received: by 2002:a05:6402:1d4f:b0:5d0:d91d:c197 with SMTP id 4fb4d7f45d1cf-5d43314d454mr8722180a12.27.1733957981459; Wed, 11 Dec 2024 14:59:41 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-aa69964876csm413299566b.49.2024.12.11.14.59.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:41 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 04/14] multipathd: quickly re-sync if a map is inconsistent Date: Wed, 11 Dec 2024 23:58:59 +0100 Message-ID: <20241211225909.298770-5-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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. However, schedule a quick resync in this case, to be double-check that the inconsistency has been fixed. Signed-off-by: Martin Wilck --- multipathd/main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/multipathd/main.c b/multipathd/main.c index e4e6bf7..178618c 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -3026,13 +3026,22 @@ 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; } + /* + * If we reloaded due to inconsistent state, + * schedule another sync at the next tick. + */ + if (inconsistent) + mpp->sync_tick = 1; } } lock_cleanup_pop(vecs->lock); From patchwork Wed Dec 11 22:59:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904305 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 962831F239A for ; Wed, 11 Dec 2024 22:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957986; cv=none; b=eOxWePKnmeQDYF+pzCKh4m0Ywex5VwACRlVY3lObpagvLBSmdbVyEJ8ZE/yYDr3X3IOzkrWeM6hVCYj75T+dlCxaBTNOiEEx9tuYJEhWctdD4zK3lK9qHc+2I+4IavYLB4UjeNEPsg3YRRZ6W8xSiyoowivLNjCda9yE/b5ncL0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957986; c=relaxed/simple; bh=2L/8xfKDSEJ++zS63Ca+tPcEufykt3HTgiQLX1DCRjM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GhjxGA4W74Qjy7RqH9O8+svR/dbtakzrub/vTAHccXM0mOrsmcAy8WuaD20msJFvMDHv6FdfMLHjl9Gxnphyy5Zi+nYEv6Klqu0mEFo/pvAouzlUEdn6l6mf8l9o2lq8OwUYES0LDoGxoWsERxyryWHQmPfjgqpr4vIuDp/tXSo= 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=gDiPtTgs; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="gDiPtTgs" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5d0ac27b412so9628129a12.1 for ; Wed, 11 Dec 2024 14:59:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957983; x=1734562783; 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=vjr7YmZscWelZAChWz44ooWTn/oPYEfuoQ8CPQdWeHU=; b=gDiPtTgsxxp/M36SgQPp0GtW3nMDjUuE8V8+gWLIfQDEWXpqUmJ7rRyek0IqcsYMPp eI6cA0fmlaE5SJ5yQ76KvqGQMcqlEyfucmElyPe0iandMNigcmGXcC0FH2WDsuciCOtI w//mK10oJ79CNWQUpy5oPycUhz9HbCC6eOPm27G98AA9o1TeyKcivALWtggfkJTeFHWm tE6KSyg4kfE5cO16s+eQZ0l1Xb78iMNlZSlanxze26HFowOksAbHme9N1sWRcvicZ0SF oVTnTiNxTzi+T3sW2cFDhEXo9IEDb6Cy5HNODeV7dqeYHFA/sNZnV8XiKNsncp+Qhi3S MMcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957983; x=1734562783; 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=vjr7YmZscWelZAChWz44ooWTn/oPYEfuoQ8CPQdWeHU=; b=KJBGDd/qUH+IA42CBn+Po5yWPVDeUR/ZdBn+6WbwS28y2ZGxppiuG6y/rNx+FR8O4y EafX+0pEbfPjdvsjfKv557DXMjxwbykyo4XC+a+9J0BXipKj2xUaDpI8LIhump4bT0tz +JF4MA8wMBfnUmOmoNMoZkGBN/TBt3BBgE2MrqXD5dPgBH9Xxv0+d8ofooj0pQxd25y8 4svZC+tzryWZ1vhq/UJzeM4XHQ3JWp5Sfzz6sVxankuRyuoiDd9xOjuiFiRjTORSRX3y J989M7YnWeM6bBtkmR9A6bJ/tRyGLxqhs1aDk254VLWGIDPtFYXqyZp7ufOXnrEWwc6W 3IYA== X-Gm-Message-State: AOJu0YyVSyClIIFrApzNVBYV9O7EG0LYXY8EOZ+BbU5ZA4SoZYijHVjh xT2fRTk00RjDdbspzZdqbBnc5MivFHvEmqLOta18I0RRvJrlkiahmcfiqeWE2qk= X-Gm-Gg: ASbGncsnsQsN/WBA3R4/LAEAeAYSVsApr024SoClvq1OPRE46CdVkZs7Ipt+xutMZBp HAlAHOSxq4TpL6U5igtYWv96ZXwgBAIbSPE9jY9N6Ti89WShMxoieZn4HzOmy3E4dJpWL8zQdTj 6SstUi7e9adO0tNd507rur0NBztb+r+XaWqItQuHdhO341eiwAtgHik9DrCWDlACOidUKIbwrya 13bBPSN5Iqwuv1f67sZCzbP7kcGm2iByRO4O416y69WylcC03zLozu/I8YJGnjmtGcTOS7YHauu 4qmECQcDss5zs08ut5z+d/iBbLDpp/dcmbHhtC9w X-Google-Smtp-Source: AGHT+IHN2uzYSzXWPPGcsbeSYLQfDD4lOnVu5Re6uFftdpTt8MDTyDwAv6o79AbOAOWZwGr0Gr4vag== X-Received: by 2002:a05:6402:4005:b0:5d0:e410:468b with SMTP id 4fb4d7f45d1cf-5d4330821b3mr4565279a12.2.1733957982688; Wed, 11 Dec 2024 14:59:42 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 4fb4d7f45d1cf-5d14c7aa842sm9587348a12.83.2024.12.11.14.59.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:42 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 05/14] multipathd: move yielding for waiters to start of checkerloop Date: Wed, 11 Dec 2024 23:59:00 +0100 Message-ID: <20241211225909.298770-6-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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 178618c..be542f6 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(); @@ -3045,16 +3055,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 Wed Dec 11 22:59:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904306 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C45CD1F237B for ; Wed, 11 Dec 2024 22:59:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957987; cv=none; b=mgkQ1me/un/gcmCRrUtkrkiHkadWa7nLA9Y8Z5yWl6L85KE/hfooA5pJvj1MkaYamSyLqWsJeZQIMWOVCRBKj/W/1L73zEoaAAM2dKzZS2AcsailhYYvNd1sAIPURdBDu4Fgw1p6cpk64Sk1lm/0MLcCtGhPJV5cjDY+UMN0eRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957987; c=relaxed/simple; bh=dXbSmVFD+OCsfSnEHPgUcLDJ2lRwGmi0hIwPKwQDYe0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H+cCzeveIQNtSpKL3xaHi8aTiPjYVGuUZ6PT+co1cYi+9EhQQ5HJkglwtNi/3SrT6LLia+NXwPAVpSAGu46dekGin5ot1th0OlSm1bZPrwbuGCUueTmubs+RgJY2KVVgjw0Ls9Vk/kYNgh19vgdoxK4/gUn0/sgWEaYAdcZuHe4= 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=eWIjlPd/; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="eWIjlPd/" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5d3e9f60bf4so6986150a12.3 for ; Wed, 11 Dec 2024 14:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957984; x=1734562784; 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=0b1Skwh0zMCLAR/VwxPp8d+MzrppHPyTF7ZMEGSIKUQ=; b=eWIjlPd/BdCEL35Y55fMT3B+Lrh8jq7XnE/FxOOKbBlgmGEy1PStuYGzwPqwBcZ8Jg G1VcxvNBXNdylGVQYxNywslqVOuAC1qOj69hijxlQ2NXch859Exg1dcvK2ZF7NMSD2Kw nqmoUYn5gNxV47xlaAFJ1OW6ROr8Cmojcv7zmRijqisZmCeFeG1TOlcsXnIYPNeQAwsq CPJ3oj14Lg5kO57LJoPomQYIegZwlc5A4IPJ53dZopkkUV7DXmRtArhDUZW36tjCfX3P UrYbav9Xnc0R0lPLHKiy/DS+NPctFn3n8e1mgtAJ0LUYcxjTo18PDdQjKncXBHjLKIZb v43w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957984; x=1734562784; 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=0b1Skwh0zMCLAR/VwxPp8d+MzrppHPyTF7ZMEGSIKUQ=; b=GHV2wmvgQfGL9UnP7vprBidbA3bs5pYhpWgPKDfN8khpphyQLVMUlFMYm3RH//pbSC 6WaHdxrFxap6m7lmAa6JrMpu/BQ/Ik4GiLy7mWqSgcO051En63ddCENDShplHlgml10w 7dMvlCnL6M+zhAaN2dAmaaidoCJjn3lZFfuuPeeOx08fK4XsvpyY8OqVRHb8kfuziDkI C/TFGDUJk/MJhTFlxxDG9v4pkQTBBTYpT+0IclIR42j/DJAWTNfYxjfispvVFfCZL8+H hulAfiPK51J49+ppxA5bL3SVzJSDeEhh3sa1HXn7zH1onOPrKtwa0fAZFvTjMb9DV2WM oTMQ== X-Gm-Message-State: AOJu0YzEbBd1B5S/CMJSuICPOMtdZs1MXDsE8PLpf2HbsFRDRbC0lK5S 15hisQz1PY/HJgLOOi8ZSejWIWlon+qx5eUozS+zfNO/QAhgD4Ok9cOxGu+IVkw= X-Gm-Gg: ASbGncuEHsqXyREb7Mv598H0YTb6fZzceXANIQIjAbYbjSq4h3AnbWpv1lTCOXjagv4 wLOTeRVHwsQ48Hr01ZSvz42CybiRMLmRviNPZEXbJMAXlUUxlbmcHe72kJ7OoRpEvqXimiHySBy b05Iaoq3SJMSMUDvWTi/uiEESbsUgzL6q76LWA+ErHYOxGUu0CFsUD4Usa7PJAE12z3+wrv23Kj XH8EZWrWUkLSEeBCxNQZ/EMTnjVG5MtN4o/ui89Axz1clgxFefOhQpmg7qYdi/K+t84vaL1gciz ouAPDCsVBr1Hf8TwTzLyct21PvSsTzasfIL/B1D9B/I= X-Google-Smtp-Source: AGHT+IFEnhuBEYmVhqr5dcwli0yHAlguX5BTORORCTGq0MBfhyG8tPW5XrCMp/RY5ouSlcA2qdnNcg== X-Received: by 2002:a05:6402:5109:b0:5d1:2631:b897 with SMTP id 4fb4d7f45d1cf-5d445b3afcdmr1218849a12.14.1733957983822; Wed, 11 Dec 2024 14:59:43 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id 4fb4d7f45d1cf-5d3cc95e26esm8145232a12.20.2024.12.11.14.59.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:43 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 06/14] multipathd: add checker_finished() Date: Wed, 11 Dec 2024 23:59:01 +0100 Message-ID: <20241211225909.298770-7-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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 | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index be542f6..0823484 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2967,6 +2967,31 @@ 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; + } + /* + * If we reloaded due to inconsistent state, + * schedule another sync at the next tick. + */ + if (inconsistent) + mpp->sync_tick = 1; + } +} + static void * checkerloop (void *ap) { @@ -3034,26 +3059,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; - } - /* - * If we reloaded due to inconsistent state, - * schedule another sync at the next tick. - */ - if (inconsistent) - mpp->sync_tick = 1; - } - } + if (checker_state == CHECKER_FINISHED) + checker_finished(vecs, ticks); lock_cleanup_pop(vecs->lock); } From patchwork Wed Dec 11 22:59:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904307 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.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 281331F2C26 for ; Wed, 11 Dec 2024 22:59:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957989; cv=none; b=c+djid0h8/1DhgNZgCfJsbmu7MRLIql2b5VRTwwdnJv/MWzKkygN+pifuVaS8vAF4RYRqT0jqdjH3dnbhRf1tqYm6/BF+cG8EZmtl4rkoevtlLch6dAWl9Q+GyGHyi7IzASB27//rS+JYObQKef0ElGoTx4n+4JJxANa3AWCux0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957989; c=relaxed/simple; bh=23tMk1gvk75fa694f+c6lxylDpacU2XQOIyyvgWccUo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EfiDu2l2HsrAODJkIRTDIOUNXnD7PwYgZcs5XO7bArESN50lvQ5/GDAWDpN5gRVQFDC8gQDWVI3SrrzabNGF4cCJ4vx8v27Fif1XnI7zAgvKcuFZcmVAePYN6O/R44RvyowjFcx68LMcNiY5meXD+W5XJrG18DV0pruO2Brd+r4= 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=N2zecpdO; arc=none smtp.client-ip=209.85.218.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="N2zecpdO" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a9f1d76dab1so1068120266b.0 for ; Wed, 11 Dec 2024 14:59:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957985; x=1734562785; 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=tCUSrMdqyV1npUI+0UOzEh5Y+9S73CsLFqrJUT60//0=; b=N2zecpdOWHL6bwEmC3NA9GRlIPdlta6bnf0JyIaX2gUVg6dqwP8dv27fl1pFGsMV8K Vmus6Ts5xkkN2l8+UMzkodWbFtA14MHY+pRwxxK+bVyrUYiUof5MRZRcDljz9qA45Lu/ /Pvflet4biY1ddxzrOEZgzu4mFLJgMEul5cI1p4qMNQlsSNtGF3cvW7///tQ7johwv8J OPI5nTO1GA9YoDGjEPvufK8SP4vYB9C/jIkGY9A9vy9DFthZqyeX5OyrkCHjQIKPR9WY 7jxc8S4qAXxvJ4jUPU9B4ZaRoZEEBtAsdqKQeDtAEMJgwbm3mzl+gZR+Ny9ercoxuHus 0+9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957985; x=1734562785; 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=tCUSrMdqyV1npUI+0UOzEh5Y+9S73CsLFqrJUT60//0=; b=pqLbY94/HW2aaWOHn54vmOMLe8mrgs+srpwStLpPfU9dcpndXUNpJOnf4Jn5fYsU7i a/fFgX/fkUR3WbTO+JVAjo98zvab6hnkhsxpBYd/trYGS4LmfP1ysjqmPIu3WP6m5EgP frif17k6M2uiN8jX6m1chG+60uOFSGljFwz4wvYmTDHcgPdZ6gvubV6y9i5L236jaMFK iDrIUFCSAM69a0GmBk+FZN/e8Vht3azj8JORe2J0DeiZ6IfW9jkow4IJeT1klBL5gLgr nKCS0iQqenPOBwd70B/6fTp09dbCjDP/3FbWkBmNHYB1fpBUrLovpqwXoSAy9h+mQ85H uMOw== X-Gm-Message-State: AOJu0YzpYq6N+Y0m9dIs8WskrhiqlPJZwXEnyGBpGMQmshkl95Pk5ahy oeH+1hueNJqjrEjgerotZRzsdrEcr03KDcRQ7VjdC1K7LfUc/FvFqN7wiwBo8wc= X-Gm-Gg: ASbGncuUbwqbUO4ZK5GjHu4NtuQypbEEkDWxM8mdguv6uFn0LR1Wy/Smi1kcChdbSD8 faPD6iCNgEsE8jkjHU62/p0V+NyvNFkqjpUIh46ufQo5cLPhTLLjbDtRRZ3L/n3UN6RfiS0Xq3d YxtWApwURux1C35SEy3w4uA0GyHKYfwlaIHfMzNoQ5qv/qxdSbUu3+eB9GEUyknKILwAK9qlXfy Osvs9HX5F8MvoHc+Z/5Yh6M/TYltbxRLzr0sGU+SQ2gpXDlyaCMksR4iPtw5a5Ny8eTevGQJEiu T4MWy5GnpvBQ4uPzZKO8mmCGQjQbUmN+NrxkztSL X-Google-Smtp-Source: AGHT+IG3szGzCLcJVlPi3P6n9SX7JijFCvE7rrDGkudV1CVCCDnoIN5rXdsgg3uVvd/S8vp+z1zY9Q== X-Received: by 2002:a17:906:3114:b0:aa6:2fdc:db1a with SMTP id a640c23a62f3a-aa6b1394613mr456137566b.38.1733957985219; Wed, 11 Dec 2024 14:59:45 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-aa651ea3160sm745373566b.174.2024.12.11.14.59.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:44 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 07/14] multipathd: move "tick" calls into checker_finished() Date: Wed, 11 Dec 2024 23:59:02 +0100 Message-ID: <20241211225909.298770-8-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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 0823484..b045f8b 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2990,6 +2990,11 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) if (inconsistent) mpp->sync_tick = 1; } + 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 * @@ -3064,16 +3069,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 Wed Dec 11 22:59:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904308 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6262E1F2C2D for ; Wed, 11 Dec 2024 22:59:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957990; cv=none; b=T6SYbhvhoShOT4K1tnc2ssPDa3k1V0HNfXi2z5kpG3UFzRuNH7k/IneHVUkrNymWlvBEqzN9M8YWcAiDwf5LAhUUa+FtbhUb5HLTu04Do49kriwWkzqoMXIMKtTQqAWNOGjjt2GXpEoVULJJlV6a9hGlRo+EYSCOfBw5vlh7nUs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957990; c=relaxed/simple; bh=7ZUl6FgR/tl5QNU+kXQEL7okRsYOu8qCL+A3EsrOLtA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r1H9YhnhccStbFRG9n2r17+2gF1Cs1/u5SOAEep4YfHCH/G1iIVY2Cdr+lCAg/3WZ0mRmcAzcUfh5TCrbfFmq2mHsIqHuZazU12icF31rnueb0gWM59TInNFQ5V/wcjntIgOryGi7kg/Ua8xWos53eXLaxv3mlu0e9V/VvLNkvw= 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=FINHeXbm; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="FINHeXbm" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5d3d479b1e6so6801923a12.2 for ; Wed, 11 Dec 2024 14:59:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957987; x=1734562787; 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=e14Lv8nc4fRhxyCBghAJKcrG0BjGt30r8PrfS67+ltM=; b=FINHeXbmmb2PqTGk5JxzqIRnT2Z3kf8T4ZHNl7uZD39pKu22sudNfYGKCWarj0Uv61 gPQicgwj66Mj6IWA8fIxAJgb0z0LtqMxk3S4D+7+iteNIl/YfY2UgWgMc217cAhDfOwx SXoFwVFLrZHE0SakmBuXzr6YIrDgEQfexnZizZOvVc1wMIsybLKDm/jKZTEakRcBwjbF BeBsCWTxBAKQr9lGDcTX1u7Z+zM0sYj6veKDyt3G51F6kCgxYCPmt1fPMvVuKV5y8FNA wbkiWJnYeRRqmSeKgCcfsRyz0cSKbTFghSE8zjqQZtay7FcQC0b/qCfWBHlwBoMYOdQk shaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957987; x=1734562787; 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=e14Lv8nc4fRhxyCBghAJKcrG0BjGt30r8PrfS67+ltM=; b=j6WXREn5zKblCnmJaN0bMVB9VJZDSXwhnPPspBpCmoZ6oL8QrWiD86fvDq0zTnblQ0 7lmJVHHhbi/dIc1XSP9vVE0sJfvb4TXqGnmNcEaX2HQfH0VQD40cfLTve41Aat1Tzrdd tAawX1bAFfVBuwNlkQbzkBgOzJ1f1LWbNJ6SJPJhzHluHrhVBA2iztw8pxSmNl0eFRve Cz07YJ4ibRH+MbbSTN/sVCz0hSdehvX2t3N4w+Es/BW1gxredqRezqtOySbTQ8sC+6of mz2xr9lgku1/3f1Zdki1Oo1zI4jkyM6e1HiA+nRXxPD02FR10Vjd4VaXWtDcqbjTF3Hg MSxw== X-Gm-Message-State: AOJu0Yys5v5x2DQh/KgGlzdu/qCEOJkEgl9dNb1y4fwbqUzYvZpFC1yd rhSoq5n8NXADNXQ8wBMFQBg4U7n8aKh/O3h3t01bPFZprjwAF4ahwruxFOFR5q8= X-Gm-Gg: ASbGncuTkqiRw8IKL0lZuUjSdqMhbzJgSKV4EOOD8COttY9TtwFcICQg9rQzFnrNePR n+bOkRN3DvJFWcWKSh7n4TK2Aw9y/rEVI3t3VMeojhy9kLX54DnOLGfhlSzi3ju1I5jimG3lT11 iPC4v4LMViO96lfHHtlVJDjvBMFDLHZAHtgGS8tavjZwjtN+EzZAvxNeJmZKGEQ2OGjpnq4DS96 teqTz7wf+sZtxj+XaPeWrgp3iX6P2RlqlKmRr5C6p2SGexIBZeAp+kWYKGYBjhlJKAMtCaZG0G+ hnJ/Hz0PSxRDjJF8q7CASgUagfBd3SeE32OEjAkp X-Google-Smtp-Source: AGHT+IGfcmb0XIXsFy0Chghso6WzsNp71Y82/UYQbt1LEeU6gn/cQVSAdYX8AzHynyFLUQYkqugykg== X-Received: by 2002:a05:6402:1ed5:b0:5d3:da65:ff26 with SMTP id 4fb4d7f45d1cf-5d433164c3emr9318824a12.31.1733957986349; Wed, 11 Dec 2024 14:59:46 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-aa685b6cf77sm535863966b.83.2024.12.11.14.59.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:45 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 08/14] multipathd: don't call reload_and_sync_map() from deferred_failback_tick() Date: Wed, 11 Dec 2024 23:59:03 +0100 Message-ID: <20241211225909.298770-9-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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 --- multipathd/main.c | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index b045f8b..b1f0f81 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2076,32 +2076,20 @@ ghost_delay_tick(struct vectors *vecs) } } -static void -deferred_failback_tick (struct vectors *vecs) +static bool deferred_failback_tick(struct multipath *mpp) { - struct multipath * mpp; - int i; bool need_reload; - vector_foreach_slot (vecs->mpvec, mpp, i) { - /* - * deferred failback getting sooner - */ - if (mpp->pgfailback > 0 && mpp->failback_tick > 0) { - mpp->failback_tick--; + if (mpp->pgfailback <= 0 || mpp->failback_tick <= 0) + return false; - if (!mpp->failback_tick && - need_switch_pathgroup(mpp, &need_reload)) { - if (need_reload) { - if (reload_and_sync_map(mpp, vecs) == 2) { - /* multipath device removed */ - i--; - } - } else - switch_pathgroup(mpp); - } - } - } + mpp->failback_tick--; + if (!mpp->failback_tick && + need_switch_pathgroup(mpp, &need_reload) && + need_reload) + return true; + else + return false; } static void @@ -2973,11 +2961,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--; @@ -2990,7 +2980,6 @@ static void checker_finished(struct vectors *vecs, unsigned int ticks) if (inconsistent) mpp->sync_tick = 1; } - deferred_failback_tick(vecs); retry_count_tick(vecs->mpvec); missing_uev_wait_tick(vecs); ghost_delay_tick(vecs); From patchwork Wed Dec 11 22:59:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904309 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D79CD1F2394 for ; Wed, 11 Dec 2024 22:59:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957991; cv=none; b=dQpxVROE8PkGiOPpSTPIgCXefiMySUlumK7sDlGmm0PbmlmoTddsW0rdgVj4jr9RdnY8T79RRf02y4Mt7A+u2TwevD+cUFHCNIa7pd/bkIxwvcnTVS0rdFHxsA0dJrUR+AEmJQSWFNlWbk1xB4dWd0iJXtR0Sbm2jD0EErP+NPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957991; c=relaxed/simple; bh=cul3V3zU/4WcVV4bSyJ+Yj7yT2/s5Y9DyCezcD6CC8U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q+Eygy+14MwHqM7mXuJpci9cQwTy0Q8yM0xEdzfyCdUbmbN6BVUF0lknO4cUtalcz7+8IA6chrN9PT6qrL1AtVAGA8JwjCdZqiz9ZZQ8c5hEWACpLEzg/f7cegEEDKXD/ZIR1Tw+KW/N1osM6X6VX/zckeHw/efqiVvsqPMxXK0= 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=ertaQwZE; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="ertaQwZE" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-aa670ffe302so760964066b.2 for ; Wed, 11 Dec 2024 14:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957988; x=1734562788; 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=LcJ33hYwO8mDI51qDpFqEVjbcM2lfyToCby3kpo+uNM=; b=ertaQwZEvRw+UZ5SlH2ALpk7sLRvi7wUeHKi1tpXhCMoAphFU7c+z7+W8Ti9oBGMn/ QrTq8GMQBS7z89UA721IJyt5iuGJlJyoeUHv24NskQccosBcZ4HeGN7lGBhGIZw+ke6j Fe+ytBLnuKx2GSXEzLzIW/JguabwgotkQheaKQQSllMZ7KAjE9pJJ5Rr8kPpdlcsHJ0X jO7YoZfQz7uh1FajesIixNt5tqKjc01z6w8yh7xSHFgFV+QUiBSwfiaFaVILnbx/hg58 PJP4+wBJLXkZfAYmcUq+ZNt+MRoN38ssHRYa8Zzo+kXc2ekaHlfJNyUYT4hO1MlyejWY Bjww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957988; x=1734562788; 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=LcJ33hYwO8mDI51qDpFqEVjbcM2lfyToCby3kpo+uNM=; b=M4HEYy5ghy9m9F6xOjps3TXgqjnLQCIlD8ztphH8N2S+SNuSr5Ys5qZ6m0Y4YvpX8M gIS+qvk3JWPMkq/ojXVC2qX1Gh5O95Y8HE9SmgJWnrAFPKf4aqydiJNZZDWJh/yx4zg6 pC5wJ9ip6SknYU9CS8zt8bMRujqYcvWSbqL4sxCIv3JMb0QAu9DZmhmXmaBPLHMsfzrj K+vCU9+B4iDzR2zd8Id1pqNPoauQ7ND0lswEpx2Nrb3VTdwe7nTGFM8JUJienuOyn53Z dbgl2b+M3mpNvoi3jNyBIjvwNLRbUAcwjqIPn9VMbAUXKA7C8xfP8U5TjcjpZUy/7JaA Ce4w== X-Gm-Message-State: AOJu0Yx0QGJ8zLC7461brWheiMP73zzcahKjPW0j9MLQU+S4/+HQu8Cq JVtICaXyqXNNM5xy7YA6Y/GSbDUFiCRXtrLAlpFHsbSvege8YwRp4ISVOo5J/Gw= X-Gm-Gg: ASbGncuCJs0QigSjOtBSlF0YiiOA4vqJYW7167m85lzjI4n2BcyYojU6IzB7HO4o2cc Fh0ChiP5Iq7qDXZkl6Ynryx+sIbgwNqFKgQuobFS+dXM9VYWjM+evbYObN1Xzer5Cltsta21vzt D20DaBqkgEkXAaB7Fd1gVrbNHhlpNnxzJUjH9+aPbO60ojWiZXQskwyEo+6/MuqxThoDj6Kjaau 8b8RPa7qaKzOg567bJcGN6JOVQ4osjld9Bbvx+rNQqd21zVnuJs366djGapY0qZnPNFPgaUzkpc 4hCYXijEYqrVjhST+6BCFOsPW79hRgwMwt9rffh4 X-Google-Smtp-Source: AGHT+IG5KYcHKlpQNZzn928rcym4AkyQoztwjD7pnuQDvjx8NWMmhoB+sQ4B9hqHXusWKM0j2W/oAA== X-Received: by 2002:a17:907:7808:b0:aa6:7c8e:8085 with SMTP id a640c23a62f3a-aa6c1b09cf5mr149811166b.15.1733957987786; Wed, 11 Dec 2024 14:59:47 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-aa667925953sm703769466b.9.2024.12.11.14.59.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:47 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 09/14] multipathd: move retry_count_tick() into existing mpvec loop Date: Wed, 11 Dec 2024 23:59:04 +0100 Message-ID: <20241211225909.298770-10-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Signed-off-by: Martin Wilck --- multipathd/main.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index b1f0f81..fd9ea6c 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2093,21 +2093,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->sync_tick = 1; + 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 Wed Dec 11 22:59:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904310 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 270341F2C2D for ; Wed, 11 Dec 2024 22:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957993; cv=none; b=FpeTQWBgcjaXCgxim+eHLsB8nOk2AuSJOXw7Bj0uBYAI0br3s9IDSy50tqyJGpmU5QaNf4wR+xLhwQNg+4xYN74MeQKEMjnAmZjkTg1ESk/Y2v4xtTfjodQv3zfPWRVo20TDs0y/9druvotCZMgKeXVwwPAUOS3JirVNrvPyVU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957993; c=relaxed/simple; bh=OTURv4mMaiUUVHWaf5RA0F8+poDNB5nykqxAxzFRyIk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TFBPjsCdOncVH00omu8A0vfFEUoHQUegnmQkXMrYUbRAlAKFZRVqkW5lDwFpb7lnA8fDny6y7nWIcBZ+EckTb5eciwOz1VcxJtE+HxVDpdj4E0NKSV9NIjehNCARP5gCKKP8j13OACofBCQI4CeJEEPPhv3Taf++0WfHRX23tNk= 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=RYgfVMRy; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="RYgfVMRy" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a9a977d6cc7so1072710166b.3 for ; Wed, 11 Dec 2024 14:59:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957989; x=1734562789; 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=WCzCXETmWmuQCGBNVwgaV8Qa6e6pSIjkgHIgtmct0G0=; b=RYgfVMRyXxMIWzxp4WzTEGe2fJKR52Us+R3qHv6WwbllxLk3pw6MLEjSCR6rVcDbu1 vs7uptul70Yo7y23/+d4il3nP1Pxjrzcv2tqNniRtyg2+TJw+/P0riDuxwKEI3v3C9/7 MDqpfd7VPsx/jypCVgBRAaW4Y7DQE4eARPW61VSMbmksjOi1UDmKW6Dx2/kZz4NnJ/Ss 9LDGKxk0Cgx3kevMTrJQlhesrUs6sm2rI/HGXjED/R26nb8OHxj6EmWpAncCNJ08yVPU Eo+pgEczUCkNl51VYoVKFw+68gnNZjyFteO9LnEFztDzRt4w78dye1lz9eAN1ARPljJd 36Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957989; x=1734562789; 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=WCzCXETmWmuQCGBNVwgaV8Qa6e6pSIjkgHIgtmct0G0=; b=OuRvtb11iiikkJjdVVQpRqGIu/MU9b9JP71DQa9laLpxtb5rjt5M011R/1m8SfLXSA 343LSoD4YB6ErIHPOrjroDM0EslawKXm/i/8HU13nXes/r0r92m0fS0bXAJ7Z3TrYYXO lrWDWxEwjMZ7a4IeSqPrCL1pUTRrrEwiX7MHsI94V9WOeckVKaYse5rpFBlzWyh96r/D bnYfyfQ6FZQFVYDHJ9bgm1GID1FMLIKee3aMGLCXcCBaUjn4aSc0nrR/WKynCScS2nkn /kzbsVSTRpKUNGi6ToFKdzYKPkC8DmzGeLbaml4gJzLVfLw5wV1DZYHY5HKImSwV+6A6 CWYA== X-Gm-Message-State: AOJu0YyHi6XOas9X2klKzXkvCtqxrqYnZOtgtlgCd3DTuwWLxxsdsnif yie38+tyWLCj0sW+tdHMB5tJWkdtuywNCQrzvXhMHNoxMSDajwSGs+72hscOw30= X-Gm-Gg: ASbGncvC6GAftL0sZO/lcwsocr5NKjLT8E6PcV/YrUUXBRqmcZ/sSMyuoDUcd2/FVYv PzzxpBQ9VMfzpnnof6YO+XHD5crWoEIJqNwPnsMnqzYuxOtvQP+RksVSJMsq5/vW8MneY+nWWqP +Ctp8eWMYSbhQAvAl3aeqnU0kGfA6pGfSQppP9V3cSoDHo+5OUD2i4LufXVOHNbSfpi2IaJAQCS dvSXvhGP0idTvgs++lWyRhHnmX0wOaO7eT47M14I40YXH6M1DzOYYWqd6GlgiWX2d+KVj+aHHy6 U3Ghg673+hI4hIqIK33RM/VRDjO+CzWcKNT5MyRZjes= X-Google-Smtp-Source: AGHT+IEwZt8xYGmi2HIAvpONkU+bVo+483jkKOQXwYlx5AJvp9PEmP6+2Xz8VGJZGrnwZ7fE34YOqw== X-Received: by 2002:a05:6402:35c5:b0:5d3:ba42:e9e3 with SMTP id 4fb4d7f45d1cf-5d43308a1efmr9672592a12.13.1733957989194; Wed, 11 Dec 2024 14:59:49 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-aa67f4c4ae4sm578524666b.111.2024.12.11.14.59.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:48 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 10/14] multipathd: don't call update_map() from missing_uev_wait_tick() Date: Wed, 11 Dec 2024 23:59:05 +0100 Message-ID: <20241211225909.298770-11-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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 --- multipathd/main.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index fd9ea6c..6d3c3a2 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 @@ -2954,16 +2944,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->sync_tick = 1; 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 Wed Dec 11 22:59:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904311 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.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 7CA051F2389 for ; Wed, 11 Dec 2024 22:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957994; cv=none; b=cCgJdTzdyaWxyGv6QTBRtvvsqA/BqPUFwQp2HvanHof752PZl3L3mI57gez5btf59ZIPW9oq7cwA3Vf+Q3Vowgj/xD+ucPcXJeQHN47HZSom8AT4dtLFkR/fD7wqqU5Nsf+5ZcO4I4UsPFHuu/IwZLpI8GqOvOQfq2zAWCPBFsA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957994; c=relaxed/simple; bh=zESFE5r2C7tTbZV6+10OAneD2vWZuhloe/T2TPEF6Bo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UwMgKG5GGW6povk+fmczYYnulXXuZZmmcMFKJlioAXJoSeLacLJJsQeJ7W0Glyn0HgwiHuc0TB9JU544lxPcKOfKfUgrjW3VSytIHcCzKFkq+lrJM2cmCc+4TssuC43gaUWvVtiYko2XU3npiG0Oy+b15/X2zwzMr9btv7pYtkg= 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=K2eVtqXe; arc=none smtp.client-ip=209.85.218.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="K2eVtqXe" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a9a0ef5179dso1104238766b.1 for ; Wed, 11 Dec 2024 14:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957991; x=1734562791; 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=6qUh2eNVaqGfkkOYCT/XVvpoNZCXmA195FS/jO21TbA=; b=K2eVtqXe4HRLuIsJqhbneQbcRH/zph/sxV5ZyOoNLDxrzn882GjtfsG4rSxphsQP2e Q3lt/UJ1A9lleDyM5IT7rW4rxfEnGVjeXuouXU4vEpobCfyl8osBOfrNMuP7ocWAAKiu q02Uc1jx/zgKCTYYdsvWw8heWuR2PIAkbFU63w1HQQf2q9i9E2nffDLopUPZssHDC5V0 K/ADpHtbjktXJAMCnrBG1KNVNeN08H5O5Zm10jNEnOLWMWL7HxVh3DV8D4bS5d5jjlaW GFqrXonhu0RBYnAKmzhFBKubCwVqvTd9UfbKgtekMVL/Nhx+0SO0MydA3ugXPROQMl6D L/mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957991; x=1734562791; 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=6qUh2eNVaqGfkkOYCT/XVvpoNZCXmA195FS/jO21TbA=; b=gu7j25ktqRr9Y4qkvUzg+oi3yYFDANnTMlSuAr8jnxBJGvkpSsnR6YpchA36mUveng IHAq31sh9V4RnBr8lDpUE40XEsTTX+zPkhw+8QQgYSNjnLHzaSOYo7ICuPG3UJQNTbyI eTqRuVSMK7taUZqMoO6O45wXq3MCu6HZEQsSr32HYUliAK2yj84gUHkBNMwWkguRCGJ0 FMy6zN7N2K+D2V/FRSQf5dJSe1WSPyyqGSC3hIS468PpG7Un2vc4rWu6MYL4oVBR0sVq NShDhWeBbOgB1NKD6JkPKdi9kysq6KdIuz3eTKorUQr9w1C7wZCY06xpjnmovqJD2XLV DfBA== X-Gm-Message-State: AOJu0Yx4coPVhVwIosCpgy0sozEFnTUuyDglHcgG3WFUNBZNFuMFrbJD 8kAu0T0KDbW/LisgBgm95ZS4qecZowoIzj+IaHUIn9RrogdkNcmwuZsqGp3DZWY= X-Gm-Gg: ASbGncvDYSopZD2R4MTcR7O4HHTQq3PHU8wnPju4i+mLaA8wRvs4IZ9eT6skHHZMIhz lIWDALGqLZG4ntT7LewBdOCvB3eLCLtPXSwruvIsT4rCGly1Mxmor/6HolDBooh1Q8i9LPa1tFk EdZAiLJ1Y3AXYwCLIYw2Mroljr8DCOn175pN+1wtTteotIuGgWbAHWDDBRqPl5wfQAEG9Vz0KZA KBLP0tPro2D2ZfHIUwuBWA3c2qHqG6RDhihiXze9heb7TTJfid+cuGWCSQkpyiR48E+W1LAhF7+ NKiL4+JBSRAQWJ0lbiGuzNOI/LxuZQHfxh6I9Kh/ X-Google-Smtp-Source: AGHT+IEgLmvIDyYlEVwWNDmjWhUlNhRdPvTdzS5YzrzJ3EH5JgSy80Ycue453KZ0cP7nMhF5A5pqrg== X-Received: by 2002:a17:907:7816:b0:aa6:7470:8efe with SMTP id a640c23a62f3a-aa6c1af9f66mr142454966b.13.1733957990619; Wed, 11 Dec 2024 14:59:50 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-aa66ef6409esm661697866b.149.2024.12.11.14.59.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:50 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 11/14] multipathd: don't call udpate_map() from ghost_delay_tick() Date: Wed, 11 Dec 2024 23:59:06 +0100 Message-ID: <20241211225909.298770-12-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead, move the call into the existing mpvec loop and call update_map() from checker_finished(). Signed-off-by: Martin Wilck --- multipathd/main.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 6d3c3a2..71d5363 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) @@ -2949,14 +2940,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 Wed Dec 11 22:59:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904312 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.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 CD4F71F2C2D for ; Wed, 11 Dec 2024 22:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957995; cv=none; b=cSeGXi/3dtchUScdHX8VALxUzii+TbBL0Vl9tU8ZQ5LdjQEFNHX4ge4KTJD08TEyisxV+w66cBlCuKIq+gbNguyQXTWbv3oT5U+1K82koRTd+9IiUt/tNM+0f3kluCmYhhDGefK2qHfep+jQs2xF6DH587q6+IMX/wfdoOexzH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957995; c=relaxed/simple; bh=FqH7RhHO1ysS3vRBGCKk3Esil8e1d/CskAUMw0iOEuU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=azrsvCvqOQAlVqGAy9/8dtjwFpvxYWMtDk0sW/CZZj9wq5COQlqD67ugFy1TPuQmFtF5wBRhiwYVhIkwRxAjDG37l/58ZN69ICUsVhku2dLVbKsMdpedEXuqD9+0PLwzqD4zjGbii+drPlziiO+WyI3XdqnzOIRw7Z5bsIx/Z3Q= 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=WP/4g16z; arc=none smtp.client-ip=209.85.218.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="WP/4g16z" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-aa69077b93fso551836466b.0 for ; Wed, 11 Dec 2024 14:59:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957992; x=1734562792; 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=Z71ggcio+yANbmtayn9X2IcKXpqPVVdYZoTwhqO/0Xs=; b=WP/4g16zy7IJ2534FHS0sU5e4TOhkNaT+b33zIeSiadBmrob78XedryfZKOSDmU+pg gBopq2ZIscCEqcw4SJ/JaANGVYSKRC6BP2w1ga1CnR4tUYNJoSxmv9jRTG7IbFJhs2tc PaNCOKA2hbZ6+1FN8yYSijYGmUk01z+UYnggtfcuE9l1wPLlR1K56NkRQGXVAK4hKWHf 3C8ozz9Rwhr+xzCM+lyJsI9b7MWspcJzH8+pLqjehO0vfwmDHnFey0IebvDfZeGdv7+j X2HPpsWt9TDyXfBtcFZNqU2YveoQu+4N0o/U3QkxLxalcP9M+bXhaUY6Y+iv80thcfns lOog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957992; x=1734562792; 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=Z71ggcio+yANbmtayn9X2IcKXpqPVVdYZoTwhqO/0Xs=; b=jQYGbos1Jpc0rwMj6XrX2MN6unrZv/6VpL7a+zm/V8yl9PqnhblUq4oZiol3bFYFnh 1QyoG37fi8f4nhCDJZP7XJXIzncUr6pwc8hMSoB5NnU3bXe3+ikxyS/luHxVf3TwGvqG 28T7d3rIr1gYkHfl6GDfww5FWIrvQ1kUcbG5hLpveAWLeL4eU6cZzYyZeguS71JgEYIp JDnAmeXLMz6fGF5eKrxQyBMPFpV/4poePs2/w/fegzhtqv9t4DpA1APdkURAcCX7QvAx KJj3IrxygOos8mOV5OVk8O85c+xmcT/fjaoVty05hitmddXQNsO4SB0X2cFP1li4gSJC Oj+w== X-Gm-Message-State: AOJu0Yx5/Vf0GmFqsGIrfQ7gAoXlfs8IEejkA+8vQosAayyY9aE6uZ9g Jahgglfnc8JImbEuAs4DFEhJcp349iPPu0S+YDpQIt/PMjMKBuXVqVFVPSccYco= X-Gm-Gg: ASbGncst7PbihrfI/GpswsGCmYfiL0BEXXaFLyzwcchlEKJXWXPivA2fySfLJ0Ib7CA JOkjmOnHdCXCLtMtYG5in8/YaXmq2ixYw3ia/eAS7i6gDBVTw0DpWMDtJOpVisOoOuG08juwpgR esEHxWiFScr7IkfrqHm4yYj39dr0Vnfi1VGU1pG/gwcNKh94MaOvE2TdeKi46lVmR6RbT93rcBn P4B0Nc1jLYBLdWAbcSdt19Qs01HNrnMhJR5tGb2KPIcI+e7ilSttApLMwu6W0dTavoG9O1Aa1E5 D0zBsVh6V1N9hpFyNE98Cl6xm9xncaUh624069Kx X-Google-Smtp-Source: AGHT+IEGcg3O1I1yRAmh4WZ47IEV4RrMFoO9beoyxI/gRai/aTPu1hHR4ucUxfbLycgkjorzxeCLgA== X-Received: by 2002:a17:906:2921:b0:aa6:727a:2af8 with SMTP id a640c23a62f3a-aa6c1cefcdamr132166366b.37.1733957991799; Wed, 11 Dec 2024 14:59: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 a640c23a62f3a-aa695c3ac07sm442890466b.66.2024.12.11.14.59.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:51 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 12/14] multipathd: only call reload_and_sync_map() when ghost delay expires Date: Wed, 11 Dec 2024 23:59:07 +0100 Message-ID: <20241211225909.298770-13-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-1-mwilck@suse.com> Precedence: bulk X-Mailing-List: dm-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 While we're waiting for active paths to appear when ghost delay is enabled, we do add new paths to multipathd's internal mpp data structure as they are discovered (unlike missing uevent case, where we orphan the paths instead). When the ghost_delay timer expires, it should be sufficient to call the more light-weight reload_and_sync_map() instead of update_map(). Signed-off-by: Martin Wilck --- multipathd/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 71d5363..8d8b237 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2948,13 +2948,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 Wed Dec 11 22:59:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904313 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 243B71F2389 for ; Wed, 11 Dec 2024 22:59:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957997; cv=none; b=PdX5oSXj+XewoLB4IvXelFK0pJTzwKNSHkqBtyS5/Y2WHYWBSH6RoyMprW3UH24D2A8hNmxIeg+jik9fNgAJo6++cC3VQllQPEeXmPFYi52qz/1Xhbk/mcYFW4QnBrKwQR4hW2Ryv3m7C2dBFIo0c3cpwKrzB3m2uANBFOStMbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957997; c=relaxed/simple; bh=tWypuwsBZgszVd5P2iVnWGb+Ioh5M62qWPDIKairgAA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WTPyv1qa4MY9/+ly8H5Sa2K0aqfnp9gtOgiJVuzPlz++BBwClYJOouqfjbI2aPIe4AcZGASFcUiAMern3DiPk68SRXkW12gL1A2VNdoGNiJ8wR8dwOYYoqicV7Y/uvexc0uT7iOXUBjUAk2vY+x0kEsV0FNFlAiALtI+vZyIc50= 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=En/MLn3r; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="En/MLn3r" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-aa6a3c42400so2850966b.0 for ; Wed, 11 Dec 2024 14:59:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957993; x=1734562793; 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=3z17tnm1wh1xKDgev0yQso5nOZtnMTXuHE3R/kRp8V0=; b=En/MLn3rMl3H8p7p3CDGU1+I6fs+XOh4rMUziUkvhgtxQ+rPQVFoUiuYONPLUZ22yI 3RHC/XTEBE9GekrGgkMtXJ/mS2Lvl+ACKr0pDbbdEkG64mhmXbkRGWQlDW96Mk8PemLA MLzbfuICV+Xkzu/1yT3T7/NRKFpa870i5i0kU2w544JasypYCJA0SSittLWKHe/UOKzH S55OSFW8wLJwY8T9tVLJ9o4b2pjjYAI9OtQ/W8H5p2olrodhjulRJkLtAJUY5ZPQCgr+ g3l6jEaz62xsDaJgWzvenSAnyl7U/rTB+4D/u0EIChShVcvyrwMfrl/xjJgU+EvwH1kx WiCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957993; x=1734562793; 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=3z17tnm1wh1xKDgev0yQso5nOZtnMTXuHE3R/kRp8V0=; b=a4AhtfXkbkZQM5yD5Q494JwaW8NmQDvvQqIHZR6G+/bIk1dPsbNCf0EpZKqSzahkew VFA1/ER2jG4O0wYXIH/G4Jr3JqYWpzCkXTAzMi37KjvFxkPO2q3+y77NqjsFcPkKic6v PWxjCmXp0Gm+g2T7ehRw4L0Dj1wiUZf4MyOINl9Y7QWhKHJqNUe0to3rfh45vqn3fbpS B0wZD++SbpBa5lO2ZytP6EtjUfwXt1HqpUCKTSiqtP888+47mhZEtZetBYY7P2+aH14Y qwXryVKfEAhElo+V/uHf4/4Vaiw0Kww7Z2CvnlPjb2re8BcbFbDARyUwN2BXTGF6elj/ BzmA== X-Gm-Message-State: AOJu0Yw8VY9sTq1ahQQOawGfRUVel/8tM095q0Euz1k3qSiH9ITxJJmO rdMi8KQZ5yMAKWli5hiCw4qnX7bvOr3LSV8+Um38tAdpHgd+C6awd/CzVbTaGs3FbVekefm6lg5 T X-Gm-Gg: ASbGnctzF3w+06GVtHHFMDkmTmNbUyT47rUQyAY4aof01rVYQo1og1oHR3nPAx+11q+ jcMeNIgw6nKNV06O4E1bOCb+D/LzK3g3OB9iCRkbBqb+w70WLzvBgIcAWVieTWbQMbWmofVDE2X QoL2SIKWB1LoCYW9hxEfI4797T/zXVOZ9vdTkN8YpK7+4ZxXkq2Qx/LgwwOFFOM0bxSquTpwyr6 pZttLSv2jG0BIykQN8hVQ65zL9JWGVjWjhPnwDsw7v5v9gfpK7xxcxLHFV6Y04ooLU+8ki42ytZ fcZnSemJDYWNbzc3sU5U+DNhrAijQF0Nqs+Yf8RO X-Google-Smtp-Source: AGHT+IHugIJWWxwjb+uZykgpN4cqR0nWCA+fKEz+iZM2PaerA3TbYNEcmGSHfMbaz4KXajO/baq2qw== X-Received: by 2002:a17:907:7246:b0:aa6:bcc2:3f02 with SMTP id a640c23a62f3a-aa6c4197545mr99297366b.29.1733957993121; Wed, 11 Dec 2024 14:59: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 a640c23a62f3a-aa66b96a26fsm683197066b.35.2024.12.11.14.59.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:52 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 13/14] multipathd: remove non-existent maps in checkerloop Date: Wed, 11 Dec 2024 23:59:08 +0100 Message-ID: <20241211225909.298770-14-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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 --- multipathd/main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 8d8b237..138ddd0 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2411,7 +2411,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; @@ -2424,21 +2424,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 @@ -2942,7 +2943,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 Wed Dec 11 22:59:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13904314 X-Patchwork-Delegate: christophe.varoqui@free.fr Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.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 321A51F2C25 for ; Wed, 11 Dec 2024 22:59:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957998; cv=none; b=Ggzd3PRnfA8TvXh9g4ymF48EqT+mnbtAIp+bXQ1bytoyrbY87ysHiXchLXoRE8KtDTrAzqErlZN93Mb0oD2AdIid3kKvWYuCUNqp7052kFeX50IPbbYc4dUmIGJz3SWJYO2AAVqHUQsyDdfBPyTyMPqlgWMa+QonZJvs+CorlYA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733957998; c=relaxed/simple; bh=6j3+WRbuSlVrNfQ3Q90ksjso3L1HhU3ZQVfad+/28Kc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HYcXnjPZkzyISuWv+FVbgdA42VijCYkUUQzinalBM2v2umHm4lIPRgNKihieVuYKu+6VBRsjIVuGPC3ociadhDqCeiWMJFcoVPS8/RCAc3ARcoLpEo+7M2p9hVmugS57j1pRTIEqZ9oG5IF09s84NgNChzdm4JOMsOyJWJsDZU8= 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=H0yYqfqZ; arc=none smtp.client-ip=209.85.218.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="H0yYqfqZ" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-aa67ac42819so709797166b.0 for ; Wed, 11 Dec 2024 14:59:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1733957994; x=1734562794; 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=UUyyo0iIKGnQnX8alrh9k2AK2MSYQRXSOtx7dP+3pZI=; b=H0yYqfqZuAkTgwMaWkxLe9HxrG/xq+0JNNThY5XXw5p/DxmqATlnouASPYnf5Qc131 NQalOM1vSKVYMXIwBn7a/xUY4su8UpY80VGDrOLAIwh4CizkUiiWQtMk4A40JWkiPKQi p4tY0gMM5hWF9Lju0rVUpLx4QJXaTBKqvIHGLsD9lIrEOlWkdhTW+7E6h2kEjzHA2LiU UsBDGzjuMuR0qx1YSVywBk6/hoY8w1WACLZPPPuqBJlauQIWU+KVRlRS+4sv5LGf6V4d 6f7CX0xPKW6As4NYCuDkZ5hR6aeO1rugzecZvLB0qD8aIkCm5JGyXEKd2FkTr9sk2ykf VeKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733957994; x=1734562794; 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=UUyyo0iIKGnQnX8alrh9k2AK2MSYQRXSOtx7dP+3pZI=; b=sSyAoogMZ1SGX1SlhHURFTBu+Vy4RWK8R+F4CVKVQ0jKf9IbY6i6LRMx222X4v7Xwt O5WMZYJM6JBdVF683SAc04B7oBm+MNPGCf1nU3TYbzkKCC8YCxX5hYOxRiSoIcyKTfyY sF5h2n0gI5mF6RMzP7tC08KK9CEcZiprA7PWS7sifQpfu8lbPLs9D2m6dO26UHqZuVXb N3AfLM/EKFxPgutwKI2bpw3PMDvjA9snAlHlFzW3pfDPiz1PRRXe3NX2HPOZSpHZTeY7 GjzfVFxP2eL8BLr1jj25k+wesouI+BV7diu+tKtRdNGyu7SlN0VLmZgoMrKbupKxEctE ZQrQ== X-Gm-Message-State: AOJu0YzK7uDxjF7jWKB9TLYrerceUIUPWofJyDbI0k0fi5bj/C0I/S8g lvK70nUmOv5EzrRL5lqGotdT17VZhWDRsLHHxQ02yXhJAPYDqXo09tUyc4KTUP8= X-Gm-Gg: ASbGnct7RiMEysZ9pN/YYzPzOKwg48DxYnSGax6Meg2QPLj/6kfyBnlR7hdg5iW+/AK /W3Wp5m0aPMwPX3rD68sHYh7QQUWZKijm065xeSWHLldW+lG4a8SBOSX3L/8AdsXcQjG9LRTXY2 5KzXdoqlN/GZYyQlkNxADbiFHmhUT7/7pTvHhbqe9kgKNLo9Tuqu6galUKjmJ8AC7n132eXia0B tCjf5pI2D3JELcYIYo4tVGQLV4lvi1Q41ARMEjb+yh0y9lNg4AxFXD/m+J1xvWayShdBA/8dcit ytY2pAGwZHYy90PZP1QWySiquuMeb/54jriXbVlr X-Google-Smtp-Source: AGHT+IEF7RqmEexzHd7JWCMvKkRZX3bUNNI8xTArNvuhyqq/xi8hmTLIRqfztPd86CkCs2e+o7vOOg== X-Received: by 2002:a17:906:cc2:b0:aa6:7165:504b with SMTP id a640c23a62f3a-aa6c1b1dfa6mr157955766b.31.1733957994281; Wed, 11 Dec 2024 14:59:54 -0800 (PST) Received: from localhost (p200300de37464600ac00037825cc9f2c.dip0.t-ipconnect.de. [2003:de:3746:4600:ac00:378:25cc:9f2c]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-aa677c4970bsm616489866b.112.2024.12.11.14.59.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Dec 2024 14:59:54 -0800 (PST) From: Martin Wilck X-Google-Original-From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Cc: dm-devel@lists.linux.dev, Martin Wilck Subject: [PATCH v2 14/14] multipathd: remove mpvec_garbage_collector() Date: Wed, 11 Dec 2024 23:59:09 +0100 Message-ID: <20241211225909.298770-15-mwilck@suse.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241211225909.298770-1-mwilck@suse.com> References: <20241211225909.298770-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 --- multipathd/main.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 138ddd0..941ec68 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) {