diff mbox series

[v5,16/23] multipathd: only refresh prios on PATH_UP and PATH_GHOST

Message ID 20241015032835.2693247-17-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: Benjamin Marzinski
Headers show
Series path checker refactor and misc fixes | expand

Commit Message

Benjamin Marzinski Oct. 15, 2024, 3:28 a.m. UTC
The way that multipathd was handling priority refreshes had some issues.
Some of the multipath prioritizers can hang when run on a failed path.
Multipathd was only skipping paths in PATH_DOWN, but there are other
states where the prioritizer is also likely to hang, such as
PATH_TIMEOUT, PATH_SHAKY, and to a lesser extent, PATH_DELAYED.

Also, before the recent patch splitting the priority updating from the
path checking, multipathd wasn't consistent with which states would
cause
paths to get their priorities updated. If a path changed its state to
anything other than PATH_UP or PATH_GHOST, it wouldn't get its priority
updated.  But if a path kept the same state its priority would get
updated as long at the state wasn't PATH_DOWN.

For safety's sake, a path's priority should only get refreshed when its
in the PATH_UP or PATH_GHOST state. This shouldn't cause problems. Only
paths that are in the PATH_UP or PATH_GHOST state are usable by the
kenel and contibute to the pathgroup's priority.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 multipathd/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/multipathd/main.c b/multipathd/main.c
index ea4adac8..d479d0c0 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2162,7 +2162,7 @@  static bool update_prio(struct multipath *mpp, bool refresh_all)
 
 	vector_foreach_slot (mpp->pg, pgp, i) {
 		vector_foreach_slot (pgp->paths, pp, j) {
-			if (pp->state == PATH_DOWN)
+			if (pp->state != PATH_UP && pp->state != PATH_GHOST)
 				continue;
 			/*
 			 * refresh_all will be set if the mpp has any path
@@ -2191,7 +2191,7 @@  static bool update_prio(struct multipath *mpp, bool refresh_all)
 	 */
 	vector_foreach_slot (mpp->pg, pgp, i) {
 		vector_foreach_slot (pgp->paths, pp, j) {
-			if (pp->state == PATH_DOWN)
+			if (pp->state != PATH_UP && pp->state != PATH_GHOST)
 				continue;
 			if (pp->is_checked == CHECK_PATH_CHECKED)
 				continue;