2020-11-04 21:19:44 +08:00
|
|
|
From 2870e594978f683a97f32a8f9d8ed1747caae60e Mon Sep 17 00:00:00 2001
|
2020-01-10 17:13:17 +08:00
|
|
|
From: sunguoshuai <sunguoshuai@huawei.com>
|
|
|
|
|
Date: Tue, 22 Jan 2019 22:00:35 -0500
|
2020-11-04 21:19:44 +08:00
|
|
|
Subject: [PATCH] avoid handling paths repeatedly in coalesce paths
|
2020-01-10 17:13:17 +08:00
|
|
|
|
|
|
|
|
reason:fix lun expansion failure when there is offline path
|
|
|
|
|
---
|
|
|
|
|
libmultipath/configure.c | 11 +++++++++++
|
|
|
|
|
libmultipath/structs.c | 1 +
|
|
|
|
|
libmultipath/structs.h | 1 +
|
|
|
|
|
libmultipath/structs_vec.c | 1 +
|
|
|
|
|
4 files changed, 14 insertions(+)
|
|
|
|
|
|
|
|
|
|
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
|
2020-11-04 21:19:44 +08:00
|
|
|
index 6fb477f..ff65c1b 100644
|
2020-01-10 17:13:17 +08:00
|
|
|
--- a/libmultipath/configure.c
|
|
|
|
|
+++ b/libmultipath/configure.c
|
2020-11-04 21:19:44 +08:00
|
|
|
@@ -1166,6 +1166,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
|
2020-07-16 18:51:36 +08:00
|
|
|
|
2020-01-10 17:13:17 +08:00
|
|
|
vector_foreach_slot (pathvec, pp1, k) {
|
2020-07-16 18:51:36 +08:00
|
|
|
int invalid;
|
2020-01-10 17:13:17 +08:00
|
|
|
+ condlog(3, "%s %s: start coalesce", pp1->dev, pp1->dev_t);
|
|
|
|
|
/* skip this path for some reason */
|
|
|
|
|
|
|
|
|
|
/* 1. if path has no unique id or wwid blacklisted */
|
2020-11-04 21:19:44 +08:00
|
|
|
@@ -1202,6 +1203,12 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
|
2020-01-10 17:13:17 +08:00
|
|
|
orphan_path(pp1, "only one path");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
+ /* if path is handled before */
|
|
|
|
|
+ if (pp1->handled) {
|
|
|
|
|
+ condlog(3, "%s: skip handled path.", pp1->dev_t);
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* at this point, we know we really got a new mp
|
2020-11-04 21:19:44 +08:00
|
|
|
@@ -1220,6 +1227,10 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
|
2020-01-10 17:13:17 +08:00
|
|
|
|
|
|
|
|
for (i = k + 1; i < VECTOR_SIZE(pathvec); i++) {
|
|
|
|
|
pp2 = VECTOR_SLOT(pathvec, i);
|
|
|
|
|
+ if (pp2->handled)
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
if (strcmp(pp1->wwid, pp2->wwid))
|
|
|
|
|
continue;
|
|
|
|
|
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
|
2020-11-04 21:19:44 +08:00
|
|
|
index 464596f..e5de0a7 100644
|
2020-01-10 17:13:17 +08:00
|
|
|
--- a/libmultipath/structs.c
|
|
|
|
|
+++ b/libmultipath/structs.c
|
2020-11-04 21:19:44 +08:00
|
|
|
@@ -101,6 +101,7 @@ alloc_path (void)
|
2020-01-10 17:13:17 +08:00
|
|
|
pp->fd = -1;
|
|
|
|
|
pp->tpgs = TPGS_UNDEF;
|
|
|
|
|
pp->priority = PRIO_UNDEF;
|
|
|
|
|
+ pp->handled = 0;
|
2020-07-16 18:51:36 +08:00
|
|
|
pp->checkint = CHECKINT_UNDEF;
|
2020-01-10 17:13:17 +08:00
|
|
|
checker_clear(&pp->checker);
|
|
|
|
|
dm_path_to_gen(pp)->ops = &dm_gen_path_ops;
|
|
|
|
|
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
|
2020-11-04 21:19:44 +08:00
|
|
|
index 7de93d6..022ba12 100644
|
2020-01-10 17:13:17 +08:00
|
|
|
--- a/libmultipath/structs.h
|
|
|
|
|
+++ b/libmultipath/structs.h
|
2020-11-04 21:19:44 +08:00
|
|
|
@@ -280,6 +280,7 @@ struct path {
|
2020-01-10 17:13:17 +08:00
|
|
|
struct checker checker;
|
|
|
|
|
struct multipath * mpp;
|
|
|
|
|
int fd;
|
|
|
|
|
+ int handled;
|
|
|
|
|
int initialized;
|
|
|
|
|
int retriggers;
|
2020-07-16 18:51:36 +08:00
|
|
|
unsigned int path_failures;
|
2020-01-10 17:13:17 +08:00
|
|
|
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
|
2020-11-04 21:19:44 +08:00
|
|
|
index 8895fa7..8676081 100644
|
2020-01-10 17:13:17 +08:00
|
|
|
--- a/libmultipath/structs_vec.c
|
|
|
|
|
+++ b/libmultipath/structs_vec.c
|
2020-11-04 21:19:44 +08:00
|
|
|
@@ -738,6 +738,7 @@ int verify_paths(struct multipath *mpp)
|
2020-01-10 17:13:17 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
vector_foreach_slot (mpp->paths, pp, i) {
|
|
|
|
|
+ pp->handled = 1;
|
|
|
|
|
/*
|
|
|
|
|
* see if path is in sysfs
|
|
|
|
|
*/
|
|
|
|
|
--
|
|
|
|
|
1.8.3.1
|
|
|
|
|
|