dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>,
	Martin Wilck <Martin.Wilck@suse.com>
Subject: [dm-devel] [PATCH 3/5] multipathd: refresh all priorities if one has changed
Date: Wed, 24 May 2023 18:21:10 -0500	[thread overview]
Message-ID: <1684970472-28669-4-git-send-email-bmarzins@redhat.com> (raw)
In-Reply-To: <1684970472-28669-1-git-send-email-bmarzins@redhat.com>

For multipath devices with path group policies other than group_by_prio,
multipathd wasn't updating all the paths' priorities when calling
need_switch_pathgroup(), even in cases where it likely was necessary.
When a path just becomes usable again, all paths' priorities get updated
by update_prio().  But if the priority changes on a path that is already
up, the other paths' priorities only get updated if the multipath device
uses the group_by_prio path_grouping_policy, otherwise
need_switch_pathgroup() is called with refresh set to 0. But if the
priority of the checked path has changed, then likely so have the
priorities of other paths. Since the pathgroup's priority is the average
of its paths' priorities, changing the priority of just one path may not
change the average enough to reorder the pathgroups.

Instead, set refresh in need_switch_pathgroup() if the priorty has
changed to something other than PRIO_UNDEF (which usually means an error
has occured) and the priorities of the other paths haven't already been
updated by update_prio().

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 multipathd/main.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index bdeffe76..e7c272ad 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2575,20 +2575,27 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks)
 
 	if (marginal_changed)
 		reload_and_sync_map(pp->mpp, vecs, 1);
-	else if (update_prio(pp, new_path_up) &&
-	    (pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio) &&
-	     pp->mpp->pgfailback == -FAILBACK_IMMEDIATE) {
-		condlog(2, "%s: path priorities changed. reloading",
-			pp->mpp->alias);
-		reload_and_sync_map(pp->mpp, vecs, !new_path_up);
-	} else if (need_switch_pathgroup(pp->mpp, 0)) {
-		if (pp->mpp->pgfailback > 0 &&
-		    (new_path_up || pp->mpp->failback_tick <= 0))
-			pp->mpp->failback_tick =
-				pp->mpp->pgfailback + 1;
-		else if (pp->mpp->pgfailback == -FAILBACK_IMMEDIATE ||
-			 (chkr_new_path_up && followover_should_failback(pp)))
-			switch_pathgroup(pp->mpp);
+	else {
+		int prio_changed = update_prio(pp, new_path_up);
+		bool need_refresh = (!new_path_up && prio_changed &&
+				     pp->priority != PRIO_UNDEF);
+
+		if (prio_changed &&
+		    pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio &&
+		    pp->mpp->pgfailback == -FAILBACK_IMMEDIATE) {
+			condlog(2, "%s: path priorities changed. reloading",
+				pp->mpp->alias);
+			reload_and_sync_map(pp->mpp, vecs, !new_path_up);
+		} else if (need_switch_pathgroup(pp->mpp, need_refresh)) {
+			if (pp->mpp->pgfailback > 0 &&
+			    (new_path_up || pp->mpp->failback_tick <= 0))
+				pp->mpp->failback_tick =
+					pp->mpp->pgfailback + 1;
+			else if (pp->mpp->pgfailback == -FAILBACK_IMMEDIATE ||
+				 (chkr_new_path_up &&
+				  followover_should_failback(pp)))
+				switch_pathgroup(pp->mpp);
+		}
 	}
 	return 1;
 }
-- 
2.17.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2023-05-24 23:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 23:21 [dm-devel] [PATCH 0/5] priority and pathgroup switching changes Benjamin Marzinski
2023-05-24 23:21 ` [dm-devel] [PATCH 1/5] libmultipath: don't count PRIO_UNDEF paths for pathgroup priority Benjamin Marzinski
2023-05-31 16:01   ` Martin Wilck
2023-05-24 23:21 ` [dm-devel] [PATCH 2/5] multipath-tools tests: add tests to verify PRIO_UDEF changes Benjamin Marzinski
2023-05-31 16:04   ` Martin Wilck
2023-05-24 23:21 ` Benjamin Marzinski [this message]
2023-05-31 16:27   ` [dm-devel] [PATCH 3/5] multipathd: refresh all priorities if one has changed Martin Wilck
2023-06-05 18:22     ` Benjamin Marzinski
2023-06-06 14:08       ` Martin Wilck
2023-06-06 15:33         ` Benjamin Marzinski
2023-05-24 23:21 ` [dm-devel] [PATCH 4/5] multipathd: reload map if the path groups are out of order Benjamin Marzinski
2023-05-31 16:27   ` Martin Wilck
2023-06-05 19:08     ` Benjamin Marzinski
2023-06-06  4:42       ` Benjamin Marzinski
2023-06-06 14:55         ` Martin Wilck
2023-06-06 15:54           ` Benjamin Marzinski
2023-06-06 16:32             ` Martin Wilck
2023-06-06 17:38               ` Benjamin Marzinski
2023-06-06 18:53                 ` Martin Wilck
2023-06-06 16:39   ` Martin Wilck
2023-05-24 23:21 ` [dm-devel] [PATCH 5/5] multipathd: don't assume mpp->paths will exist in need_switch_pathgroup Benjamin Marzinski
2023-05-31 16:28   ` Martin Wilck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1684970472-28669-4-git-send-email-bmarzins@redhat.com \
    --to=bmarzins@redhat.com \
    --cc=Martin.Wilck@suse.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).