[dm-devel] [PATCH 1/6] fix multipathd resize when not all sizes of paths are equal
lixiaokeng
lixiaokeng at huawei.com
Mon Oct 26 09:24:41 UTC 2020
In history, the "multipathd resize" may fail without failed
messages because of there are different sizes paths in mpp.
Here we check every path size in cli_resize, fail and print
messages if there are some different size paths. This patch
was made in 12 Oct 2017.
Signed-off-by: Lixiaokeng <lixiaokeng at huawei.com>
---
multipathd/cli_handlers.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 235e2a2e..18b51875 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -981,9 +981,10 @@ cli_resize(void *v, char **reply, int *len, void *data)
char * mapname = get_keyparam(v, MAP);
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);
@@ -1021,6 +1022,22 @@ cli_resize(void *v, char **reply, int *len, void *data)
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);
--
More information about the dm-devel
mailing list