device-mapper-multipath/0097-multipathd-move-post-reloading-commands-into-resize_.patch

59 lines
1.7 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 9 Nov 2023 18:46:14 -0500
Subject: [PATCH] multipathd: move post-reloading commands into resize_map()
In preparation for reusing resize_map() in other code, move all code
necessary to resize the map to the resize_map() function. Also track if
map was removed in the function.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/cli_handlers.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 93c32c5b..b08b248f 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -856,6 +856,10 @@ int resize_map(struct multipath *mpp, unsigned long long size,
mpp->size = orig_size;
return 1;
}
+ if (setup_multipath(vecs, mpp) != 0)
+ return 2;
+ sync_map_state(mpp);
+
return 0;
}
@@ -869,7 +873,7 @@ cli_resize(void *v, char **reply, int *len, void *data)
unsigned long long size = 0;
struct pathgroup *pgp;
struct path *pp;
- unsigned int i, j;
+ unsigned int i, j, ret;
bool mismatch = false;
mapname = convert_dev(mapname, 0);
@@ -919,14 +923,12 @@ cli_resize(void *v, char **reply, int *len, void *data)
condlog(3, "%s old size is %llu, new size is %llu", mapname, mpp->size,
size);
- if (resize_map(mpp, size, vecs) != 0)
- return 1;
+ ret = resize_map(mpp, size, vecs);
- if (setup_multipath(vecs, mpp) != 0)
- return 1;
- sync_map_state(mpp);
+ if (ret == 2)
+ condlog(0, "%s: map removed while trying to resize", mapname);
- return 0;
+ return (ret != 0);
}
int