multipath-tools/0007-bugfix-lun-expansion-failure-when-there-is-offline-path.patch

68 lines
2.1 KiB
Diff
Raw Normal View History

2020-11-04 21:19:44 +08:00
From 5ebbef9c1f3ae72efe7f9582532a346227a0a1a3 Mon Sep 17 00:00:00 2001
From: renmingshuai <renmingshuai@huawei.com>
Date: Thu, 28 Jan 2021 22:26:58 +0800
Subject: [PATCH] fix lun expansion failure when there is offline path
---
libmultipath/configure.c | 20 +++++++++++++++-----
libmultipath/structs_vec.c | 5 +++--
2 files changed, 18 insertions(+), 7 deletions(-)
2020-01-10 17:13:17 +08:00
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
2020-11-04 21:19:44 +08:00
index ff65c1b..e616da2 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
@@ -1203,11 +1203,18 @@ 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;
- }
+
+ /* if path is offline */
+ if (pp1->state == PATH_DOWN) {
+ orphan_path(pp1, "skip offline path");
+ continue;
+ }
+
+ /* if path is handled before */
+ if (pp1->handled) {
+ condlog(3, "%s: skip handled path.", pp1->dev_t);
+ continue;
+ }
/*
2020-11-04 21:19:44 +08:00
@@ -1235,6 +1242,9 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
2020-01-10 17:13:17 +08:00
if (strcmp(pp1->wwid, pp2->wwid))
continue;
+ if (!pp2->size || pp2->state == PATH_DOWN)
+ continue;
+
if (!mpp->size && pp2->size)
mpp->size = pp2->size;
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
2020-11-04 21:19:44 +08:00
index 8676081..0300add 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
@@ -742,8 +742,9 @@ int verify_paths(struct multipath *mpp)
2020-01-10 17:13:17 +08:00
/*
* see if path is in sysfs
*/
2020-11-04 21:19:44 +08:00
- if (!pp->udev || sysfs_attr_get_value(pp->udev, "dev",
2020-01-10 17:13:17 +08:00
- pp->dev_t, BLK_DEV_SIZE) < 0) {
2020-11-04 21:19:44 +08:00
+ if (!pp->udev || (sysfs_attr_get_value(pp->udev, "dev",
2020-01-10 17:13:17 +08:00
+ pp->dev_t, BLK_DEV_SIZE) < 0) ||
+ (pp->state == PATH_DOWN && pp->size != mpp->size)) {
if (pp->state != PATH_DOWN) {
condlog(1, "%s: removing valid path %s in state %d",
mpp->alias, pp->dev, pp->state);
2020-11-04 21:19:44 +08:00
--
1.8.3.1