diff --git a/0.8.7.tar.gz b/0.8.7.tar.gz deleted file mode 100644 index 73ea808..0000000 Binary files a/0.8.7.tar.gz and /dev/null differ diff --git a/0.9.5.tar.gz b/0.9.5.tar.gz new file mode 100644 index 0000000..e38847b Binary files /dev/null and b/0.9.5.tar.gz differ diff --git a/0001-change-order-of-multipath.rules.patch b/0001-change-order-of-multipath.rules.patch index 94c1b8b..69b8e8c 100644 --- a/0001-change-order-of-multipath.rules.patch +++ b/0001-change-order-of-multipath.rules.patch @@ -1,7 +1,7 @@ -From d025415810a5792c333e99bd2f77a902c235ea09 Mon Sep 17 00:00:00 2001 +From dc58ea0d1f812c81b8dba9c327272a90b84d2005 Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Fri, 15 May 2015 18:14:09 -0500 -Subject: [PATCH 01/15] change order of multipath.rules +Subject: [PATCH 1/2] change order of multipath.rules At least for RedHat, the rule that calls scsi_id is 60-persistent-storage.rules, so the multipath rule needs to come @@ -13,27 +13,27 @@ Signed-off-by: Benjamin Marzinski 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/multipath/Makefile b/multipath/Makefile -index 0828a8f..b9bbb3c 100644 +index 73db991..b3c2cc8 100644 --- a/multipath/Makefile +++ b/multipath/Makefile @@ -24,7 +24,7 @@ install: - $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir) - $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) -- $(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules -+ $(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules - $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(man8dir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) -@@ -33,7 +33,7 @@ install: - uninstall: - $(RM) $(DESTDIR)$(bindir)/$(EXEC) - $(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules -- $(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules -+ $(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules - $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz - $(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz + $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ + $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir) + $(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) +- $(Q)$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/56-multipath.rules ++ $(Q)$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/62-multipath.rules + $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(modulesloaddir) + $(Q)$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf + $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir) +@@ -44,7 +44,7 @@ uninstall: + $(Q)$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules + $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf + $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf +- $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules ++ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules + $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8 + $(Q)$(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5 -- -1.8.3.1 +2.33.0 diff --git a/0002-RH-add-mpathconf.patch b/0002-RH-add-mpathconf.patch index 93f70dd..23b31a3 100644 --- a/0002-RH-add-mpathconf.patch +++ b/0002-RH-add-mpathconf.patch @@ -1,7 +1,7 @@ -From 1d3c03c1b5136be68aad4f98763537eb56735f0c Mon Sep 17 00:00:00 2001 +From 0ae0e8054ed01ae15c10637c9c646da2259b0ed1 Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Thu, 16 Oct 2014 15:49:01 -0500 -Subject: [PATCH 02/15] RH: add mpathconf +Subject: [PATCH 2/2] RH: add mpathconf mpathconf is a program (largely based on lvmcomf) to help users configure /etc/multipath.conf and enable or disable multipathing. It @@ -17,47 +17,44 @@ Changed-by: hy-euler Signed-off-by: Benjamin Marzinski Signed-off-by: hy-euler --- - multipath/Makefile | 5 + - multipath/mpathconf | 464 ++++++++++++++++++++++++++++++++++++++++++++++++++ - multipath/mpathconf.8 | 119 +++++++++++++ - 3 files changed, 588 insertions(+) + multipath/Makefile | 4 + + multipath/mpathconf | 464 ++++++++++++++++++++++++++++++++++++++++++ + multipath/mpathconf.8 | 119 +++++++++++ + 3 files changed, 587 insertions(+) create mode 100644 multipath/mpathconf create mode 100644 multipath/mpathconf.8 diff --git a/multipath/Makefile b/multipath/Makefile -index b9bbb3c..e720c7f 100644 +index b3c2cc8..b9e04b2 100644 --- a/multipath/Makefile +++ b/multipath/Makefile -@@ -18,10 +18,12 @@ $(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so - $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS) - $(GZIP) $(EXEC).8 > $(EXEC).8.gz - $(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz -+ $(GZIP) mpathconf.8 > mpathconf.8.gz - +@@ -22,6 +22,7 @@ $(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so install: - $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ -+ $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir) - $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules -@@ -29,13 +31,16 @@ install: - $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(man8dir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir) -+ $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(man8dir) - - uninstall: - $(RM) $(DESTDIR)$(bindir)/$(EXEC) - $(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules - $(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules -+ $(RM) $(DESTDIR)$(bindir)/mpathconf - $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz - $(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz -+ $(RM) $(DESTDIR)$(man8dir)/mpathconf.8.gz + $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) + $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ ++ $(Q)$(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ + $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir) + $(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) + $(Q)$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/62-multipath.rules +@@ -33,6 +34,7 @@ install: + $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8 + $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man5 + $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(mandir)/man5 ++ $(Q)$(INSTALL_PROGRAM) -m 644 mpathconf.8 $(DESTDIR)$(mandir)/man8 + ifneq ($(SCSI_DH_MODULES_PRELOAD),) + $(Q)$(INSTALL_PROGRAM) -m 644 scsi_dh.conf $(DESTDIR)$(modulesloaddir)/scsi_dh.conf + $(Q)for _x in $(SCSI_DH_MODULES_PRELOAD); do echo "$$_x"; done \ +@@ -45,8 +47,10 @@ uninstall: + $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf + $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf + $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules ++ $(Q)$(RM) $(DESTDIR)$(bindir)/mpathconf + $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8 + $(Q)$(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5 ++ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/mpathconf.8 clean: dep_clean - $(RM) core *.o $(EXEC) *.gz + $(Q)$(RM) core *.o $(EXEC) multipath.rules tmpfiles.conf diff --git a/multipath/mpathconf b/multipath/mpathconf new file mode 100644 index 0000000..e839134 @@ -654,5 +651,5 @@ index 0000000..5b7ae0c +.SH AUTHOR +Benjamin Marzinski -- -1.8.3.1 +2.33.0 diff --git a/0004-fix-syntax-error.patch b/0004-fix-syntax-error.patch index 24c909c..0ba00f3 100644 --- a/0004-fix-syntax-error.patch +++ b/0004-fix-syntax-error.patch @@ -1,25 +1,26 @@ -From 4e43314afe869f70f96d58dc978d81e104acb650 Mon Sep 17 00:00:00 2001 +From 42fb8e13857b773a34aa386ccfc38dd4456a089b Mon Sep 17 00:00:00 2001 From: wangjufeng Date: Fri, 1 Nov 2019 16:48:49 +0800 -Subject: [PATCH 04/15] fix syntax error +Subject: [PATCH] fix syntax error --- - Makefile.inc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + create-config.mk | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) -diff --git a/Makefile.inc b/Makefile.inc -index d0ec9b4..9944aa1 100644 ---- a/Makefile.inc -+++ b/Makefile.inc -@@ -43,7 +43,7 @@ ifndef SYSTEMD - else - ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1) - SYSTEMD = $(shell systemctl --version 2> /dev/null | \ -- sed -n 's/systemd \([0-9]*\).*/\1/p') -+ sed -n 's/systemd\([0-9]*\).*/\1/p' | awk '{print $$1}') - endif - endif +diff --git a/create-config.mk b/create-config.mk +index f128375..81e9081 100644 +--- a/create-config.mk ++++ b/create-config.mk +@@ -124,7 +124,8 @@ ifeq ($(ENABLE_DMEVENTS_POLL),0) endif + + SYSTEMD := $(strip $(or $(shell $(PKGCONFIG) --modversion libsystemd 2>/dev/null | awk '{print $$1}'), \ +- $(shell systemctl --version 2>/dev/null | sed -n 's/systemd \([0-9]*\).*/\1/p'))) ++ $(shell systemctl --version 2>/dev/null | sed -n 's/systemd\([0-9]*\).*/\1/p' | \ ++ awk '{print $$1}'))) + + + # $(call TEST_CC_OPTION,option,fallback) -- -1.8.3.1 +2.33.0 diff --git a/0005-fix-multipathd-resize-when-not-all-paths-size-are-eq.patch b/0005-fix-multipathd-resize-when-not-all-paths-size-are-eq.patch index 15c28f4..77242ca 100644 --- a/0005-fix-multipathd-resize-when-not-all-paths-size-are-eq.patch +++ b/0005-fix-multipathd-resize-when-not-all-paths-size-are-eq.patch @@ -1,18 +1,18 @@ -From f3c11af226bcbb36da7c2802774c6128dd88b5b4 Mon Sep 17 00:00:00 2001 +From 8e3c6debb3ed286f94af230f59a0fb9f6a449687 Mon Sep 17 00:00:00 2001 From: Lixiaokeng Date: Tue, 23 Nov 2021 20:14:23 +0800 -Subject: [PATCH 05/15] fix multipathd resize when not all paths size are equal +Subject: [PATCH] fix multipathd resize when not all paths size are equal --- 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 6d3a0ae..aeb2be5 100644 +index 44bf43d..8b59d88 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c -@@ -866,9 +866,10 @@ cli_resize(void *v, char **reply, int *len, void *data) - char * mapname = get_keyparam(v, MAP); +@@ -845,9 +845,10 @@ cli_resize(void *v, struct strbuf *reply, void *data) + char * mapname = get_keyparam(v, KEY_MAP); struct multipath *mpp; int minor; - unsigned long long size; @@ -23,7 +23,7 @@ index 6d3a0ae..aeb2be5 100644 mapname = convert_dev(mapname, 0); condlog(2, "%s: resize map (operator)", mapname); -@@ -906,6 +907,22 @@ cli_resize(void *v, char **reply, int *len, void *data) +@@ -885,6 +886,22 @@ cli_resize(void *v, struct strbuf *reply, void *data) mapname); return 1; } @@ -47,5 +47,5 @@ index 6d3a0ae..aeb2be5 100644 condlog(0, "%s: map is still the same size (%llu)", mapname, mpp->size); -- -1.8.3.1 +2.33.0 diff --git a/0006-avoid-handling-paths-repeatedly-in-coalesce-paths.patch b/0006-avoid-handling-paths-repeatedly-in-coalesce-paths.patch index 6b778b1..3283ec3 100644 --- a/0006-avoid-handling-paths-repeatedly-in-coalesce-paths.patch +++ b/0006-avoid-handling-paths-repeatedly-in-coalesce-paths.patch @@ -1,7 +1,7 @@ -From 1b330f511a8b73b56b282c9aa613faccdb9a72f7 Mon Sep 17 00:00:00 2001 +From 1b4ed55ada1f5bcbb676363f44dc3828ce71ce89 Mon Sep 17 00:00:00 2001 From: sunguoshuai Date: Tue, 22 Jan 2019 22:00:35 -0500 -Subject: [PATCH 06/15] avoid handling paths repeatedly in coalesce paths +Subject: [PATCH] avoid handling paths repeatedly in coalesce paths reason:fix lun expansion failure when there is offline path --- @@ -12,10 +12,10 @@ reason:fix lun expansion failure when there is offline path 4 files changed, 14 insertions(+) diff --git a/libmultipath/configure.c b/libmultipath/configure.c -index 7edb355..fdf8005 100644 +index 4a1c28b..4956d32 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c -@@ -1150,6 +1150,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, +@@ -1106,6 +1106,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, goto out; } @@ -23,8 +23,8 @@ index 7edb355..fdf8005 100644 /* 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"); +@@ -1150,6 +1151,12 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, + orphan_path(pp1, "nvme:tcp path not allowed with request queue_mode multipath device"); continue; } + /* if path is handled before */ @@ -33,10 +33,10 @@ index 7edb355..fdf8005 100644 + 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, + */ +@@ -1167,6 +1174,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); @@ -48,10 +48,10 @@ index 7edb355..fdf8005 100644 if (strcmp(pp1->wwid, pp2->wwid)) continue; diff --git a/libmultipath/structs.c b/libmultipath/structs.c -index 6e5a103..557657c 100644 +index 87e84d5..2e44566 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c -@@ -101,6 +101,7 @@ alloc_path (void) +@@ -126,6 +126,7 @@ alloc_path (void) pp->fd = -1; pp->tpgs = TPGS_UNDEF; pp->priority = PRIO_UNDEF; @@ -60,22 +60,22 @@ index 6e5a103..557657c 100644 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 +index a120875..67ba572 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h -@@ -310,6 +310,7 @@ struct path { +@@ -349,6 +349,7 @@ struct path { struct checker checker; struct multipath * mpp; int fd; + int handled; int initialized; int retriggers; - unsigned int path_failures; + int partial_retrigger_delay; diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c -index 85d97ac..8170150 100644 +index f3fdc5a..61001aa 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c -@@ -718,6 +718,7 @@ int verify_paths(struct multipath *mpp) +@@ -738,6 +738,7 @@ int verify_paths(struct multipath *mpp) return 0; vector_foreach_slot (mpp->paths, pp, i) { @@ -84,5 +84,5 @@ index 85d97ac..8170150 100644 * see if path is in sysfs */ -- -1.8.3.1 +2.33.0 diff --git a/0007-fix-lun-expansion-failure-when-there-is-offline-path.patch b/0007-fix-lun-expansion-failure-when-there-is-offline-path.patch index 7b7de36..b5dcf99 100644 --- a/0007-fix-lun-expansion-failure-when-there-is-offline-path.patch +++ b/0007-fix-lun-expansion-failure-when-there-is-offline-path.patch @@ -1,7 +1,7 @@ -From 1c49c790c50452564b7319b2a427462ad266793f Mon Sep 17 00:00:00 2001 +From 9fab4f0956292141a72f7144f1d4157d353c0299 Mon Sep 17 00:00:00 2001 From: renmingshuai Date: Thu, 28 Jan 2021 22:26:58 +0800 -Subject: [PATCH 07/15] fix lun expansion failure when there is offline path +Subject: [PATCH] fix lun expansion failure when there is offline path --- libmultipath/configure.c | 10 ++++++++++ @@ -9,11 +9,11 @@ Subject: [PATCH 07/15] fix lun expansion failure when there is offline path 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c -index fdf8005..84a246b 100644 +index 4956d32..ce5bd8b 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c -@@ -1187,6 +1187,13 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, - orphan_path(pp1, "only one path"); +@@ -1151,6 +1151,13 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, + orphan_path(pp1, "nvme:tcp path not allowed with request queue_mode multipath device"); continue; } + @@ -26,7 +26,7 @@ index fdf8005..84a246b 100644 /* if path is handled before */ if (pp1->handled) { condlog(3, "%s: skip handled path.", pp1->dev_t); -@@ -1219,6 +1226,9 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, +@@ -1182,6 +1189,9 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, if (strcmp(pp1->wwid, pp2->wwid)) continue; @@ -37,10 +37,10 @@ index fdf8005..84a246b 100644 mpp->size = pp2->size; diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c -index 8170150..adc034b 100644 +index 61001aa..317d172 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c -@@ -722,8 +722,9 @@ int verify_paths(struct multipath *mpp) +@@ -742,8 +742,9 @@ int verify_paths(struct multipath *mpp) /* * see if path is in sysfs */ @@ -53,5 +53,5 @@ index 8170150..adc034b 100644 condlog(1, "%s: removing valid path %s in state %d", mpp->alias, pp->dev, pp->state); -- -1.8.3.1 +2.33.0 diff --git a/0009-fix-change-reservation-key-to-uint8-for-memcmp.patch b/0009-fix-change-reservation-key-to-uint8-for-memcmp.patch index 28077a2..d7f7990 100644 --- a/0009-fix-change-reservation-key-to-uint8-for-memcmp.patch +++ b/0009-fix-change-reservation-key-to-uint8-for-memcmp.patch @@ -1,18 +1,18 @@ -From 1564c9c5f94dc23959f46e3061c33146a98523d2 Mon Sep 17 00:00:00 2001 +From a7e2e9405183dc9066b62a03a333c23a4af2f410 Mon Sep 17 00:00:00 2001 From: sunguoshuai Date: Wed, 23 Jan 2019 02:21:31 -0500 -Subject: [PATCH 09/15] fix change reservation key to uint8 for memcmp +Subject: [PATCH] fix change reservation key to uint8 for memcmp reason:fix change reservation key to uint8 for memcmp --- - libmpathpersist/mpath_persist.c | 13 +++++++++++-- + libmpathpersist/mpath_persist_int.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c -index 803a2a2..a062920 100644 ---- a/libmpathpersist/mpath_persist.c -+++ b/libmpathpersist/mpath_persist.c -@@ -275,6 +275,9 @@ static int do_mpath_persistent_reserve_out(vector curmp, vector pathvec, int fd, +diff --git a/libmpathpersist/mpath_persist_int.c b/libmpathpersist/mpath_persist_int.c +index 178c2f5..d88499a 100644 +--- a/libmpathpersist/mpath_persist_int.c ++++ b/libmpathpersist/mpath_persist_int.c +@@ -657,6 +657,9 @@ int do_mpath_persistent_reserve_out(vector curmp, vector pathvec, int fd, int ret; uint64_t prkey; struct config *conf; @@ -22,7 +22,7 @@ index 803a2a2..a062920 100644 ret = mpath_get_map(curmp, pathvec, fd, &alias, &mpp); if (ret != MPATH_PR_SUCCESS) -@@ -301,8 +304,14 @@ static int do_mpath_persistent_reserve_out(vector curmp, vector pathvec, int fd, +@@ -683,8 +686,14 @@ int do_mpath_persistent_reserve_out(vector curmp, vector pathvec, int fd, } } @@ -40,5 +40,5 @@ index 803a2a2..a062920 100644 condlog(0, "%s: configured reservation key doesn't match: 0x%" PRIx64, alias, get_be64(mpp->reservation_key)); ret = MPATH_PR_SYNTAX_ERROR; -- -1.8.3.1 +2.33.0 diff --git a/0010-bugfix-flush-and-sync-before-reboot.patch b/0010-bugfix-flush-and-sync-before-reboot.patch index 5d8ddcd..30dd3c0 100644 --- a/0010-bugfix-flush-and-sync-before-reboot.patch +++ b/0010-bugfix-flush-and-sync-before-reboot.patch @@ -1,17 +1,17 @@ -From 822769cf9509ebca9968ebd29a983271b24b1625 Mon Sep 17 00:00:00 2001 +From e8320323aea97e9bfddd8cd5f4b31ec525370eb3 Mon Sep 17 00:00:00 2001 From: Lixiaokeng Date: Tue, 23 Nov 2021 21:16:19 +0800 -Subject: [PATCH 10/15] bugfix flush and sync before reboot +Subject: [PATCH] bugfix flush and sync before reboot --- - libmultipath/util.c | 7 +++++++ + libmpathutil/util.c | 7 +++++++ 1 file changed, 7 insertions(+) -diff --git a/libmultipath/util.c b/libmultipath/util.c -index ea85840..dd32803 100644 ---- a/libmultipath/util.c -+++ b/libmultipath/util.c -@@ -368,6 +368,13 @@ int safe_write(int fd, const void *buf, size_t count) +diff --git a/libmpathutil/util.c b/libmpathutil/util.c +index 92f25a5..a89f0b4 100644 +--- a/libmpathutil/util.c ++++ b/libmpathutil/util.c +@@ -318,6 +318,13 @@ int safe_write(int fd, const void *buf, size_t count) count -= r; buf = (const char *)buf + r; } @@ -26,5 +26,5 @@ index ea85840..dd32803 100644 } -- -1.8.3.1 +2.33.0 diff --git a/0013-kpartx-change-kpartx-file-and-default-bindir.patch b/0013-kpartx-change-kpartx-file-and-default-bindir.patch index beea0f5..427225a 100644 --- a/0013-kpartx-change-kpartx-file-and-default-bindir.patch +++ b/0013-kpartx-change-kpartx-file-and-default-bindir.patch @@ -1,7 +1,7 @@ -From 021d7687e208d0e01feec945bbde5ff0a5557463 Mon Sep 17 00:00:00 2001 +From 686e2fcd742037d3c5a9830fc89638b5e862242a Mon Sep 17 00:00:00 2001 From: wangjufeng Date: Fri, 10 Jan 2020 11:57:08 +0800 -Subject: [PATCH 13/15] kpartx: change kpartx file and default bindir +Subject: [PATCH] kpartx: change kpartx file and default bindir Change default bindir of multipath to /usr/sbin. Don't set device name-partition number delimiter in kpartx rules. @@ -13,23 +13,23 @@ Signed-off-by: wangjufeng 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.inc b/Makefile.inc -index 9944aa1..9913e7a 100644 +index 2e25d2e..f17fa63 100644 --- a/Makefile.inc +++ b/Makefile.inc -@@ -53,7 +53,7 @@ ifndef SYSTEMDPATH - endif - - prefix = --exec_prefix = $(prefix) -+exec_prefix = $(prefix)/usr - usr_prefix = $(prefix) - bindir = $(exec_prefix)/sbin - libudevdir = $(prefix)/$(SYSTEMDPATH)/udev +@@ -34,7 +34,7 @@ endif + # Paths. All these can be overridden on the "make" command line. + prefix := + # Prefix for binaries +-exec_prefix := $(prefix) ++exec_prefix := $(prefix)/usr + # Prefix for non-essential libraries (libdmmp) + usr_prefix := $(prefix) + # Where to install systemd-related files. systemd is usually installed under /usr diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules -index d7527d7..0e0d70d 100644 +index 1969dee..d2b2823 100644 --- a/kpartx/kpartx.rules +++ b/kpartx/kpartx.rules -@@ -36,6 +36,6 @@ LABEL="mpath_kpartx_end" +@@ -39,6 +39,6 @@ LABEL="mpath_kpartx_end" GOTO="kpartx_end" LABEL="run_kpartx" @@ -38,5 +38,5 @@ index d7527d7..0e0d70d 100644 LABEL="kpartx_end" -- -1.8.3.1 +2.33.0 diff --git a/0014-remove-local-disk-from-pathvec.patch b/0014-remove-local-disk-from-pathvec.patch index f9208d6..4bce6be 100644 --- a/0014-remove-local-disk-from-pathvec.patch +++ b/0014-remove-local-disk-from-pathvec.patch @@ -1,4 +1,4 @@ -From 2051a9f6ea12dc90c9c5b90912b79984d9064d0d Mon Sep 17 00:00:00 2001 +From 2ba871e4f8cf132e60b03794413a35441df5abdb Mon Sep 17 00:00:00 2001 From: chenminhua Date: Mon, 2 Apr 2018 04:01:04 -0400 Subject: [PATCH] remove local disk from pathvec @@ -10,19 +10,19 @@ on fc or iscsi devices. [Changelog]:add upgrade path [Author]:chenminhua --- - libmultipath/discovery.c | 137 ++++++++++++++++++++++++++++++++++++-- + libmultipath/discovery.c | 137 ++++++++++++++++++++++++++++-- libmultipath/discovery.h | 1 + libmultipath/libmultipath.version | 1 + - multipathd/main.c | 4 ++ + multipathd/main.c | 4 + 4 files changed, 137 insertions(+), 6 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c -index f25fe9e..c9ebd49 100644 +index 6865cd9..83c8ee6 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -37,6 +37,112 @@ - #include "print.h" - #include "strbuf.h" + + #define VPD_BUFLEN 4096 +const char *conf_file = "/etc/multipath_private.conf"; +static int conf_file_parsed = 0; @@ -81,7 +81,7 @@ index f25fe9e..c9ebd49 100644 +static int +transport(int type, int h) +{ -+ char buff[PATH_SIZE]; ++ char buff[PATH_MAX]; + int len, off; + struct stat a_stat; + @@ -93,17 +93,17 @@ index f25fe9e..c9ebd49 100644 + strcpy(buff, "/sys"); + strcat(buff, "/class/fc_host/"); + len = strlen(buff); -+ snprintf(buff + len, PATH_SIZE - len, "host%d", h); ++ snprintf(buff + len, PATH_MAX - len, "host%d", h); + if ((stat(buff, &a_stat) >= 0) && S_ISDIR(a_stat.st_mode)) { + return 0; + } -+ memset(buff, 0, PATH_SIZE); ++ memset(buff, 0, PATH_MAX); + + /* iSCSI device */ + strcpy(buff, "/sys"); + strcat(buff, "/class/iscsi_host/"); + off = strlen(buff); -+ snprintf(buff + off, PATH_SIZE - off, "host%d", h); ++ snprintf(buff + off, PATH_MAX - off, "host%d", h); + if ((stat(buff, &a_stat) >= 0) && S_ISDIR(a_stat.st_mode)) { + return 0; + } @@ -175,7 +175,7 @@ index f25fe9e..c9ebd49 100644 } static void cleanup_udev_enumerate_ptr(void *arg) -@@ -2284,6 +2403,12 @@ int pathinfo(struct path *pp, struct config *conf, int mask) +@@ -2350,6 +2469,12 @@ int pathinfo(struct path *pp, struct config *conf, int mask) if (rc != PATHINFO_OK) return rc; @@ -189,10 +189,10 @@ index f25fe9e..c9ebd49 100644 pp->sg_id.proto_id == SCSI_PROTOCOL_USB && !conf->allow_usb_devices) { diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h -index a5446b4..26b6db1 100644 +index acd5179..d8284be 100644 --- a/libmultipath/discovery.h +++ b/libmultipath/discovery.h -@@ -58,6 +58,7 @@ bool has_uid_fallback(struct path *pp); +@@ -57,6 +57,7 @@ bool has_uid_fallback(struct path *pp); int get_uid(struct path * pp, int path_state, struct udev_device *udev, int allow_fallback); bool is_vpd_page_supported(int fd, int pg); @@ -201,24 +201,24 @@ index a5446b4..26b6db1 100644 /* * discovery bitmask diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version -index eb5b5b5..bccf3f3 100644 +index aba1a30..ebf1482 100644 --- a/libmultipath/libmultipath.version +++ b/libmultipath/libmultipath.version -@@ -142,6 +142,7 @@ global: - recv_packet_from_client; +@@ -147,6 +147,7 @@ global: + _print_multipath_topology; reinstate_paths; remember_wwid; + remove_local_path; remove_map; remove_map_by_alias; - remove_maps; + remove_map_callback; diff --git a/multipathd/main.c b/multipathd/main.c -index 02f368a..47ca1b5 100644 +index ebec203..2b6636d 100644 --- a/multipathd/main.c +++ b/multipathd/main.c -@@ -1035,6 +1035,10 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) - int start_waiter = 0; - int ret; +@@ -1202,6 +1202,10 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) + int ro; + unsigned char prflag = PRFLAG_UNSET; + /* if pp is local path,remove it and return 0. */ + if (!remove_local_path(vecs->pathvec, pp)) @@ -228,5 +228,5 @@ index 02f368a..47ca1b5 100644 * need path UID to go any further */ -- -2.14.3 (Apple Git-98) +2.33.0 diff --git a/0015-clear-mpp-path-reference-when-path-is-freed-otherwis.patch b/0015-clear-mpp-path-reference-when-path-is-freed-otherwis.patch index e6f8bab..7b34c1e 100644 --- a/0015-clear-mpp-path-reference-when-path-is-freed-otherwis.patch +++ b/0015-clear-mpp-path-reference-when-path-is-freed-otherwis.patch @@ -1,8 +1,8 @@ -From c6530acb0a5ed3acb8ad930ef9e54a27c17d1521 Mon Sep 17 00:00:00 2001 +From aaf527afed109ae647948d466fe76594f48b1e1d Mon Sep 17 00:00:00 2001 From: root Date: Fri, 22 Mar 2019 19:48:35 +0800 -Subject: [PATCH 15/15] clear mpp path reference when path is freed, otherwise - double free may occur in verify_paths. +Subject: [PATCH] clear mpp path reference when path is freed, otherwise double + free may occur in verify_paths. call stack: vecs=vecs@entry=0x557b01d62140, rpvec=rpvec@entry=0x0) at structs_vec.c:521 @@ -17,10 +17,10 @@ call stack: 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c -index 72982ac..2144447 100644 +index 83c8ee6..9e10b41 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c -@@ -115,7 +115,7 @@ transport (int h) +@@ -124,7 +124,7 @@ transport(int type, int h) } int @@ -29,7 +29,7 @@ index 72982ac..2144447 100644 { int i = -1; -@@ -130,7 +130,9 @@ remove_local_path (vector pathvec, struct path *pp) +@@ -139,7 +139,9 @@ remove_local_path (vector pathvec, struct path *pp) if ((i = find_slot(pathvec, (void *)pp)) != -1) { vector_del_slot(pathvec, i); } @@ -40,7 +40,7 @@ index 72982ac..2144447 100644 return 0; } -@@ -238,7 +240,7 @@ path_discover (vector pathvec, struct config * conf, +@@ -247,7 +249,7 @@ path_discover (vector pathvec, struct config * conf, if (err == 1) return 1; if (err == 0) @@ -49,7 +49,7 @@ index 72982ac..2144447 100644 return 0; } else { -@@ -251,7 +253,7 @@ path_discover (vector pathvec, struct config * conf, +@@ -260,7 +262,7 @@ path_discover (vector pathvec, struct config * conf, if (err) return err; @@ -59,10 +59,10 @@ index 72982ac..2144447 100644 } } diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h -index 26b6db1..d51bc0e 100644 +index d8284be..fce5faa 100644 --- a/libmultipath/discovery.h +++ b/libmultipath/discovery.h -@@ -58,7 +58,7 @@ bool has_uid_fallback(struct path *pp); +@@ -57,7 +57,7 @@ bool has_uid_fallback(struct path *pp); int get_uid(struct path * pp, int path_state, struct udev_device *udev, int allow_fallback); bool is_vpd_page_supported(int fd, int pg); @@ -72,10 +72,10 @@ index 26b6db1..d51bc0e 100644 /* * discovery bitmask diff --git a/multipathd/main.c b/multipathd/main.c -index 47ca1b5..118dadd 100644 +index 2b6636d..aa5d1ae 100644 --- a/multipathd/main.c +++ b/multipathd/main.c -@@ -884,6 +884,21 @@ check_path_wwid_change(struct path *pp) +@@ -1015,6 +1015,21 @@ check_path_wwid_change(struct path *pp) return false; } @@ -94,10 +94,10 @@ index 47ca1b5..118dadd 100644 + } +} + - static int - uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) - { -@@ -975,6 +990,7 @@ uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) + /* + * uev_add_path can call uev_update_path, and uev_update_path can call + * uev_add_path +@@ -1116,6 +1131,7 @@ uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) i = find_slot(vecs->pathvec, (void *)pp); if (i != -1) vector_del_slot(vecs->pathvec, i); @@ -105,8 +105,8 @@ index 47ca1b5..118dadd 100644 free_path(pp); } else { condlog(0, "%s: failed to reinitialize path", -@@ -1036,8 +1052,11 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) - int ret; +@@ -1203,8 +1219,11 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) + unsigned char prflag = PRFLAG_UNSET; /* if pp is local path,remove it and return 0. */ - if (!remove_local_path(vecs->pathvec, pp)) @@ -118,7 +118,7 @@ index 47ca1b5..118dadd 100644 /* * need path UID to go any further -@@ -1052,6 +1071,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) +@@ -1219,6 +1238,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) int i = find_slot(vecs->pathvec, (void *)pp); if (i != -1) vector_del_slot(vecs->pathvec, i); @@ -126,7 +126,7 @@ index 47ca1b5..118dadd 100644 free_path(pp); return 1; } -@@ -1305,6 +1325,8 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) +@@ -1460,6 +1480,8 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) /* mpp == NULL */ if ((i = find_slot(vecs->pathvec, (void *)pp)) != -1) vector_del_slot(vecs->pathvec, i); @@ -136,5 +136,5 @@ index 47ca1b5..118dadd 100644 } out: -- -1.8.3.1 +2.33.0 diff --git a/0016-multipath-return-failure-on-an-invalid-remove-cmd.patch b/0016-multipath-return-failure-on-an-invalid-remove-cmd.patch deleted file mode 100644 index 6ad85a5..0000000 --- a/0016-multipath-return-failure-on-an-invalid-remove-cmd.patch +++ /dev/null @@ -1,37 +0,0 @@ -From a7c13c340eb76c1b20580663e7ea2ad99b37022f Mon Sep 17 00:00:00 2001 -From: Benjamin Marzinski -Date: Wed, 30 Mar 2022 15:14:56 -0500 -Subject: [PATCH] multipath: return failure on an invalid remove command - -When "multipath -f" is run on a device that doesn't exist or isn't a -multipath device, the command will not remove any device, but it will -still return success. Multiple functions rely on _dm_flush_map() -returning success when called with name that doesn't match any -multipath device. So before calling _dm_flush_map(), call dm_is_mpath(), -to check if the device exists and is a multipath device, and return -failure if it's not. - -Signed-off-by: Benjamin Marzinski ---- - multipath/main.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/multipath/main.c b/multipath/main.c -index 65ece83..743f3e0 100644 ---- a/multipath/main.c -+++ b/multipath/main.c -@@ -1060,6 +1060,11 @@ main (int argc, char *argv[]) - if (retries < 0) - retries = conf->remove_retries; - if (cmd == CMD_FLUSH_ONE) { -+ if (dm_is_mpath(dev) != 1) { -+ condlog(0, "%s is not a multipath device", dev); -+ r = RTVL_FAIL; -+ goto out; -+ } - r = dm_suspend_and_flush_map(dev, retries) ? - RTVL_FAIL : RTVL_OK; - goto out; --- -2.33.0 - diff --git a/0023-multipathd-Fixed-multipathd-parameter-invoking-seque.patch b/0016-multipathd-Fixed-multipathd-parameter-invoking-seque.patch similarity index 100% rename from 0023-multipathd-Fixed-multipathd-parameter-invoking-seque.patch rename to 0016-multipathd-Fixed-multipathd-parameter-invoking-seque.patch diff --git a/0024-libmultipath-io_err_stat-don-t-free-aio-memory-befor.patch b/0017-libmultipath-io_err_stat-don-t-free-aio-memory-befor.patch similarity index 93% rename from 0024-libmultipath-io_err_stat-don-t-free-aio-memory-befor.patch rename to 0017-libmultipath-io_err_stat-don-t-free-aio-memory-befor.patch index e150841..1574720 100644 --- a/0024-libmultipath-io_err_stat-don-t-free-aio-memory-befor.patch +++ b/0017-libmultipath-io_err_stat-don-t-free-aio-memory-befor.patch @@ -1,4 +1,4 @@ -From eff53df4b1cdd74643f54568a327ae7b824337bb Mon Sep 17 00:00:00 2001 +From 2bc298d4e3a7c609b441914cfcae7e8bb9d54c92 Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Wed, 27 Sep 2023 12:34:08 +0200 Subject: [PATCH] libmultipath: io_err_stat: don't free aio memory before @@ -21,10 +21,10 @@ Cc: Guan Junxiong 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/libmultipath/io_err_stat.c b/libmultipath/io_err_stat.c -index d8d91f6..480034b 100644 +index dc1c252..c474c34 100644 --- a/libmultipath/io_err_stat.c +++ b/libmultipath/io_err_stat.c -@@ -112,10 +112,14 @@ static int init_each_dio_ctx(struct dio_ctx *ct, int blksize, +@@ -111,10 +111,14 @@ static int init_each_dio_ctx(struct dio_ctx *ct, int blksize, return 0; } @@ -55,11 +55,11 @@ index d8d91f6..480034b 100644 for (i = 0; i < CONCUR_NR_EVENT; i++) - deinit_each_dio_ctx(p->dio_ctx_array + i); -- FREE(p->dio_ctx_array); +- free(p->dio_ctx_array); + inflight += deinit_each_dio_ctx(p->dio_ctx_array + i); + + if (!inflight) -+ FREE(p->dio_ctx_array); ++ free(p->dio_ctx_array); + else + io_err_stat_log(2, "%s: can't free aio space of %s, %d IOs in flight", + __func__, p->devname, inflight); diff --git a/0017-multipath-fix-exit-status-of-multipath-T.patch b/0017-multipath-fix-exit-status-of-multipath-T.patch deleted file mode 100644 index e5a5955..0000000 --- a/0017-multipath-fix-exit-status-of-multipath-T.patch +++ /dev/null @@ -1,28 +0,0 @@ -From c9c063b6cef7c922fb5b509bd59c597fa1f673d6 Mon Sep 17 00:00:00 2001 -From: Martin Wilck -Date: Fri, 22 Oct 2021 12:58:11 +0200 -Subject: [PATCH] multipath: fix exit status of multipath -T - -We must set the return value in configure(). - -Signed-off-by: Martin Wilck -Reviewed-by: Benjamin Marzinski ---- - multipath/main.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/multipath/main.c b/multipath/main.c -index 743f3e0..e964792 100644 ---- a/multipath/main.c -+++ b/multipath/main.c -@@ -560,6 +560,7 @@ configure (struct config *conf, enum mpath_cmds cmd, - - dump_config(conf, hwes, curmp); - vector_free(hwes); -+ r = RTVL_OK; - goto out; - } - --- -2.33.0 - diff --git a/0025-libmultipath-io_err_stat-call-io_destroy-inside-free.patch b/0018-libmultipath-io_err_stat-call-io_destroy-inside-free.patch similarity index 100% rename from 0025-libmultipath-io_err_stat-call-io_destroy-inside-free.patch rename to 0018-libmultipath-io_err_stat-call-io_destroy-inside-free.patch diff --git a/0018-multipath-tools-use-run-instead-of-dev-shm.patch b/0018-multipath-tools-use-run-instead-of-dev-shm.patch deleted file mode 100644 index 64050c1..0000000 --- a/0018-multipath-tools-use-run-instead-of-dev-shm.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 0b6ed498ec133a1ddb4afbb8614c25f52835ba3a Mon Sep 17 00:00:00 2001 -From: Martin Wilck -Date: Thu, 1 Sep 2022 19:21:30 +0200 -Subject: [PATCH] multipath-tools: use /run instead of /dev/shm - -/dev/shm may have unsafe permissions. Use /run instead. -Use systemd's tmpfiles.d mechanism to create /run/multipath -early during boot. - -For backward compatibilty, make the runtime directory configurable -via the "runtimedir" make variable. - -Signed-off-by: Martin Wilck -Reviewed-by: Benjamin Marzinski ---- - Makefile.inc | 3 +++ - libmultipath/defaults.h | 2 +- - multipath/Makefile | 11 ++++++++--- - multipath/{multipath.rules => multipath.rules.in} | 4 ++-- - multipath/tmpfiles.conf.in | 1 + - 5 files changed, 15 insertions(+), 6 deletions(-) - rename multipath/{multipath.rules => multipath.rules.in} (95%) - create mode 100644 multipath/tmpfiles.conf.in - -diff --git a/Makefile.inc b/Makefile.inc -index 9913e7a..1a7f9a8 100644 ---- a/Makefile.inc -+++ b/Makefile.inc -@@ -57,6 +57,7 @@ exec_prefix = $(prefix)/usr - usr_prefix = $(prefix) - bindir = $(exec_prefix)/sbin - libudevdir = $(prefix)/$(SYSTEMDPATH)/udev -+tmpfilesdir = $(prefix)/$(SYSTEMDPATH)/tmpfiles.d - udevrulesdir = $(libudevdir)/rules.d - multipathdir = $(TOPDIR)/libmultipath - man8dir = $(prefix)/usr/share/man/man8 -@@ -74,6 +75,7 @@ libdmmpdir = $(TOPDIR)/libdmmp - nvmedir = $(TOPDIR)/libmultipath/nvme - includedir = $(prefix)/usr/include - pkgconfdir = $(usrlibdir)/pkgconfig -+runtimedir := /$(RUN) - - GZIP = gzip -9 -c - RM = rm -f -@@ -104,6 +106,7 @@ WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implici - CPPFLAGS := -Wp,-D_FORTIFY_SOURCE=2 - CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe \ - -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \ -+ -DRUNTIME_DIR=\"$(runtimedir)\" \ - -MMD -MP - BIN_CFLAGS = -fPIE -DPIE - LIB_CFLAGS = -fPIC -diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h -index e0dd32a..cec82f0 100644 ---- a/libmultipath/defaults.h -+++ b/libmultipath/defaults.h -@@ -69,7 +69,7 @@ - #define DEFAULT_WWIDS_FILE "/etc/multipath/wwids" - #define DEFAULT_PRKEYS_FILE "/etc/multipath/prkeys" - #define DEFAULT_CONFIG_DIR "/etc/multipath/conf.d" --#define MULTIPATH_SHM_BASE "/dev/shm/multipath/" -+#define MULTIPATH_SHM_BASE RUNTIME_DIR "/multipath/" - - - static inline char *set_default(char *str) -diff --git a/multipath/Makefile b/multipath/Makefile -index e720c7f..199a47a 100644 ---- a/multipath/Makefile -+++ b/multipath/Makefile -@@ -12,7 +12,7 @@ EXEC = multipath - - OBJS = main.o - --all: $(EXEC) -+all: $(EXEC) multipath.rules tmpfiles.conf - - $(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so - $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS) -@@ -26,7 +26,9 @@ install: - $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir) - $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) -- $(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules -+ $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules -+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir) -+ $(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf - $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir) - $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(man8dir) - $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) -@@ -43,9 +45,12 @@ uninstall: - $(RM) $(DESTDIR)$(man8dir)/mpathconf.8.gz - - clean: dep_clean -- $(RM) core *.o $(EXEC) *.gz -+ $(RM) core *.o $(EXEC) *.gz multipath.rules tmpfiles.conf - - include $(wildcard $(OBJS:.o=.d)) - - dep_clean: - $(RM) $(OBJS:.o=.d) -+ -+%: %.in -+ sed 's,@RUNTIME_DIR@,$(runtimedir),' $< >$@ -diff --git a/multipath/multipath.rules b/multipath/multipath.rules.in -similarity index 95% -rename from multipath/multipath.rules -rename to multipath/multipath.rules.in -index 9df11a9..be401c8 100644 ---- a/multipath/multipath.rules -+++ b/multipath/multipath.rules.in -@@ -1,8 +1,8 @@ - # Set DM_MULTIPATH_DEVICE_PATH if the device should be handled by multipath - SUBSYSTEM!="block", GOTO="end_mpath" - KERNEL!="sd*|dasd*|nvme*", GOTO="end_mpath" --ACTION=="remove", TEST=="/dev/shm/multipath/find_multipaths/$major:$minor", \ -- RUN+="/usr/bin/rm -f /dev/shm/multipath/find_multipaths/$major:$minor" -+ACTION=="remove", TEST=="@RUNTIME_DIR@/multipath/find_multipaths/$major:$minor", \ -+ RUN+="/usr/bin/rm -f @RUNTIME_DIR@/multipath/find_multipaths/$major:$minor" - ACTION!="add|change", GOTO="end_mpath" - - IMPORT{cmdline}="nompath" -diff --git a/multipath/tmpfiles.conf.in b/multipath/tmpfiles.conf.in -new file mode 100644 -index 0000000..21be438 ---- /dev/null -+++ b/multipath/tmpfiles.conf.in -@@ -0,0 +1 @@ -+d @RUNTIME_DIR@/multipath 0700 root root - --- -2.27.0 - diff --git a/0019-multipathd-add-and-set-cli_handlers-in-a-single-step.patch b/0019-multipathd-add-and-set-cli_handlers-in-a-single-step.patch deleted file mode 100644 index 63c9428..0000000 --- a/0019-multipathd-add-and-set-cli_handlers-in-a-single-step.patch +++ /dev/null @@ -1,181 +0,0 @@ -From db77d1b3cdb14ca0e32132ff7ad360e3d48f62ee Mon Sep 17 00:00:00 2001 -From: Martin Wilck -Date: Tue, 7 Sep 2021 22:41:46 +0200 -Subject: [PATCH] multipathd: add and set cli_handlers in a single step - -Modify set_handler_callback() such that a missing slot is created -if no matching slot is found. This way, we can skip the initialization -with NULL handlers on startup. Assigning the same handler multiple -times would be a bug which is tested with assert(). - -Reviewed-by: Benjamin Marzinski ---- - multipathd/cli.c | 96 ++++++++---------------------------------------- - multipathd/cli.h | 7 ++-- - 2 files changed, 20 insertions(+), 83 deletions(-) - -diff --git a/multipathd/cli.c b/multipathd/cli.c -index 4d6c37c..ddeb5fc 100644 ---- a/multipathd/cli.c -+++ b/multipathd/cli.c -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - #include "memory.h" - #include "vector.h" - #include "structs.h" -@@ -64,26 +65,27 @@ out: - return 1; - } - --int --add_handler (uint64_t fp, int (*fn)(void *, char **, int *, void *)) -+ -+static struct handler *add_handler (uint64_t fp, int (*fn)(void *, char **, int *, void *), bool locked) - { - struct handler * h; - - h = alloc_handler(); - -- if (!h) -- return 1; -+ if (h == NULL) -+ return NULL; - - if (!vector_alloc_slot(handlers)) { - FREE(h); -- return 1; -+ return NULL; - } - - vector_set_slot(handlers, h); - h->fingerprint = fp; - h->fn = fn; -+ h->locked = locked; - -- return 0; -+ return h; - } - - static struct handler * -@@ -100,26 +102,17 @@ find_handler (uint64_t fp) - } - - int --set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *)) -+__set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *), bool locked) - { -- struct handler * h = find_handler(fp); -- -- if (!h) -- return 1; -- h->fn = fn; -- h->locked = 1; -- return 0; --} -- --int --set_unlocked_handler_callback (uint64_t fp,int (*fn)(void *, char **, int *, void *)) --{ -- struct handler * h = find_handler(fp); -+ struct handler *h; - -- if (!h) -+ assert(find_handler(fp) == NULL); -+ h = add_handler(fp, fn, locked); -+ if (!h) { -+ condlog(0, "%s: failed to set handler for code %"PRIu64, -+ __func__, fp); - return 1; -- h->fn = fn; -- h->locked = 0; -+ } - return 0; - } - -@@ -513,63 +506,6 @@ cli_init (void) { - if (alloc_handlers()) - return 1; - -- add_handler(LIST+PATHS, NULL); -- add_handler(LIST+PATHS+FMT, NULL); -- add_handler(LIST+PATHS+RAW+FMT, NULL); -- add_handler(LIST+PATH, NULL); -- add_handler(LIST+STATUS, NULL); -- add_handler(LIST+DAEMON, NULL); -- add_handler(LIST+MAPS, NULL); -- add_handler(LIST+MAPS+STATUS, NULL); -- add_handler(LIST+MAPS+STATS, NULL); -- add_handler(LIST+MAPS+FMT, NULL); -- add_handler(LIST+MAPS+RAW+FMT, NULL); -- add_handler(LIST+MAPS+TOPOLOGY, NULL); -- add_handler(LIST+MAPS+JSON, NULL); -- add_handler(LIST+TOPOLOGY, NULL); -- add_handler(LIST+MAP+TOPOLOGY, NULL); -- add_handler(LIST+MAP+JSON, NULL); -- add_handler(LIST+MAP+FMT, NULL); -- add_handler(LIST+MAP+RAW+FMT, NULL); -- add_handler(LIST+CONFIG, NULL); -- add_handler(LIST+CONFIG+LOCAL, NULL); -- add_handler(LIST+BLACKLIST, NULL); -- add_handler(LIST+DEVICES, NULL); -- add_handler(LIST+WILDCARDS, NULL); -- add_handler(RESET+MAPS+STATS, NULL); -- add_handler(RESET+MAP+STATS, NULL); -- add_handler(ADD+PATH, NULL); -- add_handler(DEL+PATH, NULL); -- add_handler(ADD+MAP, NULL); -- add_handler(DEL+MAP, NULL); -- add_handler(DEL+MAPS, NULL); -- add_handler(SWITCH+MAP+GROUP, NULL); -- add_handler(RECONFIGURE, NULL); -- add_handler(SUSPEND+MAP, NULL); -- add_handler(RESUME+MAP, NULL); -- add_handler(RESIZE+MAP, NULL); -- add_handler(RESET+MAP, NULL); -- add_handler(RELOAD+MAP, NULL); -- add_handler(DISABLEQ+MAP, NULL); -- add_handler(RESTOREQ+MAP, NULL); -- add_handler(DISABLEQ+MAPS, NULL); -- add_handler(RESTOREQ+MAPS, NULL); -- add_handler(REINSTATE+PATH, NULL); -- add_handler(FAIL+PATH, NULL); -- add_handler(QUIT, NULL); -- add_handler(SHUTDOWN, NULL); -- add_handler(GETPRSTATUS+MAP, NULL); -- add_handler(SETPRSTATUS+MAP, NULL); -- add_handler(UNSETPRSTATUS+MAP, NULL); -- add_handler(GETPRKEY+MAP, NULL); -- add_handler(SETPRKEY+MAP+KEY, NULL); -- add_handler(UNSETPRKEY+MAP, NULL); -- add_handler(FORCEQ+DAEMON, NULL); -- add_handler(RESTOREQ+DAEMON, NULL); -- add_handler(SETMARGINAL+PATH, NULL); -- add_handler(UNSETMARGINAL+PATH, NULL); -- add_handler(UNSETMARGINAL+MAP, NULL); -- - return 0; - } - -diff --git a/multipathd/cli.h b/multipathd/cli.h -index fdfb9ae..a6704b1 100644 ---- a/multipathd/cli.h -+++ b/multipathd/cli.h -@@ -131,9 +131,10 @@ struct handler { - }; - - int alloc_handlers (void); --int add_handler (uint64_t fp, int (*fn)(void *, char **, int *, void *)); --int set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *)); --int set_unlocked_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *)); -+int __set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *), bool locked); -+#define set_handler_callback(fp, fn) __set_handler_callback(fp, fn, true) -+#define set_unlocked_handler_callback(fp, fn) __set_handler_callback(fp, fn, false) -+ - int parse_cmd (char * cmd, char ** reply, int * len, void *, int); - int load_keys (void); - char * get_keyparam (vector v, uint64_t code); --- -2.33.0 diff --git a/0020-multipathd-make-all-cli_handlers-static.patch b/0020-multipathd-make-all-cli_handlers-static.patch deleted file mode 100644 index 3dd13bc..0000000 --- a/0020-multipathd-make-all-cli_handlers-static.patch +++ /dev/null @@ -1,842 +0,0 @@ -From f515b8e552412d01f3b01c5c7129452a82d8714d Mon Sep 17 00:00:00 2001 -From: Martin Wilck -Date: Tue, 7 Sep 2021 22:32:46 +0200 -Subject: [PATCH] multipathd: make all cli_handlers static - -The cli_handler functions are only called from the handler table and -need not be exported. - -Reviewed-by: Benjamin Marzinski ---- - multipathd/cli_handlers.c | 214 ++++++++++++++++++++++---------------- - multipathd/cli_handlers.h | 61 ++--------- - multipathd/main.c | 58 +---------- - 3 files changed, 134 insertions(+), 199 deletions(-) - -diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c -index aeb2be5..f75e176 100644 ---- a/multipathd/cli_handlers.c -+++ b/multipathd/cli_handlers.c -@@ -39,7 +39,7 @@ - *(__len) = *(__rep) ? sizeof(string_literal) : 0; \ - } while (0) - --int -+static int - show_paths (char ** r, int * len, struct vectors * vecs, char * style, - int pretty) - { -@@ -70,7 +70,7 @@ show_paths (char ** r, int * len, struct vectors * vecs, char * style, - return 0; - } - --int -+static int - show_path (char ** r, int * len, struct vectors * vecs, struct path *pp, - char * style) - { -@@ -85,7 +85,7 @@ show_path (char ** r, int * len, struct vectors * vecs, struct path *pp, - return 0; - } - --int -+static int - show_map_topology (char ** r, int * len, struct multipath * mpp, - struct vectors * vecs) - { -@@ -102,7 +102,7 @@ show_map_topology (char ** r, int * len, struct multipath * mpp, - return 0; - } - --int -+static int - show_maps_topology (char ** r, int * len, struct vectors * vecs) - { - STRBUF_ON_STACK(reply); -@@ -128,7 +128,7 @@ show_maps_topology (char ** r, int * len, struct vectors * vecs) - return 0; - } - --int -+static int - show_maps_json (char ** r, int * len, struct vectors * vecs) - { - STRBUF_ON_STACK(reply); -@@ -149,7 +149,7 @@ show_maps_json (char ** r, int * len, struct vectors * vecs) - return 0; - } - --int -+static int - show_map_json (char ** r, int * len, struct multipath * mpp, - struct vectors * vecs) - { -@@ -194,7 +194,7 @@ reset_stats(struct multipath * mpp) - mpp->stat_map_failures = 0; - } - --int -+static int - cli_list_config (void * v, char ** reply, int * len, void * data) - { - condlog(3, "list config (operator)"); -@@ -207,7 +207,7 @@ static void v_free(void *x) - vector_free(x); - } - --int -+static int - cli_list_config_local (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -223,7 +223,7 @@ cli_list_config_local (void * v, char ** reply, int * len, void * data) - return ret; - } - --int -+static int - cli_list_paths (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -233,7 +233,7 @@ cli_list_paths (void * v, char ** reply, int * len, void * data) - return show_paths(reply, len, vecs, PRINT_PATH_CHECKER, 1); - } - --int -+static int - cli_list_paths_fmt (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -244,7 +244,7 @@ cli_list_paths_fmt (void * v, char ** reply, int * len, void * data) - return show_paths(reply, len, vecs, fmt, 1); - } - --int -+static int - cli_list_paths_raw (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -255,7 +255,7 @@ cli_list_paths_raw (void * v, char ** reply, int * len, void * data) - return show_paths(reply, len, vecs, fmt, 0); - } - --int -+static int - cli_list_path (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -272,7 +272,7 @@ cli_list_path (void * v, char ** reply, int * len, void * data) - return show_path(reply, len, vecs, pp, "%o"); - } - --int -+static int - cli_list_map_topology (void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; -@@ -291,7 +291,7 @@ cli_list_map_topology (void * v, char ** reply, int * len, void * data) - return show_map_topology(reply, len, mpp, vecs); - } - --int -+static int - cli_list_maps_topology (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -301,7 +301,7 @@ cli_list_maps_topology (void * v, char ** reply, int * len, void * data) - return show_maps_topology(reply, len, vecs); - } - --int -+static int - cli_list_map_json (void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; -@@ -320,7 +320,7 @@ cli_list_map_json (void * v, char ** reply, int * len, void * data) - return show_map_json(reply, len, mpp, vecs); - } - --int -+static int - cli_list_maps_json (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -330,7 +330,7 @@ cli_list_maps_json (void * v, char ** reply, int * len, void * data) - return show_maps_json(reply, len, vecs); - } - --int -+static int - cli_list_wildcards (void * v, char ** reply, int * len, void * data) - { - STRBUF_ON_STACK(buf); -@@ -343,7 +343,7 @@ cli_list_wildcards (void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - show_status (char ** r, int *len, struct vectors * vecs) - { - STRBUF_ON_STACK(reply); -@@ -356,7 +356,7 @@ show_status (char ** r, int *len, struct vectors * vecs) - return 0; - } - --int -+static int - show_daemon (char ** r, int *len) - { - STRBUF_ON_STACK(reply); -@@ -370,7 +370,7 @@ show_daemon (char ** r, int *len) - return 0; - } - --int -+static int - show_map (char ** r, int *len, struct multipath * mpp, char * style, - int pretty) - { -@@ -384,7 +384,7 @@ show_map (char ** r, int *len, struct multipath * mpp, char * style, - return 0; - } - --int -+static int - show_maps (char ** r, int *len, struct vectors * vecs, char * style, - int pretty) - { -@@ -419,7 +419,7 @@ show_maps (char ** r, int *len, struct vectors * vecs, char * style, - return 0; - } - --int -+static int - cli_list_maps_fmt (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -430,7 +430,7 @@ cli_list_maps_fmt (void * v, char ** reply, int * len, void * data) - return show_maps(reply, len, vecs, fmt, 1); - } - --int -+static int - cli_list_maps_raw (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -441,7 +441,7 @@ cli_list_maps_raw (void * v, char ** reply, int * len, void * data) - return show_maps(reply, len, vecs, fmt, 0); - } - --int -+static int - cli_list_map_fmt (void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; -@@ -461,27 +461,7 @@ cli_list_map_fmt (void * v, char ** reply, int * len, void * data) - return show_map(reply, len, mpp, fmt, 1); - } - --int --cli_list_map_raw (void * v, char ** reply, int * len, void * data) --{ -- struct multipath * mpp; -- struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -- char * fmt = get_keyparam(v, FMT); -- -- param = convert_dev(param, 0); -- get_path_layout(vecs->pathvec, 0); -- get_multipath_layout(vecs->mpvec, 1); -- mpp = find_mp_by_str(vecs->mpvec, param); -- if (!mpp) -- return 1; -- -- condlog(3, "list map %s fmt %s (operator)", param, fmt); -- -- return show_map(reply, len, mpp, fmt, 0); --} -- --int -+static int - cli_list_maps (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -491,7 +471,7 @@ cli_list_maps (void * v, char ** reply, int * len, void * data) - return show_maps(reply, len, vecs, PRINT_MAP_NAMES, 1); - } - --int -+static int - cli_list_status (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -501,7 +481,7 @@ cli_list_status (void * v, char ** reply, int * len, void * data) - return show_status(reply, len, vecs); - } - --int -+static int - cli_list_maps_status (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -511,7 +491,7 @@ cli_list_maps_status (void * v, char ** reply, int * len, void * data) - return show_maps(reply, len, vecs, PRINT_MAP_STATUS, 1); - } - --int -+static int - cli_list_maps_stats (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -521,7 +501,7 @@ cli_list_maps_stats (void * v, char ** reply, int * len, void * data) - return show_maps(reply, len, vecs, PRINT_MAP_STATS, 1); - } - --int -+static int - cli_list_daemon (void * v, char ** reply, int * len, void * data) - { - condlog(3, "list daemon (operator)"); -@@ -529,7 +509,7 @@ cli_list_daemon (void * v, char ** reply, int * len, void * data) - return show_daemon(reply, len); - } - --int -+static int - cli_reset_maps_stats (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -544,7 +524,7 @@ cli_reset_maps_stats (void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_reset_map_stats (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -562,7 +542,7 @@ cli_reset_map_stats (void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_add_path (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -678,7 +658,7 @@ blacklisted: - return 0; - } - --int -+static int - cli_del_path (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -701,7 +681,7 @@ cli_del_path (void * v, char ** reply, int * len, void * data) - return (ret == REMOVE_PATH_FAILURE); - } - --int -+static int - cli_add_map (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -761,7 +741,7 @@ cli_add_map (void * v, char ** reply, int * len, void * data) - return rc; - } - --int -+static int - cli_del_map (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -787,7 +767,7 @@ cli_del_map (void * v, char ** reply, int * len, void * data) - return rc; - } - --int -+static int - cli_del_maps (void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -806,7 +786,7 @@ cli_del_maps (void *v, char **reply, int *len, void *data) - return ret; - } - --int -+static int - cli_reload(void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -834,7 +814,7 @@ cli_reload(void *v, char **reply, int *len, void *data) - return reload_and_sync_map(mpp, vecs, 0); - } - --int resize_map(struct multipath *mpp, unsigned long long size, -+static int resize_map(struct multipath *mpp, unsigned long long size, - struct vectors * vecs) - { - char *params __attribute__((cleanup(cleanup_charp))) = NULL; -@@ -859,7 +839,7 @@ int resize_map(struct multipath *mpp, unsigned long long size, - return 0; - } - --int -+static int - cli_resize(void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -941,7 +921,7 @@ cli_resize(void *v, char **reply, int *len, void *data) - return 0; - } - --int -+static int - cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data) - { - struct config *conf; -@@ -954,7 +934,7 @@ cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data) - { - struct config *conf; -@@ -967,7 +947,7 @@ cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_restore_queueing(void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -1008,7 +988,7 @@ cli_restore_queueing(void *v, char **reply, int *len, void *data) - return 0; - } - --int -+static int - cli_restore_all_queueing(void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -1030,7 +1010,7 @@ cli_restore_all_queueing(void *v, char **reply, int *len, void *data) - return 0; - } - --int -+static int - cli_disable_queueing(void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -1059,7 +1039,7 @@ cli_disable_queueing(void *v, char **reply, int *len, void *data) - return 0; - } - --int -+static int - cli_disable_all_queueing(void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -1078,7 +1058,7 @@ cli_disable_all_queueing(void *v, char **reply, int *len, void *data) - return 0; - } - --int -+static int - cli_switch_group(void * v, char ** reply, int * len, void * data) - { - char * mapname = get_keyparam(v, MAP); -@@ -1090,7 +1070,7 @@ cli_switch_group(void * v, char ** reply, int * len, void * data) - return dm_switchgroup(mapname, groupnum); - } - --int -+static int - cli_reconfigure(void * v, char ** reply, int * len, void * data) - { - int rc; -@@ -1107,7 +1087,7 @@ cli_reconfigure(void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_suspend(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -1137,7 +1117,7 @@ cli_suspend(void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_resume(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -1169,7 +1149,7 @@ cli_resume(void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_reinstate(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -1192,7 +1172,7 @@ cli_reinstate(void * v, char ** reply, int * len, void * data) - return dm_reinstate_path(pp->mpp->alias, pp->dev_t); - } - --int -+static int - cli_reassign (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -1216,7 +1196,7 @@ cli_reassign (void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_fail(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -1245,7 +1225,7 @@ cli_fail(void * v, char ** reply, int * len, void * data) - return r; - } - --int -+static int - show_blacklist (char ** r, int * len) - { - STRBUF_ON_STACK(reply); -@@ -1265,7 +1245,7 @@ show_blacklist (char ** r, int * len) - return 0; - } - --int -+static int - cli_list_blacklist (void * v, char ** reply, int * len, void * data) - { - condlog(3, "list blacklist (operator)"); -@@ -1273,7 +1253,7 @@ cli_list_blacklist (void * v, char ** reply, int * len, void * data) - return show_blacklist(reply, len); - } - --int -+static int - show_devices (char ** r, int * len, struct vectors *vecs) - { - STRBUF_ON_STACK(reply); -@@ -1294,7 +1274,7 @@ show_devices (char ** r, int * len, struct vectors *vecs) - return 0; - } - --int -+static int - cli_list_devices (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -@@ -1304,13 +1284,13 @@ cli_list_devices (void * v, char ** reply, int * len, void * data) - return show_devices(reply, len, vecs); - } - --int -+static int - cli_quit (void * v, char ** reply, int * len, void * data) - { - return 0; - } - --int -+static int - cli_shutdown (void * v, char ** reply, int * len, void * data) - { - condlog(3, "shutdown (operator)"); -@@ -1318,7 +1298,7 @@ cli_shutdown (void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_getprstatus (void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; -@@ -1343,7 +1323,7 @@ cli_getprstatus (void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_setprstatus(void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; -@@ -1366,7 +1346,7 @@ cli_setprstatus(void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_unsetprstatus(void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; -@@ -1388,7 +1368,7 @@ cli_unsetprstatus(void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_getprkey(void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; -@@ -1420,7 +1400,7 @@ cli_getprkey(void * v, char ** reply, int * len, void * data) - return 0; - } - --int -+static int - cli_unsetprkey(void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; -@@ -1444,7 +1424,7 @@ cli_unsetprkey(void * v, char ** reply, int * len, void * data) - return ret; - } - --int -+static int - cli_setprkey(void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; -@@ -1476,7 +1456,7 @@ cli_setprkey(void * v, char ** reply, int * len, void * data) - return ret; - } - --int cli_set_marginal(void * v, char ** reply, int * len, void * data) -+static int cli_set_marginal(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, PATH); -@@ -1503,7 +1483,7 @@ int cli_set_marginal(void * v, char ** reply, int * len, void * data) - return reload_and_sync_map(pp->mpp, vecs, 0); - } - --int cli_unset_marginal(void * v, char ** reply, int * len, void * data) -+static int cli_unset_marginal(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; - char * param = get_keyparam(v, PATH); -@@ -1530,7 +1510,7 @@ int cli_unset_marginal(void * v, char ** reply, int * len, void * data) - return reload_and_sync_map(pp->mpp, vecs, 0); - } - --int cli_unset_all_marginal(void * v, char ** reply, int * len, void * data) -+static int cli_unset_all_marginal(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; - char * mapname = get_keyparam(v, MAP); -@@ -1566,3 +1546,63 @@ int cli_unset_all_marginal(void * v, char ** reply, int * len, void * data) - - return reload_and_sync_map(mpp, vecs, 0); - } -+ -+void init_handler_callbacks(void) -+{ -+ set_handler_callback(LIST+PATHS, cli_list_paths); -+ set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt); -+ set_handler_callback(LIST+PATHS+RAW+FMT, cli_list_paths_raw); -+ set_handler_callback(LIST+PATH, cli_list_path); -+ set_handler_callback(LIST+MAPS, cli_list_maps); -+ set_handler_callback(LIST+STATUS, cli_list_status); -+ set_unlocked_handler_callback(LIST+DAEMON, cli_list_daemon); -+ set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status); -+ set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats); -+ set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt); -+ set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw); -+ set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology); -+ set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology); -+ set_handler_callback(LIST+MAPS+JSON, cli_list_maps_json); -+ set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology); -+ set_handler_callback(LIST+MAP+FMT, cli_list_map_fmt); -+ set_handler_callback(LIST+MAP+RAW+FMT, cli_list_map_fmt); -+ set_handler_callback(LIST+MAP+JSON, cli_list_map_json); -+ set_handler_callback(LIST+CONFIG+LOCAL, cli_list_config_local); -+ set_handler_callback(LIST+CONFIG, cli_list_config); -+ set_handler_callback(LIST+BLACKLIST, cli_list_blacklist); -+ set_handler_callback(LIST+DEVICES, cli_list_devices); -+ set_handler_callback(LIST+WILDCARDS, cli_list_wildcards); -+ set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats); -+ set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats); -+ set_handler_callback(ADD+PATH, cli_add_path); -+ set_handler_callback(DEL+PATH, cli_del_path); -+ set_handler_callback(ADD+MAP, cli_add_map); -+ set_handler_callback(DEL+MAP, cli_del_map); -+ set_handler_callback(DEL+MAPS, cli_del_maps); -+ set_handler_callback(SWITCH+MAP+GROUP, cli_switch_group); -+ set_unlocked_handler_callback(RECONFIGURE, cli_reconfigure); -+ set_handler_callback(SUSPEND+MAP, cli_suspend); -+ set_handler_callback(RESUME+MAP, cli_resume); -+ set_handler_callback(RESIZE+MAP, cli_resize); -+ set_handler_callback(RELOAD+MAP, cli_reload); -+ set_handler_callback(RESET+MAP, cli_reassign); -+ set_handler_callback(REINSTATE+PATH, cli_reinstate); -+ set_handler_callback(FAIL+PATH, cli_fail); -+ set_handler_callback(DISABLEQ+MAP, cli_disable_queueing); -+ set_handler_callback(RESTOREQ+MAP, cli_restore_queueing); -+ set_handler_callback(DISABLEQ+MAPS, cli_disable_all_queueing); -+ set_handler_callback(RESTOREQ+MAPS, cli_restore_all_queueing); -+ set_unlocked_handler_callback(QUIT, cli_quit); -+ set_unlocked_handler_callback(SHUTDOWN, cli_shutdown); -+ set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus); -+ set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus); -+ set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus); -+ set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q); -+ set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q); -+ set_handler_callback(GETPRKEY+MAP, cli_getprkey); -+ set_handler_callback(SETPRKEY+MAP+KEY, cli_setprkey); -+ set_handler_callback(UNSETPRKEY+MAP, cli_unsetprkey); -+ set_handler_callback(SETMARGINAL+PATH, cli_set_marginal); -+ set_handler_callback(UNSETMARGINAL+PATH, cli_unset_marginal); -+ set_handler_callback(UNSETMARGINAL+MAP, cli_unset_all_marginal); -+} -diff --git a/multipathd/cli_handlers.h b/multipathd/cli_handlers.h -index 6f57b42..7eaf847 100644 ---- a/multipathd/cli_handlers.h -+++ b/multipathd/cli_handlers.h -@@ -1,55 +1,6 @@ --int cli_list_paths (void * v, char ** reply, int * len, void * data); --int cli_list_paths_fmt (void * v, char ** reply, int * len, void * data); --int cli_list_paths_raw (void * v, char ** reply, int * len, void * data); --int cli_list_path (void * v, char ** reply, int * len, void * data); --int cli_list_status (void * v, char ** reply, int * len, void * data); --int cli_list_daemon (void * v, char ** reply, int * len, void * data); --int cli_list_maps (void * v, char ** reply, int * len, void * data); --int cli_list_maps_fmt (void * v, char ** reply, int * len, void * data); --int cli_list_maps_raw (void * v, char ** reply, int * len, void * data); --int cli_list_map_fmt (void * v, char ** reply, int * len, void * data); --int cli_list_map_raw (void * v, char ** reply, int * len, void * data); --int cli_list_maps_status (void * v, char ** reply, int * len, void * data); --int cli_list_maps_stats (void * v, char ** reply, int * len, void * data); --int cli_list_map_topology (void * v, char ** reply, int * len, void * data); --int cli_list_maps_topology (void * v, char ** reply, int * len, void * data); --int cli_list_map_json (void * v, char ** reply, int * len, void * data); --int cli_list_maps_json (void * v, char ** reply, int * len, void * data); --int cli_list_config (void * v, char ** reply, int * len, void * data); --int cli_list_config_local (void * v, char ** reply, int * len, void * data); --int cli_list_blacklist (void * v, char ** reply, int * len, void * data); --int cli_list_devices (void * v, char ** reply, int * len, void * data); --int cli_list_wildcards (void * v, char ** reply, int * len, void * data); --int cli_reset_maps_stats (void * v, char ** reply, int * len, void * data); --int cli_reset_map_stats (void * v, char ** reply, int * len, void * data); --int cli_add_path (void * v, char ** reply, int * len, void * data); --int cli_del_path (void * v, char ** reply, int * len, void * data); --int cli_add_map (void * v, char ** reply, int * len, void * data); --int cli_del_map (void * v, char ** reply, int * len, void * data); --int cli_del_maps (void * v, char ** reply, int * len, void * data); --int cli_switch_group(void * v, char ** reply, int * len, void * data); --int cli_reconfigure(void * v, char ** reply, int * len, void * data); --int cli_resize(void * v, char ** reply, int * len, void * data); --int cli_reload(void * v, char ** reply, int * len, void * data); --int cli_disable_queueing(void * v, char ** reply, int * len, void * data); --int cli_disable_all_queueing(void * v, char ** reply, int * len, void * data); --int cli_restore_queueing(void * v, char ** reply, int * len, void * data); --int cli_restore_all_queueing(void * v, char ** reply, int * len, void * data); --int cli_suspend(void * v, char ** reply, int * len, void * data); --int cli_resume(void * v, char ** reply, int * len, void * data); --int cli_reinstate(void * v, char ** reply, int * len, void * data); --int cli_fail(void * v, char ** reply, int * len, void * data); --int cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data); --int cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data); --int cli_quit(void * v, char ** reply, int * len, void * data); --int cli_shutdown(void * v, char ** reply, int * len, void * data); --int cli_reassign (void * v, char ** reply, int * len, void * data); --int cli_getprstatus(void * v, char ** reply, int * len, void * data); --int cli_setprstatus(void * v, char ** reply, int * len, void * data); --int cli_unsetprstatus(void * v, char ** reply, int * len, void * data); --int cli_getprkey(void * v, char ** reply, int * len, void * data); --int cli_setprkey(void * v, char ** reply, int * len, void * data); --int cli_unsetprkey(void * v, char ** reply, int * len, void * data); --int cli_set_marginal(void * v, char ** reply, int * len, void * data); --int cli_unset_marginal(void * v, char ** reply, int * len, void * data); --int cli_unset_all_marginal(void * v, char ** reply, int * len, void * data); -+#ifndef _CLI_HANDLERS_H -+#define _CLI_HANDLERS_H -+ -+void init_handler_callbacks(void); -+ -+#endif -diff --git a/multipathd/main.c b/multipathd/main.c -index 118dadd..08fb992 100644 ---- a/multipathd/main.c -+++ b/multipathd/main.c -@@ -1669,63 +1669,7 @@ uxlsnrloop (void * ap) - /* Tell main thread that thread has started */ - post_config_state(DAEMON_CONFIGURE); - -- set_handler_callback(LIST+PATHS, cli_list_paths); -- set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt); -- set_handler_callback(LIST+PATHS+RAW+FMT, cli_list_paths_raw); -- set_handler_callback(LIST+PATH, cli_list_path); -- set_handler_callback(LIST+MAPS, cli_list_maps); -- set_handler_callback(LIST+STATUS, cli_list_status); -- set_unlocked_handler_callback(LIST+DAEMON, cli_list_daemon); -- set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status); -- set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats); -- set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt); -- set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw); -- set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology); -- set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology); -- set_handler_callback(LIST+MAPS+JSON, cli_list_maps_json); -- set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology); -- set_handler_callback(LIST+MAP+FMT, cli_list_map_fmt); -- set_handler_callback(LIST+MAP+RAW+FMT, cli_list_map_fmt); -- set_handler_callback(LIST+MAP+JSON, cli_list_map_json); -- set_handler_callback(LIST+CONFIG+LOCAL, cli_list_config_local); -- set_handler_callback(LIST+CONFIG, cli_list_config); -- set_handler_callback(LIST+BLACKLIST, cli_list_blacklist); -- set_handler_callback(LIST+DEVICES, cli_list_devices); -- set_handler_callback(LIST+WILDCARDS, cli_list_wildcards); -- set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats); -- set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats); -- set_handler_callback(ADD+PATH, cli_add_path); -- set_handler_callback(DEL+PATH, cli_del_path); -- set_handler_callback(ADD+MAP, cli_add_map); -- set_handler_callback(DEL+MAP, cli_del_map); -- set_handler_callback(DEL+MAPS, cli_del_maps); -- set_handler_callback(SWITCH+MAP+GROUP, cli_switch_group); -- set_unlocked_handler_callback(RECONFIGURE, cli_reconfigure); -- set_handler_callback(SUSPEND+MAP, cli_suspend); -- set_handler_callback(RESUME+MAP, cli_resume); -- set_handler_callback(RESIZE+MAP, cli_resize); -- set_handler_callback(RELOAD+MAP, cli_reload); -- set_handler_callback(RESET+MAP, cli_reassign); -- set_handler_callback(REINSTATE+PATH, cli_reinstate); -- set_handler_callback(FAIL+PATH, cli_fail); -- set_handler_callback(DISABLEQ+MAP, cli_disable_queueing); -- set_handler_callback(RESTOREQ+MAP, cli_restore_queueing); -- set_handler_callback(DISABLEQ+MAPS, cli_disable_all_queueing); -- set_handler_callback(RESTOREQ+MAPS, cli_restore_all_queueing); -- set_unlocked_handler_callback(QUIT, cli_quit); -- set_unlocked_handler_callback(SHUTDOWN, cli_shutdown); -- set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus); -- set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus); -- set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus); -- set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q); -- set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q); -- set_handler_callback(GETPRKEY+MAP, cli_getprkey); -- set_handler_callback(SETPRKEY+MAP+KEY, cli_setprkey); -- set_handler_callback(UNSETPRKEY+MAP, cli_unsetprkey); -- set_handler_callback(SETMARGINAL+PATH, cli_set_marginal); -- set_handler_callback(UNSETMARGINAL+PATH, cli_unset_marginal); -- set_handler_callback(UNSETMARGINAL+MAP, cli_unset_all_marginal); -- -+ init_handler_callbacks(); - umask(077); - uxsock_listen(&uxsock_trigger, ux_sock, ap); - --- -2.33.0 - diff --git a/0021-multipathd-Fix-command-completion-in-interactive-mod.patch b/0021-multipathd-Fix-command-completion-in-interactive-mod.patch deleted file mode 100644 index fe5356c..0000000 --- a/0021-multipathd-Fix-command-completion-in-interactive-mod.patch +++ /dev/null @@ -1,192 +0,0 @@ -From 88b55127e70ab18974a00b7285e2b9ee36846dc8 Mon Sep 17 00:00:00 2001 -From: Martin Wilck -Date: Wed, 24 Aug 2022 22:39:44 +0200 -Subject: [PATCH] multipathd: Fix command completion in interactive mode - -The command completion never worked, because the handlers -array wasn't initialized in client mode. - -The handlers array is now also required in multipathc, -but it doesn't need the actual handler functions. To keep -multipathc as small as possible, we just add a handler table -with NULL handler functions. - -Signed-off-by: Martin Wilck -Reviewed-by: Benjamin Marzinski ---- - multipathd/callbacks.c | 59 +++++++++++++++++++++++++++++++++++++ - multipathd/cli.c | 2 ++ - multipathd/cli_handlers.c | 61 ++------------------------------------- - multipathd/main.c | 1 - - 4 files changed, 63 insertions(+), 60 deletions(-) - create mode 100644 multipathd/callbacks.c - -diff --git a/multipathd/callbacks.c b/multipathd/callbacks.c -new file mode 100644 -index 0000000..11edc5c ---- /dev/null -+++ b/multipathd/callbacks.c -@@ -0,0 +1,59 @@ -+void init_handler_callbacks(void) -+{ -+ set_handler_callback(LIST+PATHS, HANDLER(cli_list_paths)); -+ set_handler_callback(LIST+PATHS+FMT, HANDLER(cli_list_paths_fmt)); -+ set_handler_callback(LIST+PATHS+RAW+FMT, HANDLER(cli_list_paths_raw)); -+ set_handler_callback(LIST+PATH, HANDLER(cli_list_path)); -+ set_handler_callback(LIST+MAPS, HANDLER(cli_list_maps)); -+ set_handler_callback(LIST+STATUS, HANDLER(cli_list_status)); -+ set_unlocked_handler_callback(LIST+DAEMON, HANDLER(cli_list_daemon)); -+ set_handler_callback(LIST+MAPS+STATUS, HANDLER(cli_list_maps_status)); -+ set_handler_callback(LIST+MAPS+STATS, HANDLER(cli_list_maps_stats)); -+ set_handler_callback(LIST+MAPS+FMT, HANDLER(cli_list_maps_fmt)); -+ set_handler_callback(LIST+MAPS+RAW+FMT, HANDLER(cli_list_maps_raw)); -+ set_handler_callback(LIST+MAPS+TOPOLOGY, HANDLER(cli_list_maps_topology)); -+ set_handler_callback(LIST+TOPOLOGY, HANDLER(cli_list_maps_topology)); -+ set_handler_callback(LIST+MAPS+JSON, HANDLER(cli_list_maps_json)); -+ set_handler_callback(LIST+MAP+TOPOLOGY, HANDLER(cli_list_map_topology)); -+ set_handler_callback(LIST+MAP+FMT, HANDLER(cli_list_map_fmt)); -+ set_handler_callback(LIST+MAP+RAW+FMT, HANDLER(cli_list_map_fmt)); -+ set_handler_callback(LIST+MAP+JSON, HANDLER(cli_list_map_json)); -+ set_handler_callback(LIST+CONFIG+LOCAL, HANDLER(cli_list_config_local)); -+ set_handler_callback(LIST+CONFIG, HANDLER(cli_list_config)); -+ set_handler_callback(LIST+BLACKLIST, HANDLER(cli_list_blacklist)); -+ set_handler_callback(LIST+DEVICES, HANDLER(cli_list_devices)); -+ set_handler_callback(LIST+WILDCARDS, HANDLER(cli_list_wildcards)); -+ set_handler_callback(RESET+MAPS+STATS, HANDLER(cli_reset_maps_stats)); -+ set_handler_callback(RESET+MAP+STATS, HANDLER(cli_reset_map_stats)); -+ set_handler_callback(ADD+PATH, HANDLER(cli_add_path)); -+ set_handler_callback(DEL+PATH, HANDLER(cli_del_path)); -+ set_handler_callback(ADD+MAP, HANDLER(cli_add_map)); -+ set_handler_callback(DEL+MAP, HANDLER(cli_del_map)); -+ set_handler_callback(DEL+MAPS, HANDLER(cli_del_maps)); -+ set_handler_callback(SWITCH+MAP+GROUP, HANDLER(cli_switch_group)); -+ set_unlocked_handler_callback(RECONFIGURE, HANDLER(cli_reconfigure)); -+ set_handler_callback(SUSPEND+MAP, HANDLER(cli_suspend)); -+ set_handler_callback(RESUME+MAP, HANDLER(cli_resume)); -+ set_handler_callback(RESIZE+MAP, HANDLER(cli_resize)); -+ set_handler_callback(RELOAD+MAP, HANDLER(cli_reload)); -+ set_handler_callback(RESET+MAP, HANDLER(cli_reassign)); -+ set_handler_callback(REINSTATE+PATH, HANDLER(cli_reinstate)); -+ set_handler_callback(FAIL+PATH, HANDLER(cli_fail)); -+ set_handler_callback(DISABLEQ+MAP, HANDLER(cli_disable_queueing)); -+ set_handler_callback(RESTOREQ+MAP, HANDLER(cli_restore_queueing)); -+ set_handler_callback(DISABLEQ+MAPS, HANDLER(cli_disable_all_queueing)); -+ set_handler_callback(RESTOREQ+MAPS, HANDLER(cli_restore_all_queueing)); -+ set_unlocked_handler_callback(QUIT, HANDLER(cli_quit)); -+ set_unlocked_handler_callback(SHUTDOWN, HANDLER(cli_shutdown)); -+ set_handler_callback(GETPRSTATUS+MAP, HANDLER(cli_getprstatus)); -+ set_handler_callback(SETPRSTATUS+MAP, HANDLER(cli_setprstatus)); -+ set_handler_callback(UNSETPRSTATUS+MAP, HANDLER(cli_unsetprstatus)); -+ set_handler_callback(FORCEQ+DAEMON, HANDLER(cli_force_no_daemon_q)); -+ set_handler_callback(RESTOREQ+DAEMON, HANDLER(cli_restore_no_daemon_q)); -+ set_handler_callback(GETPRKEY+MAP, HANDLER(cli_getprkey)); -+ set_handler_callback(SETPRKEY+MAP+KEY, HANDLER(cli_setprkey)); -+ set_handler_callback(UNSETPRKEY+MAP, HANDLER(cli_unsetprkey)); -+ set_handler_callback(SETMARGINAL+PATH, HANDLER(cli_set_marginal)); -+ set_handler_callback(UNSETMARGINAL+PATH, HANDLER(cli_unset_marginal)); -+ set_handler_callback(UNSETMARGINAL+MAP, HANDLER(cli_unset_all_marginal)); -+} -diff --git a/multipathd/cli.c b/multipathd/cli.c -index 1facf89..8033db0 100644 ---- a/multipathd/cli.c -+++ b/multipathd/cli.c -@@ -16,6 +16,7 @@ - - #include "mpath_cmd.h" - #include "cli.h" -+#include "cli_handlers.h" - #include "debug.h" - #include "strbuf.h" - -@@ -506,6 +507,7 @@ cli_init (void) { - if (alloc_handlers()) - return 1; - -+ init_handler_callbacks(); - return 0; - } - -diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c -index f75e176..7d4f267 100644 ---- a/multipathd/cli_handlers.c -+++ b/multipathd/cli_handlers.c -@@ -1547,62 +1547,5 @@ static int cli_unset_all_marginal(void * v, char ** reply, int * len, void * dat - return reload_and_sync_map(mpp, vecs, 0); - } - --void init_handler_callbacks(void) --{ -- set_handler_callback(LIST+PATHS, cli_list_paths); -- set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt); -- set_handler_callback(LIST+PATHS+RAW+FMT, cli_list_paths_raw); -- set_handler_callback(LIST+PATH, cli_list_path); -- set_handler_callback(LIST+MAPS, cli_list_maps); -- set_handler_callback(LIST+STATUS, cli_list_status); -- set_unlocked_handler_callback(LIST+DAEMON, cli_list_daemon); -- set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status); -- set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats); -- set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt); -- set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw); -- set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology); -- set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology); -- set_handler_callback(LIST+MAPS+JSON, cli_list_maps_json); -- set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology); -- set_handler_callback(LIST+MAP+FMT, cli_list_map_fmt); -- set_handler_callback(LIST+MAP+RAW+FMT, cli_list_map_fmt); -- set_handler_callback(LIST+MAP+JSON, cli_list_map_json); -- set_handler_callback(LIST+CONFIG+LOCAL, cli_list_config_local); -- set_handler_callback(LIST+CONFIG, cli_list_config); -- set_handler_callback(LIST+BLACKLIST, cli_list_blacklist); -- set_handler_callback(LIST+DEVICES, cli_list_devices); -- set_handler_callback(LIST+WILDCARDS, cli_list_wildcards); -- set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats); -- set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats); -- set_handler_callback(ADD+PATH, cli_add_path); -- set_handler_callback(DEL+PATH, cli_del_path); -- set_handler_callback(ADD+MAP, cli_add_map); -- set_handler_callback(DEL+MAP, cli_del_map); -- set_handler_callback(DEL+MAPS, cli_del_maps); -- set_handler_callback(SWITCH+MAP+GROUP, cli_switch_group); -- set_unlocked_handler_callback(RECONFIGURE, cli_reconfigure); -- set_handler_callback(SUSPEND+MAP, cli_suspend); -- set_handler_callback(RESUME+MAP, cli_resume); -- set_handler_callback(RESIZE+MAP, cli_resize); -- set_handler_callback(RELOAD+MAP, cli_reload); -- set_handler_callback(RESET+MAP, cli_reassign); -- set_handler_callback(REINSTATE+PATH, cli_reinstate); -- set_handler_callback(FAIL+PATH, cli_fail); -- set_handler_callback(DISABLEQ+MAP, cli_disable_queueing); -- set_handler_callback(RESTOREQ+MAP, cli_restore_queueing); -- set_handler_callback(DISABLEQ+MAPS, cli_disable_all_queueing); -- set_handler_callback(RESTOREQ+MAPS, cli_restore_all_queueing); -- set_unlocked_handler_callback(QUIT, cli_quit); -- set_unlocked_handler_callback(SHUTDOWN, cli_shutdown); -- set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus); -- set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus); -- set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus); -- set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q); -- set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q); -- set_handler_callback(GETPRKEY+MAP, cli_getprkey); -- set_handler_callback(SETPRKEY+MAP+KEY, cli_setprkey); -- set_handler_callback(UNSETPRKEY+MAP, cli_unsetprkey); -- set_handler_callback(SETMARGINAL+PATH, cli_set_marginal); -- set_handler_callback(UNSETMARGINAL+PATH, cli_unset_marginal); -- set_handler_callback(UNSETMARGINAL+MAP, cli_unset_all_marginal); --} -+#define HANDLER(x) x -+#include "callbacks.c" -diff --git a/multipathd/main.c b/multipathd/main.c -index 08fb992..be7ae60 100644 ---- a/multipathd/main.c -+++ b/multipathd/main.c -@@ -1669,7 +1669,6 @@ uxlsnrloop (void * ap) - /* Tell main thread that thread has started */ - post_config_state(DAEMON_CONFIGURE); - -- init_handler_callbacks(); - umask(077); - uxsock_listen(&uxsock_trigger, ux_sock, ap); - --- -2.33.0 - diff --git a/0022-multipathd-more-robust-command-parsing.patch b/0022-multipathd-more-robust-command-parsing.patch deleted file mode 100644 index cf9c9e8..0000000 --- a/0022-multipathd-more-robust-command-parsing.patch +++ /dev/null @@ -1,939 +0,0 @@ -From 1e59870eead6af91c6499a4d4ca8ca554a73d6b1 Mon Sep 17 00:00:00 2001 -From: Martin Wilck -Date: Wed, 24 Aug 2022 19:05:08 +0200 -Subject: [PATCH] multipathd: more robust command parsing - -The current parser allows commands like "path sda show" or "list list -add path sda", because it doesn't enforce ordering of the keywords -and simply adds rather than or-s the values of the keys. - -Rework this by using a separate byte for the "verb" and the allowed -qualifiers in the different positions of the command. No command -needs more than 3 qualifiers, so we disallow command vectors with -more than 4 elements, and change the type of the fingerprint to -uint32_t. - -init_callbacks() is now required in both multipathc and multipathd -to initialize the table of handlers and fingerprints. But as m -ultipathc never calls any handler, we need not link the -entire handlers code into it. - -Signed-off-by: Martin Wilck -Reviewed-by: Benjamin Marzinski ---- - multipathd/callbacks.c | 123 +++++++++++++------------ - multipathd/cli.c | 168 ++++++++++++++++++---------------- - multipathd/cli.h | 184 +++++++++++++++++++------------------- - multipathd/cli_handlers.c | 70 +++++++-------- - 4 files changed, 287 insertions(+), 258 deletions(-) - -diff --git a/multipathd/callbacks.c b/multipathd/callbacks.c -index 11edc5c..e9cbb7f 100644 ---- a/multipathd/callbacks.c -+++ b/multipathd/callbacks.c -@@ -1,59 +1,70 @@ - void init_handler_callbacks(void) - { -- set_handler_callback(LIST+PATHS, HANDLER(cli_list_paths)); -- set_handler_callback(LIST+PATHS+FMT, HANDLER(cli_list_paths_fmt)); -- set_handler_callback(LIST+PATHS+RAW+FMT, HANDLER(cli_list_paths_raw)); -- set_handler_callback(LIST+PATH, HANDLER(cli_list_path)); -- set_handler_callback(LIST+MAPS, HANDLER(cli_list_maps)); -- set_handler_callback(LIST+STATUS, HANDLER(cli_list_status)); -- set_unlocked_handler_callback(LIST+DAEMON, HANDLER(cli_list_daemon)); -- set_handler_callback(LIST+MAPS+STATUS, HANDLER(cli_list_maps_status)); -- set_handler_callback(LIST+MAPS+STATS, HANDLER(cli_list_maps_stats)); -- set_handler_callback(LIST+MAPS+FMT, HANDLER(cli_list_maps_fmt)); -- set_handler_callback(LIST+MAPS+RAW+FMT, HANDLER(cli_list_maps_raw)); -- set_handler_callback(LIST+MAPS+TOPOLOGY, HANDLER(cli_list_maps_topology)); -- set_handler_callback(LIST+TOPOLOGY, HANDLER(cli_list_maps_topology)); -- set_handler_callback(LIST+MAPS+JSON, HANDLER(cli_list_maps_json)); -- set_handler_callback(LIST+MAP+TOPOLOGY, HANDLER(cli_list_map_topology)); -- set_handler_callback(LIST+MAP+FMT, HANDLER(cli_list_map_fmt)); -- set_handler_callback(LIST+MAP+RAW+FMT, HANDLER(cli_list_map_fmt)); -- set_handler_callback(LIST+MAP+JSON, HANDLER(cli_list_map_json)); -- set_handler_callback(LIST+CONFIG+LOCAL, HANDLER(cli_list_config_local)); -- set_handler_callback(LIST+CONFIG, HANDLER(cli_list_config)); -- set_handler_callback(LIST+BLACKLIST, HANDLER(cli_list_blacklist)); -- set_handler_callback(LIST+DEVICES, HANDLER(cli_list_devices)); -- set_handler_callback(LIST+WILDCARDS, HANDLER(cli_list_wildcards)); -- set_handler_callback(RESET+MAPS+STATS, HANDLER(cli_reset_maps_stats)); -- set_handler_callback(RESET+MAP+STATS, HANDLER(cli_reset_map_stats)); -- set_handler_callback(ADD+PATH, HANDLER(cli_add_path)); -- set_handler_callback(DEL+PATH, HANDLER(cli_del_path)); -- set_handler_callback(ADD+MAP, HANDLER(cli_add_map)); -- set_handler_callback(DEL+MAP, HANDLER(cli_del_map)); -- set_handler_callback(DEL+MAPS, HANDLER(cli_del_maps)); -- set_handler_callback(SWITCH+MAP+GROUP, HANDLER(cli_switch_group)); -- set_unlocked_handler_callback(RECONFIGURE, HANDLER(cli_reconfigure)); -- set_handler_callback(SUSPEND+MAP, HANDLER(cli_suspend)); -- set_handler_callback(RESUME+MAP, HANDLER(cli_resume)); -- set_handler_callback(RESIZE+MAP, HANDLER(cli_resize)); -- set_handler_callback(RELOAD+MAP, HANDLER(cli_reload)); -- set_handler_callback(RESET+MAP, HANDLER(cli_reassign)); -- set_handler_callback(REINSTATE+PATH, HANDLER(cli_reinstate)); -- set_handler_callback(FAIL+PATH, HANDLER(cli_fail)); -- set_handler_callback(DISABLEQ+MAP, HANDLER(cli_disable_queueing)); -- set_handler_callback(RESTOREQ+MAP, HANDLER(cli_restore_queueing)); -- set_handler_callback(DISABLEQ+MAPS, HANDLER(cli_disable_all_queueing)); -- set_handler_callback(RESTOREQ+MAPS, HANDLER(cli_restore_all_queueing)); -- set_unlocked_handler_callback(QUIT, HANDLER(cli_quit)); -- set_unlocked_handler_callback(SHUTDOWN, HANDLER(cli_shutdown)); -- set_handler_callback(GETPRSTATUS+MAP, HANDLER(cli_getprstatus)); -- set_handler_callback(SETPRSTATUS+MAP, HANDLER(cli_setprstatus)); -- set_handler_callback(UNSETPRSTATUS+MAP, HANDLER(cli_unsetprstatus)); -- set_handler_callback(FORCEQ+DAEMON, HANDLER(cli_force_no_daemon_q)); -- set_handler_callback(RESTOREQ+DAEMON, HANDLER(cli_restore_no_daemon_q)); -- set_handler_callback(GETPRKEY+MAP, HANDLER(cli_getprkey)); -- set_handler_callback(SETPRKEY+MAP+KEY, HANDLER(cli_setprkey)); -- set_handler_callback(UNSETPRKEY+MAP, HANDLER(cli_unsetprkey)); -- set_handler_callback(SETMARGINAL+PATH, HANDLER(cli_set_marginal)); -- set_handler_callback(UNSETMARGINAL+PATH, HANDLER(cli_unset_marginal)); -- set_handler_callback(UNSETMARGINAL+MAP, HANDLER(cli_unset_all_marginal)); -+ set_handler_callback(VRB_LIST | Q1_PATHS, HANDLER(cli_list_paths)); -+ set_handler_callback(VRB_LIST | Q1_PATHS | Q2_FMT, HANDLER(cli_list_paths_fmt)); -+ set_handler_callback(VRB_LIST | Q1_PATHS | Q2_RAW | Q3_FMT, -+ HANDLER(cli_list_paths_raw)); -+ set_handler_callback(VRB_LIST | Q1_PATH, HANDLER(cli_list_path)); -+ set_handler_callback(VRB_LIST | Q1_MAPS, HANDLER(cli_list_maps)); -+ set_handler_callback(VRB_LIST | Q1_STATUS, HANDLER(cli_list_status)); -+ set_unlocked_handler_callback(VRB_LIST | Q1_DAEMON, HANDLER(cli_list_daemon)); -+ set_handler_callback(VRB_LIST | Q1_MAPS | Q2_STATUS, -+ HANDLER(cli_list_maps_status)); -+ set_handler_callback(VRB_LIST | Q1_MAPS | Q2_STATS, -+ HANDLER(cli_list_maps_stats)); -+ set_handler_callback(VRB_LIST | Q1_MAPS | Q2_FMT, HANDLER(cli_list_maps_fmt)); -+ set_handler_callback(VRB_LIST | Q1_MAPS | Q2_RAW | Q3_FMT, -+ HANDLER(cli_list_maps_raw)); -+ set_handler_callback(VRB_LIST | Q1_MAPS | Q2_TOPOLOGY, -+ HANDLER(cli_list_maps_topology)); -+ set_handler_callback(VRB_LIST | Q1_TOPOLOGY, HANDLER(cli_list_maps_topology)); -+ set_handler_callback(VRB_LIST | Q1_MAPS | Q2_JSON, HANDLER(cli_list_maps_json)); -+ set_handler_callback(VRB_LIST | Q1_MAP | Q2_TOPOLOGY, -+ HANDLER(cli_list_map_topology)); -+ set_handler_callback(VRB_LIST | Q1_MAP | Q2_FMT, HANDLER(cli_list_map_fmt)); -+ set_handler_callback(VRB_LIST | Q1_MAP | Q2_RAW | Q3_FMT, -+ HANDLER(cli_list_map_fmt)); -+ set_handler_callback(VRB_LIST | Q1_MAP | Q2_JSON, HANDLER(cli_list_map_json)); -+ set_handler_callback(VRB_LIST | Q1_CONFIG | Q2_LOCAL, -+ HANDLER(cli_list_config_local)); -+ set_handler_callback(VRB_LIST | Q1_CONFIG, HANDLER(cli_list_config)); -+ set_handler_callback(VRB_LIST | Q1_BLACKLIST, HANDLER(cli_list_blacklist)); -+ set_handler_callback(VRB_LIST | Q1_DEVICES, HANDLER(cli_list_devices)); -+ set_handler_callback(VRB_LIST | Q1_WILDCARDS, HANDLER(cli_list_wildcards)); -+ set_handler_callback(VRB_RESET | Q1_MAPS | Q2_STATS, -+ HANDLER(cli_reset_maps_stats)); -+ set_handler_callback(VRB_RESET | Q1_MAP | Q2_STATS, -+ HANDLER(cli_reset_map_stats)); -+ set_handler_callback(VRB_ADD | Q1_PATH, HANDLER(cli_add_path)); -+ set_handler_callback(VRB_DEL | Q1_PATH, HANDLER(cli_del_path)); -+ set_handler_callback(VRB_ADD | Q1_MAP, HANDLER(cli_add_map)); -+ set_handler_callback(VRB_DEL | Q1_MAP, HANDLER(cli_del_map)); -+ set_handler_callback(VRB_DEL | Q1_MAPS, HANDLER(cli_del_maps)); -+ set_handler_callback(VRB_SWITCH | Q1_MAP | Q2_GROUP, HANDLER(cli_switch_group)); -+ set_unlocked_handler_callback(VRB_RECONFIGURE, HANDLER(cli_reconfigure)); -+ set_handler_callback(VRB_SUSPEND | Q1_MAP, HANDLER(cli_suspend)); -+ set_handler_callback(VRB_RESUME | Q1_MAP, HANDLER(cli_resume)); -+ set_handler_callback(VRB_RESIZE | Q1_MAP, HANDLER(cli_resize)); -+ set_handler_callback(VRB_RELOAD | Q1_MAP, HANDLER(cli_reload)); -+ set_handler_callback(VRB_RESET | Q1_MAP, HANDLER(cli_reassign)); -+ set_handler_callback(VRB_REINSTATE | Q1_PATH, HANDLER(cli_reinstate)); -+ set_handler_callback(VRB_FAIL | Q1_PATH, HANDLER(cli_fail)); -+ set_handler_callback(VRB_DISABLEQ | Q1_MAP, HANDLER(cli_disable_queueing)); -+ set_handler_callback(VRB_RESTOREQ | Q1_MAP, HANDLER(cli_restore_queueing)); -+ set_handler_callback(VRB_DISABLEQ | Q1_MAPS, HANDLER(cli_disable_all_queueing)); -+ set_handler_callback(VRB_RESTOREQ | Q1_MAPS, HANDLER(cli_restore_all_queueing)); -+ set_unlocked_handler_callback(VRB_QUIT, HANDLER(cli_quit)); -+ set_unlocked_handler_callback(VRB_SHUTDOWN, HANDLER(cli_shutdown)); -+ set_handler_callback(VRB_GETPRSTATUS | Q1_MAP, HANDLER(cli_getprstatus)); -+ set_handler_callback(VRB_SETPRSTATUS | Q1_MAP, HANDLER(cli_setprstatus)); -+ set_handler_callback(VRB_UNSETPRSTATUS | Q1_MAP, HANDLER(cli_unsetprstatus)); -+ set_handler_callback(VRB_FORCEQ | Q1_DAEMON, HANDLER(cli_force_no_daemon_q)); -+ set_handler_callback(VRB_RESTOREQ | Q1_DAEMON, HANDLER(cli_restore_no_daemon_q)); -+ set_handler_callback(VRB_GETPRKEY | Q1_MAP, HANDLER(cli_getprkey)); -+ set_handler_callback(VRB_SETPRKEY | Q1_MAP | Q2_KEY, HANDLER(cli_setprkey)); -+ set_handler_callback(VRB_UNSETPRKEY | Q1_MAP, HANDLER(cli_unsetprkey)); -+ set_handler_callback(VRB_SETMARGINAL | Q1_PATH, HANDLER(cli_set_marginal)); -+ set_handler_callback(VRB_UNSETMARGINAL | Q1_PATH, HANDLER(cli_unset_marginal)); -+ set_handler_callback(VRB_UNSETMARGINAL | Q1_MAP, -+ HANDLER(cli_unset_all_marginal)); - } -diff --git a/multipathd/cli.c b/multipathd/cli.c -index 8033db0..5d1a482 100644 ---- a/multipathd/cli.c -+++ b/multipathd/cli.c -@@ -23,6 +23,9 @@ - static vector keys; - static vector handlers; - -+/* See KEY_INVALID in cli.h */ -+#define INVALID_FINGERPRINT ((uint32_t)(0)) -+ - static struct key * - alloc_key (void) - { -@@ -36,7 +39,7 @@ alloc_handler (void) - } - - static int --add_key (vector vec, char * str, uint64_t code, int has_param) -+add_key (vector vec, char * str, uint8_t code, int has_param) - { - struct key * kw; - -@@ -67,7 +70,7 @@ out: - } - - --static struct handler *add_handler (uint64_t fp, int (*fn)(void *, char **, int *, void *), bool locked) -+static struct handler *add_handler (uint32_t fp, int (*fn)(void *, char **, int *, void *), bool locked) - { - struct handler * h; - -@@ -90,11 +93,13 @@ static struct handler *add_handler (uint64_t fp, int (*fn)(void *, char **, int - } - - static struct handler * --find_handler (uint64_t fp) -+find_handler (uint32_t fp) - { - int i; - struct handler *h; - -+ if (fp == INVALID_FINGERPRINT) -+ return NULL; - vector_foreach_slot (handlers, h, i) - if (h->fingerprint == fp) - return h; -@@ -103,14 +108,15 @@ find_handler (uint64_t fp) - } - - int --__set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *), bool locked) -+__set_handler_callback (uint32_t fp, int (*fn)(void *, char **, int *, void *), bool locked) - { - struct handler *h; - -+ assert(fp != INVALID_FINGERPRINT); - assert(find_handler(fp) == NULL); - h = add_handler(fp, fn, locked); - if (!h) { -- condlog(0, "%s: failed to set handler for code %"PRIu64, -+ condlog(0, "%s: failed to set handler for code %"PRIu32, - __func__, fp); - return 1; - } -@@ -163,57 +169,57 @@ load_keys (void) - if (!keys) - return 1; - -- r += add_key(keys, "list", LIST, 0); -- r += add_key(keys, "show", LIST, 0); -- r += add_key(keys, "add", ADD, 0); -- r += add_key(keys, "remove", DEL, 0); -- r += add_key(keys, "del", DEL, 0); -- r += add_key(keys, "switch", SWITCH, 0); -- r += add_key(keys, "switchgroup", SWITCH, 0); -- r += add_key(keys, "suspend", SUSPEND, 0); -- r += add_key(keys, "resume", RESUME, 0); -- r += add_key(keys, "reinstate", REINSTATE, 0); -- r += add_key(keys, "fail", FAIL, 0); -- r += add_key(keys, "resize", RESIZE, 0); -- r += add_key(keys, "reset", RESET, 0); -- r += add_key(keys, "reload", RELOAD, 0); -- r += add_key(keys, "forcequeueing", FORCEQ, 0); -- r += add_key(keys, "disablequeueing", DISABLEQ, 0); -- r += add_key(keys, "restorequeueing", RESTOREQ, 0); -- r += add_key(keys, "paths", PATHS, 0); -- r += add_key(keys, "maps", MAPS, 0); -- r += add_key(keys, "multipaths", MAPS, 0); -- r += add_key(keys, "path", PATH, 1); -- r += add_key(keys, "map", MAP, 1); -- r += add_key(keys, "multipath", MAP, 1); -- r += add_key(keys, "group", GROUP, 1); -- r += add_key(keys, "reconfigure", RECONFIGURE, 0); -- r += add_key(keys, "daemon", DAEMON, 0); -- r += add_key(keys, "status", STATUS, 0); -- r += add_key(keys, "stats", STATS, 0); -- r += add_key(keys, "topology", TOPOLOGY, 0); -- r += add_key(keys, "config", CONFIG, 0); -- r += add_key(keys, "blacklist", BLACKLIST, 0); -- r += add_key(keys, "devices", DEVICES, 0); -- r += add_key(keys, "raw", RAW, 0); -- r += add_key(keys, "wildcards", WILDCARDS, 0); -- r += add_key(keys, "quit", QUIT, 0); -- r += add_key(keys, "exit", QUIT, 0); -- r += add_key(keys, "shutdown", SHUTDOWN, 0); -- r += add_key(keys, "getprstatus", GETPRSTATUS, 0); -- r += add_key(keys, "setprstatus", SETPRSTATUS, 0); -- r += add_key(keys, "unsetprstatus", UNSETPRSTATUS, 0); -- r += add_key(keys, "format", FMT, 1); -- r += add_key(keys, "json", JSON, 0); -- r += add_key(keys, "getprkey", GETPRKEY, 0); -- r += add_key(keys, "setprkey", SETPRKEY, 0); -- r += add_key(keys, "unsetprkey", UNSETPRKEY, 0); -- r += add_key(keys, "key", KEY, 1); -- r += add_key(keys, "local", LOCAL, 0); -- r += add_key(keys, "setmarginal", SETMARGINAL, 0); -- r += add_key(keys, "unsetmarginal", UNSETMARGINAL, 0); -- -- -+ r += add_key(keys, "list", VRB_LIST, 0); -+ r += add_key(keys, "show", VRB_LIST, 0); -+ r += add_key(keys, "add", VRB_ADD, 0); -+ r += add_key(keys, "remove", VRB_DEL, 0); -+ r += add_key(keys, "del", VRB_DEL, 0); -+ r += add_key(keys, "switch", VRB_SWITCH, 0); -+ r += add_key(keys, "switchgroup", VRB_SWITCH, 0); -+ r += add_key(keys, "suspend", VRB_SUSPEND, 0); -+ r += add_key(keys, "resume", VRB_RESUME, 0); -+ r += add_key(keys, "reinstate", VRB_REINSTATE, 0); -+ r += add_key(keys, "fail", VRB_FAIL, 0); -+ r += add_key(keys, "resize", VRB_RESIZE, 0); -+ r += add_key(keys, "reset", VRB_RESET, 0); -+ r += add_key(keys, "reload", VRB_RELOAD, 0); -+ r += add_key(keys, "forcequeueing", VRB_FORCEQ, 0); -+ r += add_key(keys, "disablequeueing", VRB_DISABLEQ, 0); -+ r += add_key(keys, "restorequeueing", VRB_RESTOREQ, 0); -+ r += add_key(keys, "paths", KEY_PATHS, 0); -+ r += add_key(keys, "maps", KEY_MAPS, 0); -+ r += add_key(keys, "multipaths", KEY_MAPS, 0); -+ r += add_key(keys, "path", KEY_PATH, 1); -+ r += add_key(keys, "map", KEY_MAP, 1); -+ r += add_key(keys, "multipath", KEY_MAP, 1); -+ r += add_key(keys, "group", KEY_GROUP, 1); -+ r += add_key(keys, "reconfigure", VRB_RECONFIGURE, 0); -+ r += add_key(keys, "daemon", KEY_DAEMON, 0); -+ r += add_key(keys, "status", KEY_STATUS, 0); -+ r += add_key(keys, "stats", KEY_STATS, 0); -+ r += add_key(keys, "topology", KEY_TOPOLOGY, 0); -+ r += add_key(keys, "config", KEY_CONFIG, 0); -+ r += add_key(keys, "blacklist", KEY_BLACKLIST, 0); -+ r += add_key(keys, "devices", KEY_DEVICES, 0); -+ r += add_key(keys, "raw", KEY_RAW, 0); -+ r += add_key(keys, "wildcards", KEY_WILDCARDS, 0); -+ r += add_key(keys, "quit", VRB_QUIT, 0); -+ r += add_key(keys, "exit", VRB_QUIT, 0); -+ r += add_key(keys, "shutdown", VRB_SHUTDOWN, 0); -+ r += add_key(keys, "getprstatus", VRB_GETPRSTATUS, 0); -+ r += add_key(keys, "setprstatus", VRB_SETPRSTATUS, 0); -+ r += add_key(keys, "unsetprstatus", VRB_UNSETPRSTATUS, 0); -+ r += add_key(keys, "format", KEY_FMT, 1); -+ r += add_key(keys, "json", KEY_JSON, 0); -+ r += add_key(keys, "getprkey", VRB_GETPRKEY, 0); -+ r += add_key(keys, "setprkey", VRB_SETPRKEY, 0); -+ r += add_key(keys, "unsetprkey", VRB_UNSETPRKEY, 0); -+ r += add_key(keys, "key", KEY_KEY, 1); -+ r += add_key(keys, "local", KEY_LOCAL, 0); -+ r += add_key(keys, "setmarginal", VRB_SETMARGINAL, 0); -+ r += add_key(keys, "unsetmarginal", VRB_UNSETMARGINAL, 0); -+ r += add_key(keys, "all", KEY_ALL, 0); -+ - if (r) { - free_keys(keys); - keys = NULL; -@@ -321,19 +327,22 @@ out: - return r; - } - --static uint64_t -+static uint32_t - fingerprint(vector vec) - { - int i; -- uint64_t fp = 0; -+ uint32_t fp = 0; - struct key * kw; - -- if (!vec) -- return 0; -- -- vector_foreach_slot(vec, kw, i) -- fp += kw->code; -+ if (!vec || VECTOR_SIZE(vec) > 4) -+ return INVALID_FINGERPRINT; - -+ vector_foreach_slot(vec, kw, i) { -+ if (i >= 4) -+ break; -+ fp |= (uint32_t)kw->code << (8 * i); -+ } -+ - return fp; - } - -@@ -367,8 +376,8 @@ genhelp_sprint_aliases (struct strbuf *reply, vector keys, - - static int - do_genhelp(struct strbuf *reply, const char *cmd, int error) { -- int i, j; -- uint64_t fp; -+ int i, j, k; -+ uint32_t fp; - struct handler * h; - struct key * kw; - int rc = 0; -@@ -394,17 +403,24 @@ do_genhelp(struct strbuf *reply, const char *cmd, int error) { - - vector_foreach_slot (handlers, h, i) { - fp = h->fingerprint; -- vector_foreach_slot (keys, kw, j) { -- if ((kw->code & fp)) { -- fp -= kw->code; -- if (print_strbuf(reply, " %s", kw->str) < 0 || -- genhelp_sprint_aliases(reply, keys, kw) < 0) -- return -1; -- -- if (kw->has_param) { -- if (print_strbuf(reply, " $%s", -- kw->str) < 0) -+ for (k = 0; k < 4; k++, fp >>= 8) { -+ uint32_t code = fp & 0xff; -+ -+ if (!code) -+ break; -+ -+ vector_foreach_slot (keys, kw, j) { -+ if ((uint32_t)kw->code == code) { -+ if (print_strbuf(reply, " %s", kw->str) < 0 || -+ genhelp_sprint_aliases(reply, keys, kw) < 0) - return -1; -+ -+ if (kw->has_param) { -+ if (print_strbuf(reply, " $%s", -+ kw->str) < 0) -+ return -1; -+ } -+ break; - } - } - } -@@ -487,7 +503,7 @@ parse_cmd (char * cmd, char ** reply, int * len, void * data, int timeout ) - } - - char * --get_keyparam (vector v, uint64_t code) -+get_keyparam (vector v, uint8_t code) - { - struct key * kw; - int i; -diff --git a/multipathd/cli.h b/multipathd/cli.h -index 6459203..a13e190 100644 ---- a/multipathd/cli.h -+++ b/multipathd/cli.h -@@ -3,96 +3,98 @@ - - #include - -+/* -+ * CLI commands consist of 4 bytes, a verb (byte 0) and up to -+ * 3 qualifiers (byte 1 - 3). -+ */ -+ - enum { -- __LIST, -- __ADD, -- __DEL, -- __SWITCH, -- __SUSPEND, -- __RESUME, -- __REINSTATE, -- __FAIL, -- __RESIZE, -- __RESET, -- __RELOAD, -- __FORCEQ, -- __DISABLEQ, -- __RESTOREQ, -- __PATHS, -- __MAPS, -- __PATH, -- __MAP, -- __GROUP, -- __RECONFIGURE, -- __DAEMON, -- __STATUS, -- __STATS, -- __TOPOLOGY, -- __CONFIG, -- __BLACKLIST, -- __DEVICES, -- __RAW, -- __WILDCARDS, -- __QUIT, -- __SHUTDOWN, -- __GETPRSTATUS, -- __SETPRSTATUS, -- __UNSETPRSTATUS, -- __FMT, -- __JSON, -- __GETPRKEY, -- __SETPRKEY, -- __UNSETPRKEY, -- __KEY, -- __LOCAL, -- __SETMARGINAL, -- __UNSETMARGINAL, -+ /* See INVALID_FINGERPRINT in cli.c */ -+ KEY_INVALID = 0, -+ -+ /* Verbs */ -+ VRB_LIST = 1, -+ VRB_ADD = 2, -+ VRB_DEL = 3, -+ VRB_RESET = 4, -+ VRB_SWITCH = 5, -+ VRB_RECONFIGURE = 6, -+ VRB_SUSPEND = 7, -+ VRB_RESUME = 8, -+ VRB_RESIZE = 9, -+ VRB_RELOAD = 10, -+ VRB_FAIL = 11, -+ VRB_REINSTATE = 12, -+ VRB_DISABLEQ = 13, -+ VRB_RESTOREQ = 14, -+ VRB_FORCEQ = 15, -+ VRB_GETPRSTATUS = 16, -+ VRB_SETPRSTATUS = 17, -+ VRB_UNSETPRSTATUS = 18, -+ VRB_GETPRKEY = 19, -+ VRB_SETPRKEY = 20, -+ VRB_UNSETPRKEY = 21, -+ VRB_SETMARGINAL = 22, -+ VRB_UNSETMARGINAL = 23, -+ VRB_SHUTDOWN = 24, -+ VRB_QUIT = 25, -+ -+ /* Qualifiers, values must be different from verbs */ -+ KEY_PATH = 65, -+ KEY_PATHS = 66, -+ KEY_MAP = 67, -+ KEY_MAPS = 68, -+ KEY_TOPOLOGY = 69, -+ KEY_CONFIG = 70, -+ KEY_BLACKLIST = 71, -+ KEY_DEVICES = 72, -+ KEY_WILDCARDS = 73, -+ KEY_ALL = 74, -+ KEY_DAEMON = 75, -+ KEY_FMT = 76, -+ KEY_RAW = 77, -+ KEY_STATUS = 78, -+ KEY_STATS = 79, -+ KEY_JSON = 80, -+ KEY_LOCAL = 81, -+ KEY_GROUP = 82, -+ KEY_KEY = 83, - }; - --#define LIST (1 << __LIST) --#define ADD (1 << __ADD) --#define DEL (1 << __DEL) --#define SWITCH (1 << __SWITCH) --#define SUSPEND (1 << __SUSPEND) --#define RESUME (1 << __RESUME) --#define REINSTATE (1 << __REINSTATE) --#define FAIL (1 << __FAIL) --#define RESIZE (1 << __RESIZE) --#define RESET (1 << __RESET) --#define RELOAD (1 << __RELOAD) --#define FORCEQ (1 << __FORCEQ) --#define DISABLEQ (1 << __DISABLEQ) --#define RESTOREQ (1 << __RESTOREQ) --#define PATHS (1 << __PATHS) --#define MAPS (1 << __MAPS) --#define PATH (1 << __PATH) --#define MAP (1 << __MAP) --#define GROUP (1 << __GROUP) --#define RECONFIGURE (1 << __RECONFIGURE) --#define DAEMON (1 << __DAEMON) --#define STATUS (1 << __STATUS) --#define STATS (1 << __STATS) --#define TOPOLOGY (1 << __TOPOLOGY) --#define CONFIG (1 << __CONFIG) --#define BLACKLIST (1 << __BLACKLIST) --#define DEVICES (1 << __DEVICES) --#define RAW (1 << __RAW) --#define COUNT (1 << __COUNT) --#define WILDCARDS (1 << __WILDCARDS) --#define QUIT (1 << __QUIT) --#define SHUTDOWN (1 << __SHUTDOWN) --#define GETPRSTATUS (1ULL << __GETPRSTATUS) --#define SETPRSTATUS (1ULL << __SETPRSTATUS) --#define UNSETPRSTATUS (1ULL << __UNSETPRSTATUS) --#define FMT (1ULL << __FMT) --#define JSON (1ULL << __JSON) --#define GETPRKEY (1ULL << __GETPRKEY) --#define SETPRKEY (1ULL << __SETPRKEY) --#define UNSETPRKEY (1ULL << __UNSETPRKEY) --#define KEY (1ULL << __KEY) --#define LOCAL (1ULL << __LOCAL) --#define SETMARGINAL (1ULL << __SETMARGINAL) --#define UNSETMARGINAL (1ULL << __UNSETMARGINAL) -+/* -+ * The shifted qualifiers determine valid positions of the -+ * keywords in the known commands. E.g. the only qualifier -+ * that's valid in position 3 is "fmt", e.g. "list maps raw fmt". -+ */ -+enum { -+ /* byte 1: qualifier 1 */ -+ Q1_PATH = KEY_PATH << 8, -+ Q1_PATHS = KEY_PATHS << 8, -+ Q1_MAP = KEY_MAP << 8, -+ Q1_MAPS = KEY_MAPS << 8, -+ Q1_TOPOLOGY = KEY_TOPOLOGY << 8, -+ Q1_CONFIG = KEY_CONFIG << 8, -+ Q1_BLACKLIST = KEY_BLACKLIST << 8, -+ Q1_DEVICES = KEY_DEVICES << 8, -+ Q1_WILDCARDS = KEY_WILDCARDS << 8, -+ Q1_ALL = KEY_ALL << 8, -+ Q1_DAEMON = KEY_DAEMON << 8, -+ Q1_STATUS = KEY_STATUS << 8, -+ -+ /* byte 2: qualifier 2 */ -+ Q2_FMT = KEY_FMT << 16, -+ Q2_RAW = KEY_RAW << 16, -+ Q2_STATUS = KEY_STATUS << 16, -+ Q2_STATS = KEY_STATS << 16, -+ Q2_TOPOLOGY = KEY_TOPOLOGY << 16, -+ Q2_JSON = KEY_JSON << 16, -+ Q2_LOCAL = KEY_LOCAL << 16, -+ Q2_GROUP = KEY_GROUP << 16, -+ Q2_KEY = KEY_KEY << 16, -+ -+ /* byte 3: qualifier 3 */ -+ Q3_FMT = KEY_FMT << 24, -+}; - - #define INITIAL_REPLY_LEN 1200 - -@@ -120,24 +122,24 @@ enum { - struct key { - char * str; - char * param; -- uint64_t code; -+ uint8_t code; - int has_param; - }; - - struct handler { -- uint64_t fingerprint; -+ uint32_t fingerprint; - int locked; - int (*fn)(void *, char **, int *, void *); - }; - - int alloc_handlers (void); --int __set_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *), bool locked); -+int __set_handler_callback (uint32_t fp, int (*fn)(void *, char **, int *, void *), bool locked); - #define set_handler_callback(fp, fn) __set_handler_callback(fp, fn, true) - #define set_unlocked_handler_callback(fp, fn) __set_handler_callback(fp, fn, false) - - int parse_cmd (char * cmd, char ** reply, int * len, void *, int); - int load_keys (void); --char * get_keyparam (vector v, uint64_t code); -+char * get_keyparam (vector v, uint8_t code); - void free_keys (vector vec); - void free_handlers (void); - int cli_init (void); -diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c -index 7d4f267..6d79287 100644 ---- a/multipathd/cli_handlers.c -+++ b/multipathd/cli_handlers.c -@@ -237,7 +237,7 @@ static int - cli_list_paths_fmt (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * fmt = get_keyparam(v, FMT); -+ char * fmt = get_keyparam(v, KEY_FMT); - - condlog(3, "list paths (operator)"); - -@@ -248,7 +248,7 @@ static int - cli_list_paths_raw (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * fmt = get_keyparam(v, FMT); -+ char * fmt = get_keyparam(v, KEY_FMT); - - condlog(3, "list paths (operator)"); - -@@ -259,7 +259,7 @@ static int - cli_list_path (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, PATH); -+ char * param = get_keyparam(v, KEY_PATH); - struct path *pp; - - param = convert_dev(param, 1); -@@ -277,7 +277,7 @@ cli_list_map_topology (void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - - param = convert_dev(param, 0); - get_path_layout(vecs->pathvec, 0); -@@ -306,7 +306,7 @@ cli_list_map_json (void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - - param = convert_dev(param, 0); - get_path_layout(vecs->pathvec, 0); -@@ -423,7 +423,7 @@ static int - cli_list_maps_fmt (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * fmt = get_keyparam(v, FMT); -+ char * fmt = get_keyparam(v, KEY_FMT); - - condlog(3, "list maps (operator)"); - -@@ -434,7 +434,7 @@ static int - cli_list_maps_raw (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * fmt = get_keyparam(v, FMT); -+ char * fmt = get_keyparam(v, KEY_FMT); - - condlog(3, "list maps (operator)"); - -@@ -446,8 +446,8 @@ cli_list_map_fmt (void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -- char * fmt = get_keyparam(v, FMT); -+ char * param = get_keyparam(v, KEY_MAP); -+ char * fmt = get_keyparam(v, KEY_FMT); - - param = convert_dev(param, 0); - get_path_layout(vecs->pathvec, 0); -@@ -529,7 +529,7 @@ cli_reset_map_stats (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; - struct multipath * mpp; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - - param = convert_dev(param, 0); - mpp = find_mp_by_str(vecs->mpvec, param); -@@ -546,7 +546,7 @@ static int - cli_add_path (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, PATH); -+ char * param = get_keyparam(v, KEY_PATH); - struct path *pp; - int r; - struct config *conf; -@@ -662,7 +662,7 @@ static int - cli_del_path (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, PATH); -+ char * param = get_keyparam(v, KEY_PATH); - struct path *pp; - int ret; - -@@ -685,7 +685,7 @@ static int - cli_add_map (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - int major = -1, minor = -1; - char dev_path[PATH_SIZE]; - char *refwwid, *alias = NULL; -@@ -745,7 +745,7 @@ static int - cli_del_map (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - int major, minor; - char *alias; - int rc; -@@ -790,7 +790,7 @@ static int - cli_reload(void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -- char * mapname = get_keyparam(v, MAP); -+ char * mapname = get_keyparam(v, KEY_MAP); - struct multipath *mpp; - int minor; - -@@ -843,7 +843,7 @@ static int - cli_resize(void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -- char * mapname = get_keyparam(v, MAP); -+ char * mapname = get_keyparam(v, KEY_MAP); - struct multipath *mpp; - int minor; - unsigned long long size, sz; -@@ -951,7 +951,7 @@ static int - cli_restore_queueing(void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -- char * mapname = get_keyparam(v, MAP); -+ char * mapname = get_keyparam(v, KEY_MAP); - struct multipath *mpp; - int minor; - struct config *conf; -@@ -1014,7 +1014,7 @@ static int - cli_disable_queueing(void *v, char **reply, int *len, void *data) - { - struct vectors * vecs = (struct vectors *)data; -- char * mapname = get_keyparam(v, MAP); -+ char * mapname = get_keyparam(v, KEY_MAP); - struct multipath *mpp; - int minor; - -@@ -1061,8 +1061,8 @@ cli_disable_all_queueing(void *v, char **reply, int *len, void *data) - static int - cli_switch_group(void * v, char ** reply, int * len, void * data) - { -- char * mapname = get_keyparam(v, MAP); -- int groupnum = atoi(get_keyparam(v, GROUP)); -+ char * mapname = get_keyparam(v, KEY_MAP); -+ int groupnum = atoi(get_keyparam(v, KEY_GROUP)); - - mapname = convert_dev(mapname, 0); - condlog(2, "%s: switch to path group #%i (operator)", mapname, groupnum); -@@ -1091,7 +1091,7 @@ static int - cli_suspend(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - int r; - struct multipath * mpp; - -@@ -1121,7 +1121,7 @@ static int - cli_resume(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - int r; - struct multipath * mpp; - uint16_t udev_flags; -@@ -1153,7 +1153,7 @@ static int - cli_reinstate(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, PATH); -+ char * param = get_keyparam(v, KEY_PATH); - struct path * pp; - - param = convert_dev(param, 1); -@@ -1176,7 +1176,7 @@ static int - cli_reassign (void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - struct multipath *mpp; - - param = convert_dev(param, 0); -@@ -1200,7 +1200,7 @@ static int - cli_fail(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, PATH); -+ char * param = get_keyparam(v, KEY_PATH); - struct path * pp; - int r; - -@@ -1303,7 +1303,7 @@ cli_getprstatus (void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - - param = convert_dev(param, 0); - get_path_layout(vecs->pathvec, 0); -@@ -1328,7 +1328,7 @@ cli_setprstatus(void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - - param = convert_dev(param, 0); - get_path_layout(vecs->pathvec, 0); -@@ -1351,7 +1351,7 @@ cli_unsetprstatus(void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, MAP); -+ char * param = get_keyparam(v, KEY_MAP); - - param = convert_dev(param, 0); - get_path_layout(vecs->pathvec, 0); -@@ -1373,7 +1373,7 @@ cli_getprkey(void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; - struct vectors * vecs = (struct vectors *)data; -- char *mapname = get_keyparam(v, MAP); -+ char *mapname = get_keyparam(v, KEY_MAP); - uint64_t key; - - mapname = convert_dev(mapname, 0); -@@ -1405,7 +1405,7 @@ cli_unsetprkey(void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; - struct vectors * vecs = (struct vectors *)data; -- char *mapname = get_keyparam(v, MAP); -+ char *mapname = get_keyparam(v, KEY_MAP); - int ret; - struct config *conf; - -@@ -1429,8 +1429,8 @@ cli_setprkey(void * v, char ** reply, int * len, void * data) - { - struct multipath * mpp; - struct vectors * vecs = (struct vectors *)data; -- char *mapname = get_keyparam(v, MAP); -- char *keyparam = get_keyparam(v, KEY); -+ char *mapname = get_keyparam(v, KEY_MAP); -+ char *keyparam = get_keyparam(v, KEY_KEY); - uint64_t prkey; - uint8_t flags; - int ret; -@@ -1459,7 +1459,7 @@ cli_setprkey(void * v, char ** reply, int * len, void * data) - static int cli_set_marginal(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, PATH); -+ char * param = get_keyparam(v, KEY_PATH); - struct path * pp; - - param = convert_dev(param, 1); -@@ -1486,7 +1486,7 @@ static int cli_set_marginal(void * v, char ** reply, int * len, void * data) - static int cli_unset_marginal(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * param = get_keyparam(v, PATH); -+ char * param = get_keyparam(v, KEY_PATH); - struct path * pp; - - param = convert_dev(param, 1); -@@ -1513,7 +1513,7 @@ static int cli_unset_marginal(void * v, char ** reply, int * len, void * data) - static int cli_unset_all_marginal(void * v, char ** reply, int * len, void * data) - { - struct vectors * vecs = (struct vectors *)data; -- char * mapname = get_keyparam(v, MAP); -+ char * mapname = get_keyparam(v, KEY_MAP); - struct multipath *mpp; - struct pathgroup * pgp; - struct path * pp; --- -2.33.0 - diff --git a/multipath-tools.spec b/multipath-tools.spec index 297595a..d24f1b4 100644 --- a/multipath-tools.spec +++ b/multipath-tools.spec @@ -1,12 +1,12 @@ #needsrootforbuild Name: multipath-tools -Version: 0.8.7 -Release: 9 +Version: 0.9.5 +Release: 1 Summary: Tools to manage multipath devices with the device-mapper License: GPL-2.0-or-later and LGPL-2.0-only URL: http://christophe.varoqui.free.fr/ -# curl https://github.com/opensvc/multipath-tools/archive/0.8.7.tar.gz -o multipath-tools-0.8.7.tgz +# curl https://github.com/opensvc/multipath-tools/archive/0.9.5.tar.gz -o multipath-tools-0.9.5.tgz Source0: https://github.com/opensvc/multipath-tools/archive/%{version}.tar.gz Source1: multipath.conf Patch1: 0001-change-order-of-multipath.rules.patch @@ -24,23 +24,16 @@ Patch12: 0012-device-mapper-multipath-fix-find-multipath-failure.patch Patch13: 0013-kpartx-change-kpartx-file-and-default-bindir.patch Patch14: 0014-remove-local-disk-from-pathvec.patch Patch15: 0015-clear-mpp-path-reference-when-path-is-freed-otherwis.patch -Patch16: 0016-multipath-return-failure-on-an-invalid-remove-cmd.patch -Patch17: 0017-multipath-fix-exit-status-of-multipath-T.patch -Patch18: 0018-multipath-tools-use-run-instead-of-dev-shm.patch -Patch19: 0019-multipathd-add-and-set-cli_handlers-in-a-single-step.patch -Patch20: 0020-multipathd-make-all-cli_handlers-static.patch -Patch21: 0021-multipathd-Fix-command-completion-in-interactive-mod.patch -Patch22: 0022-multipathd-more-robust-command-parsing.patch -Patch23: 0023-multipathd-Fixed-multipathd-parameter-invoking-seque.patch -Patch24: 0024-libmultipath-io_err_stat-don-t-free-aio-memory-befor.patch -Patch25: 0025-libmultipath-io_err_stat-call-io_destroy-inside-free.patch +Patch16: 0016-multipathd-Fixed-multipathd-parameter-invoking-seque.patch +Patch17: 0017-libmultipath-io_err_stat-don-t-free-aio-memory-befor.patch +Patch18: 0018-libmultipath-io_err_stat-call-io_destroy-inside-free.patch BuildRequires: multipath-tools, libcmocka, libcmocka-devel BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89 -BuildRequires: libselinux-devel, libsepol-devel, readline-devel, ncurses-devel, +BuildRequires: libselinux-devel, libsepol-devel, readline-devel, ncurses-devel, libmount-devel BuildRequires: systemd-units, systemd-devel, json-c-devel, perl-interpreter, pkgconfig Requires: userspace-rcu, json-c, device-mapper >= 1.02.96 -Requires: kpartx = %{version}-%{release} +Requires: kpartx = %{version}-%{release}, libmount Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units @@ -91,7 +84,7 @@ Summary: Create device maps from partition tables. Reads partition tables and create device maps over partitions segments detected. %prep -%autosetup -n multipath-tools-0.8.7 -p1 +%autosetup -n multipath-tools-%{version} -p1 cp %{SOURCE1} . %build @@ -103,6 +96,8 @@ make install \ bindir=/usr/sbin \ syslibdir=/usr/%{_lib} \ usrlibdir=/usr/%{_lib} \ + mandir=/usr/share/man \ + plugindir=/usr/%{_lib}/multipath \ libdir=/usr/%{_lib}/multipath \ rcdir=%{_initrddir} \ unitdir=%{_unitdir} \ @@ -133,13 +128,14 @@ fi %files -%doc README.md README.alua multipath.conf +%doc README.md multipath.conf %license LICENSES/GPL-2.0 LICENSES/LGPL-2.0 LICENSES/GPL-3.0 %{_unitdir}/* /usr/sbin/multipath /usr/sbin/multipathd /usr/sbin/mpathconf /usr/sbin/mpathpersist + /usr/sbin/multipathc /usr/%{_lib}/libmultipath.so /usr/%{_lib}/libmultipath.so.* /usr/%{_lib}/libmpathpersist.so.* @@ -147,12 +143,15 @@ fi /usr/%{_lib}/libdmmp.so.* /usr/%{_lib}/libmpathvalid.so /usr/%{_lib}/libmpathvalid.so.* + /usr/%{_lib}/libmpathutil.so + /usr/%{_lib}/libmpathutil.so.* %dir /etc/multipath %dir /usr/%{_lib}/multipath /usr/%{_lib}/multipath/* %config /usr/lib/udev/rules.d/62-multipath.rules %config /usr/lib/udev/rules.d/11-dm-mpath.rules %config /usr/lib/tmpfiles.d/multipath.conf +%config /usr/lib/modules-load.d/multipath.conf %files devel @@ -181,6 +180,12 @@ fi %changelog +* Mon Feb 5 2024 wangzhiqiang - 0.9.5-1 +- upgrade version to 0.9.5: + - add requires libmount and libmount-devel + - add multipath.conf multipathc and libmpathutil.so + - delete README.alua + * Tue Dec 19 2023 wangzhiqiang - 0.8.7-9 - fix coredump in io_err_stat