Skip to contentSkip to conversation

Don't enter recovery move over pending paths

PATCH In review Benjamin Marzinski 2 participants 5 messages Dec 23, 2021 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

cover Don't enter recovery move over pending paths

After commit 2e61b8fb, I started seeing multipath devices switching into recovery mode briefly on startup. They come back out shortly, so unless no_path_retry is set very low, this won't be an issue, but multipathd shouldn't enter recovery mode at all over pending paths.

Benjamin Marzinski (3):
libmultipath: fix DI_NOIO pathinfo PATH_PENDING handling
libmultipath: simplify out __set_no_path_retry()
libmultipath: don't enter recovery mode with pending paths

 libmultipath/discovery.c          |  5 ++++-
 libmultipath/libmultipath.version |  2 +-
 libmultipath/structs_vec.c        | 13 ++++++-------
 libmultipath/structs_vec.h        |  3 +--
 4 files changed, 12 insertions(+), 11 deletions(-)
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
author maintainer
#1 lore raw

PATCH 1/3 libmultipath: fix DI_NOIO pathinfo PATH_PENDING handling

pp->state should only be set to PATH_PENDING if it is currently in the PATH_UNCHECKED or PATH_WILD states. Otherwise, it should retain its current state. Fix this in pathinfo() calls with DI_NOIO, to match with the rest of the code.

---
 libmultipath/discovery.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
libmultipath/discovery.c +4 -1
index 7d939ae0..6e5d1005 100644
@@ -2345,7 +2345,10 @@ int pathinfo(struct path *pp, struct config *conf, int mask)
 			 * Avoid any IO on the device itself.
 			 * simply use the path_offline() return as its state
 			 */
-			pp->chkrstate = pp->state = path_state;
+			if (path_state != PATH_PENDING ||
+			    pp->state == PATH_UNCHECKED ||
+			    pp->state == PATH_WILD)
+				pp->chkrstate = pp->state = path_state;
 		return PATHINFO_OK;
 	}
 
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
author maintainer
#2 lore raw

PATCH 2/3 libmultipath: simplify out __set_no_path_retry()

In reply to Benjamin Marzinski

The only caller of __set_no_path_retry() is set_no_path_retry(), so remove the define and the unneeded arguments from the function.

---
 libmultipath/libmultipath.version |  2 +-
 libmultipath/structs_vec.c        | 11 +++++------
 libmultipath/structs_vec.h        |  3 +--
 3 files changed, 7 insertions(+), 9 deletions(-)
libmultipath/libmultipath.version +1 -1
index 7cdce9fc..2d0c9f26 100644
@@ -176,7 +176,7 @@ global:
 	select_reservation_key;
 	send_packet;
 	set_max_fds;
-	__set_no_path_retry;
+	set_no_path_retry;
 	set_path_removed;
 	set_prkey;
 	setup_map;
libmultipath/structs_vec.c +5 -6
index cb0ebae6..f1031f61 100644
@@ -588,23 +588,22 @@ static void leave_recovery_mode(struct multipath *mpp)
 	}
 }
 
-void __set_no_path_retry(struct multipath *mpp, bool check_features)
+void set_no_path_retry(struct multipath *mpp)
 {
 	bool is_queueing = false; /* assign a value to make gcc happy */
 
-	check_features = check_features && mpp->features != NULL;
-	if (check_features)
+	if (mpp->features)
 		is_queueing = strstr(mpp->features, "queue_if_no_path");
 
 	switch (mpp->no_path_retry) {
 	case NO_PATH_RETRY_UNDEF:
 		break;
 	case NO_PATH_RETRY_FAIL:
-		if (!check_features || is_queueing)
+		if (!mpp->features || is_queueing)
 			dm_queue_if_no_path(mpp->alias, 0);
 		break;
 	case NO_PATH_RETRY_QUEUE:
-		if (!check_features || !is_queueing)
+		if (!mpp->features || !is_queueing)
 			dm_queue_if_no_path(mpp->alias, 1);
 		break;
 	default:
@@ -613,7 +612,7 @@ void __set_no_path_retry(struct multipath *mpp, bool check_features)
 			 * If in_recovery is set, leave_recovery_mode() takes
 			 * care of dm_queue_if_no_path. Otherwise, do it here.
 			 */
-			if ((!check_features || !is_queueing) &&
+			if ((!mpp->features || !is_queueing) &&
 			    !mpp->in_recovery)
 				dm_queue_if_no_path(mpp->alias, 1);
 			leave_recovery_mode(mpp);
libmultipath/structs_vec.h +1 -2
index d33fe984..3253f1bb 100644
@@ -11,8 +11,7 @@ struct vectors {
 	struct mutex_lock lock; /* defined in lock.h */
 };
 
-void __set_no_path_retry(struct multipath *mpp, bool check_features);
-#define set_no_path_retry(mpp) __set_no_path_retry(mpp, true)
+void set_no_path_retry(struct multipath *mpp);
 
 int adopt_paths (vector pathvec, struct multipath * mpp);
 void orphan_path (struct path * pp, const char *reason);
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
author maintainer
#3 lore raw

PATCH 3/3 libmultipath: don't enter recovery mode with pending paths

In reply to Benjamin Marzinski

set_no_path_retry() could make a multipath device enter recovery mode simply because its paths were still in the PATH_PENDING state. This is possible when a multipath device is first created. After commit 2e61b8fb [libmultipath (coverity): Revert "setup_map: wait for pending path checkers to finish"] it has become much more likely.

To avoid this, don't enter recovery mode as long as there are some paths in PATH_PENDING. Since path's can only be in this state if they've never had their state checker finish, this change will only effect recently created devices, whose checker hasn't completed yet.

---
 libmultipath/structs_vec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/structs_vec.c +1 -1
index f1031f61..6c23df86 100644
@@ -616,7 +616,7 @@ void set_no_path_retry(struct multipath *mpp)
 			    !mpp->in_recovery)
 				dm_queue_if_no_path(mpp->alias, 1);
 			leave_recovery_mode(mpp);
-		} else
+		} else if (pathcount(mpp, PATH_PENDING) == 0)
 			enter_recovery_mode(mpp);
 		break;
 	}
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Reviewed-by on the v1 series
#4 lore raw
In reply to Benjamin Marzinski
Quoted 12 lines · Benjamin Marzinski

After commit 2e61b8fb, I started seeing multipath devices switching into
recovery mode briefly on startup.  They come back out shortly, so unless
no_path_retry is set very low, this won't be an issue, but multipathd shouldn't enter recovery mode at all over pending paths.

Benjamin Marzinski (3):
  libmultipath: fix DI_NOIO pathinfo PATH_PENDING handling
  libmultipath: simplify out __set_no_path_retry()
  libmultipath: don't enter recovery mode with pending paths

Quoted 6 lines

 libmultipath/discovery.c          |  5 ++++- libmultipath/libmultipath.version |  2 +- libmultipath/structs_vec.c        | 13 ++++++------- libmultipath/structs_vec.h        |  3 +--

 4 files changed, 12 insertions(+), 11 deletions(-)

For the set:

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel