1 Star 0 Fork 40

sqfu/multipath-tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0006-avoid-handling-paths-repeatedly-in-coalesce-paths.patch 2.58 KB
一键复制 编辑 原始数据 按行查看 历史
lixiaokeng 提交于 2021-11-23 21:49 . upgrade to 0.8.7
From 1b330f511a8b73b56b282c9aa613faccdb9a72f7 Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com>
Date: Tue, 22 Jan 2019 22:00:35 -0500
Subject: [PATCH 06/15] avoid handling paths repeatedly in coalesce paths
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
index 7edb355..fdf8005 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1150,6 +1150,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
goto out;
}
+ 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 */
@@ -1186,6 +1187,12 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
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
@@ -1204,6 +1211,10 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
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
index 6e5a103..557657c 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -101,6 +101,7 @@ alloc_path (void)
pp->fd = -1;
pp->tpgs = TPGS_UNDEF;
pp->priority = PRIO_UNDEF;
+ pp->handled = 0;
pp->checkint = CHECKINT_UNDEF;
checker_clear(&pp->checker);
dm_path_to_gen(pp)->ops = &dm_gen_path_ops;
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 399540e..ec12660 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -310,6 +310,7 @@ struct path {
struct checker checker;
struct multipath * mpp;
int fd;
+ int handled;
int initialized;
int retriggers;
unsigned int path_failures;
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 85d97ac..8170150 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -718,6 +718,7 @@ int verify_paths(struct multipath *mpp)
return 0;
vector_foreach_slot (mpp->paths, pp, i) {
+ pp->handled = 1;
/*
* see if path is in sysfs
*/
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fu-shanqing/multipath-tools.git
git@gitee.com:fu-shanqing/multipath-tools.git
fu-shanqing
multipath-tools
multipath-tools
master

搜索帮助