multipath-tools/0005-fix-multipathd-resize-when-not-all-paths-size-are-eq.patch

52 lines
1.4 KiB
Diff
Raw Permalink Normal View History

2024-02-05 16:52:45 +08:00
From 8e3c6debb3ed286f94af230f59a0fb9f6a449687 Mon Sep 17 00:00:00 2001
2021-11-23 21:49:34 +08:00
From: Lixiaokeng <lixiaokeng@huawei.com>
Date: Tue, 23 Nov 2021 20:14:23 +0800
2024-02-05 16:52:45 +08:00
Subject: [PATCH] fix multipathd resize when not all paths size are equal
2021-11-23 21:49:34 +08:00
---
multipathd/cli_handlers.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
2024-02-05 16:52:45 +08:00
index 44bf43d..8b59d88 100644
2020-07-16 18:51:36 +08:00
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
2024-02-05 16:52:45 +08:00
@@ -845,9 +845,10 @@ cli_resize(void *v, struct strbuf *reply, void *data)
char * mapname = get_keyparam(v, KEY_MAP);
2020-01-10 17:13:17 +08:00
struct multipath *mpp;
int minor;
- unsigned long long size;
+ unsigned long long size, sz;
struct pathgroup *pgp;
struct path *pp;
+ int i,j;
mapname = convert_dev(mapname, 0);
condlog(2, "%s: resize map (operator)", mapname);
2024-02-05 16:52:45 +08:00
@@ -885,6 +886,22 @@ cli_resize(void *v, struct strbuf *reply, void *data)
2020-01-10 17:13:17 +08:00
mapname);
return 1;
}
+
+ vector_foreach_slot (mpp->pg, pgp, i) {
+ vector_foreach_slot (pgp->paths, pp, j) {
+ if (!pp->udev || sysfs_get_size(pp, &sz)) {
+ condlog(0, "%s: couldn't get size for sysfs. cannot resize",
+ mapname);
+ return 1;
+ }
+ if (size != sz) {
+ condlog(0, "%s: not all path sizes are equal, please check. cannot resize",
+ mapname);
+ return 1;
+ }
+ }
+ }
+
if (size == mpp->size) {
condlog(0, "%s: map is still the same size (%llu)", mapname,
mpp->size);
2020-11-04 21:19:44 +08:00
--
2024-02-05 16:52:45 +08:00
2.33.0
2020-11-04 21:19:44 +08:00