device-mapper-multipath-0.9.3-1

Update to the head of the upstream staging branch
  * Previous patches 0001-0042 are included in the source tarball
  * Patches 0001-0032 are from the upstream staging branch
Rename redhat patches
  * Previous patches 0043-0053 are now patches 0033-0043
Change back to using readline instead of libedit
  * The code the uses readline has been isolated from the code that
    is licensed gpl v2 only.
Add libmpathutil libraries to spec file
Add multipathc program to spec file
Add multipath.conf systemd tempfile configuration to spec file
Misc spec file cleanups
This commit is contained in:
Benjamin Marzinski 2022-11-16 14:11:59 -06:00
parent ef9089f4e8
commit c5432960d9
90 changed files with 4400 additions and 3968 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ multipath-tools-091027.tar.gz
/multipath-tools-0.8.7.tgz /multipath-tools-0.8.7.tgz
/multipath-tools-0.8.9.tgz /multipath-tools-0.8.9.tgz
/multipath-tools-0.9.0.tgz /multipath-tools-0.9.0.tgz
/multipath-tools-0.9.3.tgz

View File

@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 10 Jun 2022 22:44:11 +0200
Subject: [PATCH] github workflows: switch to fedora 36
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/native.yaml | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/native.yaml b/.github/workflows/native.yaml
index 19c9e297..ddfd4a09 100644
--- a/.github/workflows/native.yaml
+++ b/.github/workflows/native.yaml
@@ -12,12 +12,10 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
- os: [buster, jessie, bullseye, fedora-35]
+ os: [buster, jessie, bullseye, fedora-36]
arch: ['', '-i386']
exclude:
- - os: fedora-34
- arch: '-i386'
- - os: fedora-35
+ - os: fedora-36
arch: '-i386'
container: mwilck/multipath-build-${{ matrix.os }}${{ matrix.arch }}
steps:

View File

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paul Koetsier <github.com@unicast.nl>
Date: Thu, 27 Oct 2022 19:29:28 +0200
Subject: [PATCH] libmultipath: fix 'show paths format' failure
Prevent 'multipathd show paths format "%c"' from failing on orphan paths.
For orphan paths the checker class isn't set, which caused
snprint_path_checker() to fail which in turn caused 'show paths format' to fail
when the format string contained "%c".
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/print.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libmultipath/print.c b/libmultipath/print.c
index d7d522c8..3193dbe0 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -734,8 +734,12 @@ snprint_host_adapter (struct strbuf *buff, const struct path * pp)
static int
snprint_path_checker (struct strbuf *buff, const struct path * pp)
{
- const struct checker * c = &pp->checker;
- return snprint_str(buff, checker_name(c));
+ const char * n = checker_name(&pp->checker);
+
+ if (n)
+ return snprint_str(buff, n);
+ else
+ return snprint_str(buff, "(null)");
}
static int

View File

@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 18:22:59 +0200
Subject: [PATCH] fixup! Makefile.inc: fix man and include paths
Paths would now be wrong with the default (empty) prefix.
Fix it.
Fixes: 2b2885c ("Makefile.inc: fix man and include paths")
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 4d843ce5..32001434 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -89,9 +89,9 @@ modulesloaddir = $(prefix)/$(SYSTEMDPATH)/modules-load.d
multipathdir = $(TOPDIR)/libmultipath
daemondir = $(TOPDIR)/multipathd
mpathutildir = $(TOPDIR)/libmpathutil
-man8dir = $(prefix)/share/man/man8
-man5dir = $(prefix)/share/man/man5
-man3dir = $(prefix)/share/man/man3
+man8dir = $(usr_prefix)/share/man/man8
+man5dir = $(usr_prefix)/share/man/man5
+man3dir = $(usr_prefix)/share/man/man3
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
libdir = $(prefix)/$(LIB)/multipath
@@ -102,7 +102,7 @@ mpathvaliddir = $(TOPDIR)/libmpathvalid
thirdpartydir = $(TOPDIR)/third-party
libdmmpdir = $(TOPDIR)/libdmmp
nvmedir = $(TOPDIR)/libmultipath/nvme
-includedir = $(prefix)/include
+includedir = $(usr_prefix)/include
pkgconfdir = $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
configdir := $(prefix)/etc/multipath/conf.d

View File

@ -1,103 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: chengjike <chengjike.cheng@huawei.com>
Date: Fri, 8 Oct 2021 20:24:49 +0800
Subject: [PATCH] multipath-tools: fix "multipath -ll" bug for Native NVME
Multipath devices
After "Native NVME Multipath" is configured,
the content displayed is incorrect when you run "multipath -ll" command.
Each NVME devices have the same path name. For example:
[root@localhost home]# multipath -ll
eui.710032e8fb22a86c24a52c1000000db8 [nvme]:nvme1n1 NVMe,Huawei-XSG1,1000001
size=10485760 features='n/a' hwhandler='ANA' wp=rw
|-+- policy='n/a' prio=50 status=optimized
| `- 1:4:1 nvme1c4n1 0:0 n/a optimized live
`-+- policy='n/a' prio=50 status=optimized
`- 1:9:1 nvme1c9n1 0:0 n/a optimized live
eui.710032e8fb22a86b24a52c7c00000db7 [nvme]:nvme1n2 NVMe,Huawei-XSG1,1000001
size=10485760 features='n/a' hwhandler='ANA' wp=rw
|-+- policy='n/a' prio=50 status=optimized
| `- 1:4:1 nvme1c4n1 0:0 n/a optimized live
`-+- policy='n/a' prio=50 status=optimized
`- 1:9:1 nvme1c9n1 0:0 n/a optimized live
[root@localhost home]#
The logical paths of "nvme1n1" and "nvme1n2" are both "nvme1c4n1" and "nvme1c9n1".
So when multipath-tools aggregates disks, use "nvme_ns_head->instance" for matching.
such as ,Use "b" in "nvmeanb" string to match "z" in "nvmexcynz"(a,b,x,y,z can be any number),
and if "b" and "z" are the same, they are related.
Signed-off-by: chengjike <chengjike.cheng@huawei.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/foreign/nvme.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/libmultipath/foreign/nvme.c b/libmultipath/foreign/nvme.c
index 52ca56d8..9a05b333 100644
--- a/libmultipath/foreign/nvme.c
+++ b/libmultipath/foreign/nvme.c
@@ -531,14 +531,18 @@ static int _dirent_controller(const struct dirent *di)
/* Find the block device for a given nvme controller */
struct udev_device *get_ctrl_blkdev(const struct context *ctx,
- struct udev_device *ctrl)
+ struct udev_device *ctrl, const char *ctrl_name)
{
+ int ctrl_num, ns_num;
struct udev_list_entry *item;
struct udev_device *blkdev = NULL;
struct udev_enumerate *enm = udev_enumerate_new(ctx->udev);
const char *devtype;
- if (enm == NULL)
+ if (enm == NULL || ctrl_name == NULL)
+ return NULL;
+
+ if (sscanf(ctrl_name, "nvme%dn%d", &ctrl_num, &ns_num) != 2)
return NULL;
pthread_cleanup_push(_udev_enumerate_unref, enm);
@@ -556,6 +560,8 @@ struct udev_device *get_ctrl_blkdev(const struct context *ctx,
item != NULL;
item = udev_list_entry_get_next(item)) {
struct udev_device *tmp;
+ const char *name = NULL ;
+ int m, n, l;
tmp = udev_device_new_from_syspath(ctx->udev,
udev_list_entry_get_name(item));
@@ -563,11 +569,19 @@ struct udev_device *get_ctrl_blkdev(const struct context *ctx,
continue;
devtype = udev_device_get_devtype(tmp);
- if (devtype && !strcmp(devtype, "disk")) {
+ if (devtype == NULL || strcmp(devtype, "disk")) {
+ udev_device_unref(tmp);
+ continue;
+ }
+
+ name = udev_device_get_sysname(tmp);
+ if (name != NULL &&
+ sscanf(name, "nvme%dc%dn%d", &m, &n, &l) == 3 &&
+ l == ns_num) {
blkdev = tmp;
break;
- } else
- udev_device_unref(tmp);
+ }
+ udev_device_unref(tmp);
}
if (blkdev == NULL)
@@ -680,7 +694,7 @@ static void _find_controllers(struct context *ctx, struct nvme_map *map)
}
pthread_cleanup_push(_udev_device_unref, ctrl);
- udev = get_ctrl_blkdev(ctx, ctrl);
+ udev = get_ctrl_blkdev(ctx, ctrl, udev_device_get_sysname(map->udev));
/*
* We give up the reference to the nvme device here and get
* it back from the child below.

View File

@ -0,0 +1,65 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 17:09:52 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: Fix paths for systemd
With prefix=/usr, systemd files were installed under /usr/usr/lib,
which is bogus. Clean this up, and document how to handle systemd's
"rootprefix" options. Remove the previous SYSTEMDPATH option.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 32001434..351358a9 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -53,10 +53,6 @@ ifndef SYSTEMD
endif
endif
-ifndef SYSTEMDPATH
- SYSTEMDPATH=usr/lib
-endif
-
ifndef DEVMAPPER_INCDIR
ifeq ($(shell $(PKGCONFIG) --modversion devmapper >/dev/null 2>&1 && echo 1), 1)
DEVMAPPER_INCDIR = $(shell $(PKGCONFIG) --variable=includedir devmapper)
@@ -78,14 +74,22 @@ ifndef LINUX_HEADERS_INCDIR
LINUX_HEADERS_INCDIR = /usr/include
endif
+# Paths. All these can be overridden on the "make" command line.
prefix =
+# Prefix for binaries
exec_prefix = $(prefix)
+# Prefix for non-essential libraries (libdmmp)
usr_prefix = $(prefix)
+# Where to install systemd-related files. systemd is usually installed under /usr
+# Note: some systemd installations use separate "prefix" and "rootprefix".
+# In this case, override only unitdir to use systemd's "rootprefix" instead of $(systemd_prefix)
+systemd_prefix := /usr
+unitdir := $(systemd_prefix)/lib/systemd/system
+tmpfilesdir := $(systemd_prefix)/lib/tmpfiles.d
+modulesloaddir := $(systemd_prefix)/lib/modules-load.d
+libudevdir := $(systemd_prefix)/lib/udev
+udevrulesdir := $(libudevdir)/rules.d
bindir = $(exec_prefix)/sbin
-libudevdir = $(prefix)/$(SYSTEMDPATH)/udev
-tmpfilesdir = $(prefix)/$(SYSTEMDPATH)/tmpfiles.d
-udevrulesdir = $(libudevdir)/rules.d
-modulesloaddir = $(prefix)/$(SYSTEMDPATH)/modules-load.d
multipathdir = $(TOPDIR)/libmultipath
daemondir = $(TOPDIR)/multipathd
mpathutildir = $(TOPDIR)/libmpathutil
@@ -95,7 +99,6 @@ man3dir = $(usr_prefix)/share/man/man3
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
libdir = $(prefix)/$(LIB)/multipath
-unitdir = $(prefix)/$(SYSTEMDPATH)/systemd/system
mpathpersistdir = $(TOPDIR)/libmpathpersist
mpathcmddir = $(TOPDIR)/libmpathcmd
mpathvaliddir = $(TOPDIR)/libmpathvalid

View File

@ -1,40 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Sun, 10 Jul 2022 01:07:08 +0200
Subject: [PATCH] multipath-tools: update Huawei OceanStor NVMe vendor id
"NVME" in the doc, but "NVMe" is the real output:
(page 61-62): https://drive.google.com/file/d/1c5RK4GXX7ofZBFxTtZ_IN1qHyIjw5eR1
https://marc.info/?l=dm-devel&m=163393151312418
Use both, just in case.
Cc: <chengjike.cheng@huawei.com>
Cc: <sunao.sun@huawei.com>
Cc: <jiangtao62@huawei.com>
Cc: Zhouweigang (Jack) <zhouweigang09@huawei.com>
Cc: Zou Ming <zouming.zouming@huawei.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 513fa679..fc0252ba 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -1116,7 +1116,7 @@ static struct hwentry default_hw[] = {
},
{
/* OceanStor NVMe */
- .vendor = "NVME",
+ .vendor = "NVM[eE]",
.product = "Huawei-XSG1",
.checker_name = DIRECTIO,
.no_path_retry = 12,

View File

@ -0,0 +1,113 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 13:24:34 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: don't take values from
environment
Don't use environment variables to initialize LIB, RUN, SYSTEMD, SYSTEMDPATH,
DEVMAPPER_INCDIR, LIBUDEV_INCDIR, and LINUX_HEADERS_INCDIR. Taking
such variables from the environment is generally discouraged
(see https://www.gnu.org/software/make/manual/html_node/Environment.html).
Overriding variables from the commandline is still possible
(https://www.gnu.org/software/make/manual/html_node/Overriding.html).
So now, when building multipath-tools, rather then running
"RUN=/somedir make", users need to run "make RUN=/somedir".
This simplifies the Makefile without losing important functionality.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 60 ++++++++++++++++++++++------------------------------
1 file changed, 25 insertions(+), 35 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 351358a9..d897ac7a 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -20,59 +20,49 @@ SCSI_DH_MODULES_PRELOAD :=
EXTRAVERSION := $(shell rev=$$(git rev-parse --short=7 HEAD 2>/dev/null); echo $${rev:+-g$$rev})
+# PKGCONFIG must be read from the environment to enable compilation
+# in Debian multiarch setups
PKGCONFIG ?= pkg-config
ifeq ($(TOPDIR),)
TOPDIR = ..
endif
-ifndef LIB
- ifeq ($(shell test -d /lib64 && echo 1),1)
- LIB=lib64
- else
- LIB=lib
- endif
+ifeq ($(shell test -d /lib64 && echo 1),1)
+ LIB=lib64
+else
+ LIB=lib
endif
-ifndef RUN
- ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
- RUN=run
- else
- RUN=var/run
- endif
+ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
+ RUN=run
+else
+ RUN=var/run
endif
-ifndef SYSTEMD
- ifeq ($(shell $(PKGCONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
- SYSTEMD = $(shell $(PKGCONFIG) --modversion libsystemd | awk '{print $$1}')
- 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')
- endif
+ifeq ($(shell $(PKGCONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
+ SYSTEMD = $(shell $(PKGCONFIG) --modversion libsystemd | awk '{print $$1}')
+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')
endif
endif
-ifndef DEVMAPPER_INCDIR
- ifeq ($(shell $(PKGCONFIG) --modversion devmapper >/dev/null 2>&1 && echo 1), 1)
- DEVMAPPER_INCDIR = $(shell $(PKGCONFIG) --variable=includedir devmapper)
- else
- DEVMAPPER_INCDIR = /usr/include
- endif
+ifeq ($(shell $(PKGCONFIG) --modversion devmapper >/dev/null 2>&1 && echo 1), 1)
+ DEVMAPPER_INCDIR = $(shell $(PKGCONFIG) --variable=includedir devmapper)
+else
+ DEVMAPPER_INCDIR = /usr/include
endif
-ifndef LIBUDEV_INCDIR
- ifeq ($(shell $(PKGCONFIG) --modversion libudev >/dev/null 2>&1 && echo 1), 1)
- LIBUDEV_INCDIR = $(shell $(PKGCONFIG) --variable=includedir libudev)
- else
- LIBUDEV_INCDIR = /usr/include
- endif
+ifeq ($(shell $(PKGCONFIG) --modversion libudev >/dev/null 2>&1 && echo 1), 1)
+ LIBUDEV_INCDIR = $(shell $(PKGCONFIG) --variable=includedir libudev)
+else
+ LIBUDEV_INCDIR = /usr/include
endif
# Allow user to override default location.
-ifndef LINUX_HEADERS_INCDIR
- LINUX_HEADERS_INCDIR = /usr/include
-endif
+LINUX_HEADERS_INCDIR = /usr/include
# Paths. All these can be overridden on the "make" command line.
prefix =

View File

@ -1,33 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Sun, 10 Jul 2022 01:07:09 +0200
Subject: [PATCH] multipath-tools: update "Generic NVMe" vendor regex in
hwtable
to accept NVME and NVMe
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index fc0252ba..c88fa09a 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -86,7 +86,7 @@ static struct hwentry default_hw[] = {
*/
{
/* Generic NVMe */
- .vendor = "NVME",
+ .vendor = "NVM[eE]",
.product = ".*",
.uid_attribute = DEFAULT_NVME_UID_ATTRIBUTE,
.checker_name = NONE,

View File

@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 12 Jul 2022 17:02:51 -0500
Subject: [PATCH] libmultipath: fix find_multipaths_timeout for unknown
hardware
pp->hwe is now a vector that will always be allocated for all path
devices. Instead of checking if it is NULL, check if it is empty.
Fixes: f0462f0 ("libmultipath: use vector for for pp->hwe and mp->hwe")
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/propsel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 50d0b5c8..f782f251 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -1293,7 +1293,7 @@ out:
*/
if (pp->find_multipaths_timeout < 0) {
pp->find_multipaths_timeout = -pp->find_multipaths_timeout;
- if (!pp->hwe) {
+ if (VECTOR_SIZE(pp->hwe) == 0) {
pp->find_multipaths_timeout =
DEFAULT_UNKNOWN_FIND_MULTIPATHS_TIMEOUT;
origin = "(default for unknown hardware)";

View File

@ -0,0 +1,63 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 15:25:31 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: get rid of RUN
Just use $(runtimedir). Also, make the code more compact by using
the "if" function instead of a conditional.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 10 ++--------
libmultipath/defaults.h | 2 +-
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index d897ac7a..b4ec647c 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -34,12 +34,6 @@ else
LIB=lib
endif
-ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
- RUN=run
-else
- RUN=var/run
-endif
-
ifeq ($(shell $(PKGCONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
SYSTEMD = $(shell $(PKGCONFIG) --modversion libsystemd | awk '{print $$1}')
else
@@ -99,7 +93,7 @@ includedir = $(usr_prefix)/include
pkgconfdir = $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
configdir := $(prefix)/etc/multipath/conf.d
-runtimedir := /$(RUN)
+runtimedir := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run)
GZIP_PROG = gzip -9 -c
RM = rm -f
@@ -143,7 +137,7 @@ WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implici
-Werror=implicit-function-declaration -Werror=format-security \
$(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS)
CPPFLAGS := $(FORTIFY_OPT) \
- -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" -DRUN_DIR=\"${RUN}\" \
+ -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
-DRUNTIME_DIR=\"$(runtimedir)\" \
-DCONFIG_DIR=\"$(configdir)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index 3d552b33..a5e9ea0c 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -62,7 +62,7 @@
#define DEV_LOSS_TMO_UNSET 0U
#define MAX_DEV_LOSS_TMO UINT_MAX
-#define DEFAULT_PIDFILE "/" RUN_DIR "/multipathd.pid"
+#define DEFAULT_PIDFILE RUNTIME_DIR "/multipathd.pid"
#define DEFAULT_SOCKET "/org/kernel/linux/storage/multipathd"
#define DEFAULT_CONFIGFILE "/etc/multipath.conf"
#define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings"

View File

@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:14:22 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: more compact code for LIB
Use make's "if" function instead of a conditional.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index b4ec647c..c39cec9b 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -28,12 +28,6 @@ ifeq ($(TOPDIR),)
TOPDIR = ..
endif
-ifeq ($(shell test -d /lib64 && echo 1),1)
- LIB=lib64
-else
- LIB=lib
-endif
-
ifeq ($(shell $(PKGCONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
SYSTEMD = $(shell $(PKGCONFIG) --modversion libsystemd | awk '{print $$1}')
else
@@ -80,6 +74,7 @@ mpathutildir = $(TOPDIR)/libmpathutil
man8dir = $(usr_prefix)/share/man/man8
man5dir = $(usr_prefix)/share/man/man5
man3dir = $(usr_prefix)/share/man/man3
+LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
libdir = $(prefix)/$(LIB)/multipath

View File

@ -1,52 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Thu, 14 Jul 2022 21:05:39 +0200
Subject: [PATCH] multipath-tools: update devel repo info in README.md
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index f06f8cea..dcf51f20 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,6 @@
multipath-tools for Linux
=========================
-
https://github.com/opensvc/multipath-tools
This package provides the following binaries to drive the Device Mapper multipathing driver:
@@ -42,14 +41,12 @@ Go to: https://github.com/opensvc/multipath-tools/tags
Select a release-tag and then click on "zip" or "tar.gz".
-Source code
-===========
+Devel code
+==========
To get latest devel code:
- git clone https://github.com/opensvc/multipath-tools.git
-
-Github page: https://github.com/opensvc/multipath-tools
+ git clone -b queue https://github.com/openSUSE/multipath-tools
Building multipath-tools
@@ -149,4 +146,3 @@ The multipath-tools source code is covered by several different licences.
Refer to the individual source files for details.
Source files which do not specify a licence are shipped under LGPL-2.0
(see `LICENSES/LGPL-2.0`).
-

View File

@ -0,0 +1,139 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:17:40 +0200
Subject: [PATCH] multipath-tools: Makefiles: simplify code for include dirs
Use make's if function, and use lower-case latters for make variable
names that represent directories, such as elsewhere.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 16 +++-------------
kpartx/Makefile | 2 +-
libmultipath/Makefile | 14 +++++++-------
libmultipath/prioritizers/Makefile | 2 +-
multipathd/Makefile | 4 ++--
5 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index c39cec9b..38bd1d80 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -37,20 +37,7 @@ else
endif
endif
-ifeq ($(shell $(PKGCONFIG) --modversion devmapper >/dev/null 2>&1 && echo 1), 1)
- DEVMAPPER_INCDIR = $(shell $(PKGCONFIG) --variable=includedir devmapper)
-else
- DEVMAPPER_INCDIR = /usr/include
-endif
-
-ifeq ($(shell $(PKGCONFIG) --modversion libudev >/dev/null 2>&1 && echo 1), 1)
- LIBUDEV_INCDIR = $(shell $(PKGCONFIG) --variable=includedir libudev)
-else
- LIBUDEV_INCDIR = /usr/include
-endif
-
# Allow user to override default location.
-LINUX_HEADERS_INCDIR = /usr/include
# Paths. All these can be overridden on the "make" command line.
prefix =
@@ -89,6 +76,9 @@ pkgconfdir = $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
configdir := $(prefix)/etc/multipath/conf.d
runtimedir := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run)
+devmapper_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir devmapper),/usr/include)
+libudev_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir libudev),/usr/include)
+kernel_incdir := /usr/include
GZIP_PROG = gzip -9 -c
RM = rm -f
diff --git a/kpartx/Makefile b/kpartx/Makefile
index 742d3bcd..bdf2d035 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -9,7 +9,7 @@ LDFLAGS += $(BIN_LDFLAGS)
LIBDEPS += -ldevmapper
-ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_COOKIE
endif
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 3b60a525..f0df27c0 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -22,31 +22,31 @@ ifdef SYSTEMD
endif
endif
-ifneq ($(call check_func,dm_task_no_flush,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_FLUSH
endif
-ifneq ($(call check_func,dm_task_get_errno,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_GET_ERRNO
endif
-ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_COOKIE
endif
-ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(LIBUDEV_INCDIR)/libudev.h),0)
+ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(libudev_incdir)/libudev.h),0)
CPPFLAGS += -DLIBUDEV_API_RECVBUF
endif
-ifneq ($(call check_func,dm_task_deferred_remove,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_deferred_remove,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_DEFERRED
endif
-ifneq ($(call check_func,dm_hold_control_dev,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_hold_control_dev,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_HOLD_CONTROL
endif
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(LINUX_HEADERS_INCDIR)/scsi/fc/fc_els.h),0)
+ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
CPPFLAGS += -DFPIN_EVENT_HANDLER
endif
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index 400f7735..97155f51 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -26,7 +26,7 @@ LIBS = \
libpriopath_latency.so \
libpriosysfs.so
-ifneq ($(call check_file,$(LINUX_HEADERS_INCDIR)/linux/nvme_ioctl.h),0)
+ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0)
LIBS += libprioana.so
CPPFLAGS += -I../nvme
endif
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 3ce9465e..c462d7b1 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -1,10 +1,10 @@
include ../Makefile.inc
-ifneq ($(call check_func,dm_task_get_errno,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_GET_ERRNO
endif
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(LINUX_HEADERS_INCDIR)/scsi/fc/fc_els.h),0)
+ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
CPPFLAGS += -DFPIN_EVENT_HANDLER
FPIN_SUPPORT = 1
endif

View File

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Thu, 14 Jul 2022 21:05:40 +0200
Subject: [PATCH] multipath-tools: delete README.alua
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.alua | 24 ------------------------
1 file changed, 24 deletions(-)
delete mode 100644 README.alua
diff --git a/README.alua b/README.alua
deleted file mode 100644
index 5d2b1c64..00000000
--- a/README.alua
+++ /dev/null
@@ -1,24 +0,0 @@
-This is a rough guide, consult your storage device manufacturer documentation.
-
-ALUA is supported in some devices, but usually it's disabled by default.
-To enable ALUA, the following options should be changed:
-
-- EMC CLARiiON/VNX:
- "Failover Mode" should be changed to "4" or "Active-Active mode(ALUA)-failover mode 4"
-
-- HPE 3PAR, Primera, and Alletra 9000:
- "Host:" should be changed to "Generic-ALUA Persona 2 (UARepLun, SESLun, ALUA)".
-
-- Promise VTrak/Vess:
- "LUN Affinity" and "ALUA" should be changed to "Enable", "Redundancy Type"
- must be "Active-Active".
-
-- LSI/Engenio/NetApp RDAC class, as NetApp SANtricity E/EF Series and OEM arrays:
- "Select operating system:" should be changed to "Linux DM-MP (Kernel 3.10 or later)".
-
-- NetApp ONTAP:
- To check ALUA state: "igroup show -v <igroup_name>", and to enable ALUA:
- "igroup set <igroup_name> alua yes".
-
-- Huawei OceanStor:
- "Host Access Mode" should be changed to "Asymmetric".

View File

@ -0,0 +1,185 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:25:04 +0200
Subject: [PATCH] multipath-tools: Makefiles: use $(mandir)
Simply use $(mandir) rather than 3 different variables.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 4 +---
kpartx/Makefile | 6 +++---
libdmmp/Makefile | 8 ++++----
libmpathpersist/Makefile | 10 +++++-----
mpathpersist/Makefile | 6 +++---
multipath/Makefile | 12 ++++++------
multipathd/Makefile | 10 +++++-----
7 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 38bd1d80..f3c84771 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -58,9 +58,7 @@ bindir = $(exec_prefix)/sbin
multipathdir = $(TOPDIR)/libmultipath
daemondir = $(TOPDIR)/multipathd
mpathutildir = $(TOPDIR)/libmpathutil
-man8dir = $(usr_prefix)/share/man/man8
-man5dir = $(usr_prefix)/share/man/man5
-man3dir = $(usr_prefix)/share/man/man3
+mandir := $(usr_prefix)/share/man
LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
diff --git a/kpartx/Makefile b/kpartx/Makefile
index bdf2d035..464925ad 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -32,12 +32,12 @@ install: $(EXEC) $(EXEC).8
$(INSTALL_PROGRAM) -m 644 dm-parts.rules $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
$(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
$(INSTALL_PROGRAM) -m 644 del-part-nodes.rules $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
uninstall:
$(RM) $(DESTDIR)$(bindir)/$(EXEC)
- $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
+ $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
$(RM) $(DESTDIR)$(libudevdir)/kpartx_id
$(RM) $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
$(RM) $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
diff --git a/libdmmp/Makefile b/libdmmp/Makefile
index e4589250..985b694b 100644
--- a/libdmmp/Makefile
+++ b/libdmmp/Makefile
@@ -45,17 +45,17 @@ install:
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
perl -i -pe 's|__INCLUDEDIR__|$(includedir)|g' \
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
- $(INSTALL_PROGRAM) -d 755 $(DESTDIR)$(man3dir)
- $(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(man3dir) docs/man/*.3
+ $(INSTALL_PROGRAM) -d 755 $(DESTDIR)$(mandir)/man3
+ $(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(mandir)/man3 docs/man/*.3
uninstall:
$(RM) $(DESTDIR)$(usrlibdir)/$(LIBS)
$(RM) $(DESTDIR)$(includedir)/$(HEADERS)
$(RM) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
- @for file in $(DESTDIR)$(man3dir)/dmmp_*; do \
+ @for file in $(DESTDIR)$(mandir)/man3/dmmp_*; do \
$(RM) $$file; \
done
- $(RM) $(DESTDIR)$(man3dir)/libdmmp.h*
+ $(RM) $(DESTDIR)$(mandir)/man3/libdmmp.h*
$(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE)
clean: dep_clean
diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
index 4e1717ef..479524d4 100644
--- a/libmpathpersist/Makefile
+++ b/libmpathpersist/Makefile
@@ -36,17 +36,17 @@ install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(man3dir)
+ $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(mandir)/man3
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_in.3 $(DESTDIR)$(man3dir)
- $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_out.3 $(DESTDIR)$(man3dir)
+ $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_in.3 $(DESTDIR)$(mandir)/man3
+ $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_out.3 $(DESTDIR)$(mandir)/man3
$(INSTALL_PROGRAM) -m 644 mpath_persist.h $(DESTDIR)$(includedir)
uninstall:
$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(man3dir)/mpath_persistent_reserve_in.3
- $(RM) $(DESTDIR)$(man3dir)/mpath_persistent_reserve_out.3
+ $(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_in.3
+ $(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_out.3
$(RM) $(DESTDIR)$(includedir)/mpath_persist.h
$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
diff --git a/mpathpersist/Makefile b/mpathpersist/Makefile
index 2219c86a..d62537b5 100644
--- a/mpathpersist/Makefile
+++ b/mpathpersist/Makefile
@@ -19,8 +19,8 @@ $(EXEC): $(OBJS)
install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
clean: dep_clean
$(RM) core *.o $(EXEC)
@@ -29,7 +29,7 @@ include $(wildcard $(OBJS:.o=.d))
uninstall:
$(RM) $(DESTDIR)$(bindir)/$(EXEC)
- $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
+ $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
dep_clean:
$(RM) $(OBJS:.o=.d)
diff --git a/multipath/Makefile b/multipath/Makefile
index 116348e2..1c4e7a52 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -28,10 +28,10 @@ install:
$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf
$(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 $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(man5dir)
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man5
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(mandir)/man5
ifneq ($(SCSI_DH_MODULES_PRELOAD),)
$(INSTALL_PROGRAM) -m 644 scsi_dh.conf $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
for _x in $(SCSI_DH_MODULES_PRELOAD); do echo "$$_x"; done \
@@ -44,8 +44,8 @@ uninstall:
$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
$(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
- $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
- $(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5
+ $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5
clean: dep_clean
$(RM) core *.o $(EXEC) multipath.rules tmpfiles.conf
diff --git a/multipathd/Makefile b/multipathd/Makefile
index c462d7b1..78aefee0 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -89,14 +89,14 @@ ifdef SYSTEMD
$(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).socket $(DESTDIR)$(unitdir)
endif
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -m 644 $(CLI).8 $(DESTDIR)$(man8dir)
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 $(CLI).8 $(DESTDIR)$(mandir)/man8
uninstall:
$(RM) $(DESTDIR)$(bindir)/$(EXEC) $(DESTDIR)$(bindir)/$(CLI)
- $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
- $(RM) $(DESTDIR)$(man8dir)/$(CLI).8
+ $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(RM) $(DESTDIR)$(mandir)/man8/$(CLI).8
$(RM) $(DESTDIR)$(unitdir)/$(EXEC).service
$(RM) $(DESTDIR)$(unitdir)/$(EXEC).socket

View File

@ -1,53 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Thu, 14 Jul 2022 23:14:31 +0200
Subject: [PATCH] multipath-tools: add ALUA info to README.md
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/README.md b/README.md
index dcf51f20..2322082c 100644
--- a/README.md
+++ b/README.md
@@ -146,3 +146,31 @@ The multipath-tools source code is covered by several different licences.
Refer to the individual source files for details.
Source files which do not specify a licence are shipped under LGPL-2.0
(see `LICENSES/LGPL-2.0`).
+
+
+ALUA
+====
+This is a rough guide, consult your storage device manufacturer documentation.
+
+ALUA is supported in some devices, but usually it's disabled by default.
+To enable ALUA, the following options should be changed:
+
+- EMC CLARiiON/VNX:
+ "Failover Mode" should be changed to "4" or "Active-Active mode(ALUA)-failover mode 4"
+
+- HPE 3PAR, Primera, and Alletra 9000:
+ "Host:" should be changed to "Generic-ALUA Persona 2 (UARepLun, SESLun, ALUA)".
+
+- Promise VTrak/Vess:
+ "LUN Affinity" and "ALUA" should be changed to "Enable", "Redundancy Type"
+ must be "Active-Active".
+
+- LSI/Engenio/NetApp RDAC class, as NetApp SANtricity E/EF Series and OEM arrays:
+ "Select operating system:" should be changed to "Linux DM-MP (Kernel 3.10 or later)".
+
+- NetApp ONTAP:
+ To check ALUA state: "igroup show -v <igroup_name>", and to enable ALUA:
+ "igroup set <igroup_name> alua yes".
+
+- Huawei OceanStor:
+ "Host Access Mode" should be changed to "Asymmetric".

View File

@ -1,95 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 6 Jul 2022 15:57:21 +0200
Subject: [PATCH] libmultipath: alua: remove get_sysfs_pg83()
Since b72e753 ("libmultipath: alua: try to retrieve inquiry data from sysfs"),
we fetch inquiry and VPD data from sysfs anyway. No need to do this twice.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/prioritizers/alua_rtpg.c | 57 ++++++++-------------------
1 file changed, 16 insertions(+), 41 deletions(-)
diff --git a/libmultipath/prioritizers/alua_rtpg.c b/libmultipath/prioritizers/alua_rtpg.c
index 3f9c0e73..4db13c20 100644
--- a/libmultipath/prioritizers/alua_rtpg.c
+++ b/libmultipath/prioritizers/alua_rtpg.c
@@ -228,25 +228,6 @@ get_target_port_group_support(const struct path *pp, unsigned int timeout)
return rc;
}
-static int
-get_sysfs_pg83(const struct path *pp, unsigned char *buff, int buflen)
-{
- struct udev_device *parent = pp->udev;
-
- while (parent) {
- const char *subsys = udev_device_get_subsystem(parent);
- if (subsys && !strncmp(subsys, "scsi", 4))
- break;
- parent = udev_device_get_parent(parent);
- }
-
- if (!parent || sysfs_get_vpd(parent, 0x83, buff, buflen) <= 0) {
- PRINT_DEBUG("failed to read sysfs vpd pg83");
- return -1;
- }
- return 0;
-}
-
int
get_target_port_group(const struct path * pp, unsigned int timeout)
{
@@ -265,32 +246,26 @@ get_target_port_group(const struct path * pp, unsigned int timeout)
}
memset(buf, 0, buflen);
+ rc = do_inquiry(pp, 1, 0x83, buf, buflen, timeout);
+ if (rc < 0)
+ goto out;
- rc = get_sysfs_pg83(pp, buf, buflen);
-
- if (rc < 0) {
+ scsi_buflen = get_unaligned_be16(&buf[2]) + 4;
+ if (scsi_buflen >= USHRT_MAX)
+ scsi_buflen = USHRT_MAX;
+ if (buflen < scsi_buflen) {
+ free(buf);
+ buf = (unsigned char *)malloc(scsi_buflen);
+ if (!buf) {
+ PRINT_DEBUG("malloc failed: could not allocate"
+ "%u bytes", scsi_buflen);
+ return -RTPG_RTPG_FAILED;
+ }
+ buflen = scsi_buflen;
+ memset(buf, 0, buflen);
rc = do_inquiry(pp, 1, 0x83, buf, buflen, timeout);
if (rc < 0)
goto out;
-
- scsi_buflen = get_unaligned_be16(&buf[2]) + 4;
- /* Paranoia */
- if (scsi_buflen >= USHRT_MAX)
- scsi_buflen = USHRT_MAX;
- if (buflen < scsi_buflen) {
- free(buf);
- buf = (unsigned char *)malloc(scsi_buflen);
- if (!buf) {
- PRINT_DEBUG("malloc failed: could not allocate"
- "%u bytes", scsi_buflen);
- return -RTPG_RTPG_FAILED;
- }
- buflen = scsi_buflen;
- memset(buf, 0, buflen);
- rc = do_inquiry(pp, 1, 0x83, buf, buflen, timeout);
- if (rc < 0)
- goto out;
- }
}
vpd83 = (struct vpd83_data *) buf;

View File

@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:34:34 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: simplify expression for
SYSTEMD
Use a shell "or" function here. Note the use of "strip" to remove
the whitespace that are caused by the line break.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index f3c84771..1a08b8fa 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -28,14 +28,8 @@ ifeq ($(TOPDIR),)
TOPDIR = ..
endif
-ifeq ($(shell $(PKGCONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
- SYSTEMD = $(shell $(PKGCONFIG) --modversion libsystemd | awk '{print $$1}')
-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')
- endif
-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')))
# Allow user to override default location.

View File

@ -1,77 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 10:54:02 +0200
Subject: [PATCH] libmultipath: remove sysfs_get_binary()
This function adds no value on top of sysfs_bin_attr_get_value().
Remove it.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/discovery.c | 26 ++------------------------
tests/test-lib.c | 1 -
2 files changed, 2 insertions(+), 25 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 0d8a558c..7e09e4e2 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -263,41 +263,19 @@ declare_sysfs_get_str(vendor);
declare_sysfs_get_str(model);
declare_sysfs_get_str(rev);
-static ssize_t
-sysfs_get_binary (struct udev_device * udev, const char *attrname,
- unsigned char *buff, size_t len)
-{
- ssize_t attr_len;
- const char * devname;
-
- if (!udev) {
- condlog(3, "No udev device given\n");
- return -ENOSYS;
- }
-
- devname = udev_device_get_sysname(udev);
- attr_len = sysfs_bin_attr_get_value(udev, attrname, buff, len);
- if (attr_len < 0) {
- condlog(3, "%s: attribute %s not found in sysfs",
- devname, attrname);
- return attr_len;
- }
- return attr_len;
-}
-
ssize_t sysfs_get_vpd(struct udev_device * udev, unsigned char pg,
unsigned char *buff, size_t len)
{
char attrname[9];
snprintf(attrname, sizeof(attrname), "vpd_pg%02x", pg);
- return sysfs_get_binary(udev, attrname, buff, len);
+ return sysfs_bin_attr_get_value(udev, attrname, buff, len);
}
ssize_t sysfs_get_inquiry(struct udev_device * udev,
unsigned char *buff, size_t len)
{
- return sysfs_get_binary(udev, "inquiry", buff, len);
+ return sysfs_bin_attr_get_value(udev, "inquiry", buff, len);
}
int
diff --git a/tests/test-lib.c b/tests/test-lib.c
index 6dd3ee88..0bc49d53 100644
--- a/tests/test-lib.c
+++ b/tests/test-lib.c
@@ -334,7 +334,6 @@ void mock_pathinfo(int mask, const struct mocked_path *mp)
if (mask & DI_SERIAL) {
will_return(__wrap_udev_device_get_subsystem, "scsi");
will_return(__wrap_udev_device_get_sysname, hbtl);
- will_return(__wrap_udev_device_get_sysname, hbtl);
}
if (mask & DI_WWID) {

View File

@ -0,0 +1,68 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:53:04 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: untangle paths and source
directories
Only the installation paths can be customized. Move the definitions
of $(multipathdir) etc. further down.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 1a08b8fa..6ec8201b 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -31,8 +31,6 @@ 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')))
-# Allow user to override default location.
-
# Paths. All these can be overridden on the "make" command line.
prefix =
# Prefix for binaries
@@ -49,20 +47,11 @@ modulesloaddir := $(systemd_prefix)/lib/modules-load.d
libudevdir := $(systemd_prefix)/lib/udev
udevrulesdir := $(libudevdir)/rules.d
bindir = $(exec_prefix)/sbin
-multipathdir = $(TOPDIR)/libmultipath
-daemondir = $(TOPDIR)/multipathd
-mpathutildir = $(TOPDIR)/libmpathutil
mandir := $(usr_prefix)/share/man
LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
libdir = $(prefix)/$(LIB)/multipath
-mpathpersistdir = $(TOPDIR)/libmpathpersist
-mpathcmddir = $(TOPDIR)/libmpathcmd
-mpathvaliddir = $(TOPDIR)/libmpathvalid
-thirdpartydir = $(TOPDIR)/third-party
-libdmmpdir = $(TOPDIR)/libdmmp
-nvmedir = $(TOPDIR)/libmultipath/nvme
includedir = $(usr_prefix)/include
pkgconfdir = $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
@@ -124,6 +113,18 @@ SHARED_FLAGS = -shared
LDFLAGS := $(LDFLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs
BIN_LDFLAGS = -pie
+# Source code directories. Don't modify.
+
+multipathdir = $(TOPDIR)/libmultipath
+daemondir = $(TOPDIR)/multipathd
+mpathutildir = $(TOPDIR)/libmpathutil
+mpathpersistdir = $(TOPDIR)/libmpathpersist
+mpathcmddir = $(TOPDIR)/libmpathcmd
+mpathvaliddir = $(TOPDIR)/libmpathvalid
+thirdpartydir = $(TOPDIR)/third-party
+libdmmpdir = $(TOPDIR)/libdmmp
+nvmedir = $(TOPDIR)/libmultipath/nvme
+
# Check whether a function with name $1 has been declared in header file $2.
check_func = $(shell \
if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \

View File

@ -1,65 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 10:47:51 +0200
Subject: [PATCH] libmultipath: sysfs_bin_attr_get_value(): no error if buffer
is filled
sysfs_bin_attr_get_value() sets the length of bytes read to 0
when the provided buffer was too small, truncating potentially
useful data. This is harmful e.g. in do_inquiry(), if the "inquiry"
sysfs attribute contains more than 96 bytes (which is possible).
Actually, binary attributes don't need to be 0-terminated. Thus,
unlike for string attributes, it's not an error if the requested number of
bytes is exactly equal to the number of bytes read. We expect that
the caller knows how many bytes it needs to read.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/discovery.c | 10 ++++++----
libmultipath/sysfs.c | 5 +----
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 7e09e4e2..f5b8401c 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1341,13 +1341,15 @@ static int
get_vpd_sysfs (struct udev_device *parent, int pg, char * str, int maxlen)
{
int len;
- size_t buff_len;
+ ssize_t buff_len;
unsigned char buff[VPD_BUFLEN];
memset(buff, 0x0, VPD_BUFLEN);
- if (!parent || sysfs_get_vpd(parent, pg, buff, VPD_BUFLEN) <= 0) {
- condlog(3, "failed to read sysfs vpd pg%02x", pg);
- return -EINVAL;
+ buff_len = sysfs_get_vpd(parent, pg, buff, VPD_BUFLEN);
+ if (buff_len < 0) {
+ condlog(3, "failed to read sysfs vpd pg%02x: %s",
+ pg, strerror(-buff_len));
+ return buff_len;
}
if (buff[1] != pg) {
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index f45dbee1..3ec92512 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -146,10 +146,7 @@ ssize_t sysfs_bin_attr_get_value(struct udev_device *dev, const char *attr_name,
if (size < 0) {
condlog(4, "read from %s failed: %s", devpath, strerror(errno));
size = -errno;
- } else if (size == (ssize_t)value_len) {
- condlog(4, "overflow while reading from %s", devpath);
- size = 0;
- }
+ };
close(fd);
return size;

View File

@ -0,0 +1,110 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 17:17:00 +0200
Subject: [PATCH] multipath-tools: Makefiles: replace $(libdir) by $(plugindir)
The make variables $(libdir) and $(plugindir) are redundant.
I overlooked that in af15832 ("multipath-tools: make multipath_dir a
compiled-in option"). While libdir has existed longer, I think
plugindir describes better what this path is used for, so replace
libdir by plugindir.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 1 -
libmpathutil/Makefile | 1 -
libmultipath/Makefile | 2 +-
libmultipath/checkers/Makefile | 4 ++--
libmultipath/foreign/Makefile | 4 ++--
libmultipath/prioritizers/Makefile | 4 ++--
6 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 6ec8201b..17707a3e 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -51,7 +51,6 @@ mandir := $(usr_prefix)/share/man
LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
-libdir = $(prefix)/$(LIB)/multipath
includedir = $(usr_prefix)/include
pkgconfdir = $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index 68b1c7d6..c913c761 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -54,7 +54,6 @@ abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
uninstall:
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index f0df27c0..c7d4fc99 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -119,7 +119,7 @@ test-lib: ../tests/$(LIBS)
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(plugindir)
$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
uninstall:
diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile
index c9a2c4ca..39ad76e0 100644
--- a/libmultipath/checkers/Makefile
+++ b/libmultipath/checkers/Makefile
@@ -25,10 +25,10 @@ libcheck%.so: %.o
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(libdir)/$$file; done
+ for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(RM) core *.a *.o *.gz *.so
diff --git a/libmultipath/foreign/Makefile b/libmultipath/foreign/Makefile
index d0232f20..8bf9047b 100644
--- a/libmultipath/foreign/Makefile
+++ b/libmultipath/foreign/Makefile
@@ -17,10 +17,10 @@ libforeign-%.so: %.o
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(libdir)/$$file; done
+ for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(RM) core *.a *.o *.gz *.so
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index 97155f51..72eefe49 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -37,10 +37,10 @@ libprio%.so: %.o
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install: $(LIBS)
- $(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(libdir)/$$file; done
+ for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(RM) core *.a *.o *.gz *.so

View File

@ -1,115 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 11:14:30 +0200
Subject: [PATCH] libmultipath: common code path for sysfs_attr_get_value()
The code for sysfs_attr_get_value and sysfs_bin_attr_get_value() was
almost identical. Use a common code path.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/sysfs.c | 70 +++++++++++---------------------------------
1 file changed, 17 insertions(+), 53 deletions(-)
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index 3ec92512..4db911cc 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -44,8 +44,8 @@
* as libudev lacks the capability to update an attribute value.
* So for modified attributes we need to implement our own function.
*/
-ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
- char * value, size_t value_len)
+static ssize_t __sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
+ char *value, size_t value_len, bool binary)
{
char devpath[PATH_SIZE];
struct stat statbuf;
@@ -87,12 +87,14 @@ ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
if (size < 0) {
condlog(4, "read from %s failed: %s", devpath, strerror(errno));
size = -errno;
- value[0] = '\0';
- } else if (size == (ssize_t)value_len) {
+ if (!binary)
+ value[0] = '\0';
+ } else if (!binary && size == (ssize_t)value_len) {
+ condlog(3, "%s: overflow reading from %s (required len: %zu)",
+ __func__, devpath, size);
value[size - 1] = '\0';
- condlog(4, "overflow while reading from %s", devpath);
size = 0;
- } else {
+ } else if (!binary) {
value[size] = '\0';
size = strchop(value);
}
@@ -101,55 +103,17 @@ ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
return size;
}
-ssize_t sysfs_bin_attr_get_value(struct udev_device *dev, const char *attr_name,
- unsigned char * value, size_t value_len)
+ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
+ char *value, size_t value_len)
{
- char devpath[PATH_SIZE];
- struct stat statbuf;
- int fd;
- ssize_t size = -1;
-
- if (!dev || !attr_name || !value)
- return 0;
-
- snprintf(devpath, PATH_SIZE, "%s/%s", udev_device_get_syspath(dev),
- attr_name);
- condlog(4, "open '%s'", devpath);
- /* read attribute value */
- fd = open(devpath, O_RDONLY);
- if (fd < 0) {
- condlog(4, "attribute '%s' can not be opened: %s",
- devpath, strerror(errno));
- return -errno;
- }
- if (fstat(fd, &statbuf) != 0) {
- condlog(4, "stat '%s' failed: %s", devpath, strerror(errno));
- close(fd);
- return -ENXIO;
- }
-
- /* skip directories */
- if (S_ISDIR(statbuf.st_mode)) {
- condlog(4, "%s is a directory", devpath);
- close(fd);
- return -EISDIR;
- }
-
- /* skip non-writeable files */
- if ((statbuf.st_mode & S_IRUSR) == 0) {
- condlog(4, "%s is not readable", devpath);
- close(fd);
- return -EPERM;
- }
-
- size = read(fd, value, value_len);
- if (size < 0) {
- condlog(4, "read from %s failed: %s", devpath, strerror(errno));
- size = -errno;
- };
+ return __sysfs_attr_get_value(dev, attr_name, value, value_len, false);
+}
- close(fd);
- return size;
+ssize_t sysfs_bin_attr_get_value(struct udev_device *dev, const char *attr_name,
+ unsigned char *value, size_t value_len)
+{
+ return __sysfs_attr_get_value(dev, attr_name, (char *)value,
+ value_len, true);
}
ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,

View File

@ -0,0 +1,112 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 17:35:48 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: use simple make variables
consistently
"Simply expanded" make variables are generally preferred over "recursively
expanded" make variables, unless they reference other variables that are
defined over overwritten further down in the Makefile (see
https://www.gnu.org/software/make/manual/html_node/Flavors.html).
Using them makes the code easier to read and even somewhat faster.
We've been adding simply expanded variables over time, but most older
code still uses recursively expanded ones. Try to be consistent, at least
in Makefile.inc.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 17707a3e..86602e2a 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -32,11 +32,11 @@ SYSTEMD := $(strip $(or $(shell $(PKGCONFIG) --modversion libsystemd 2>/dev/null
$(shell systemctl --version 2>/dev/null | sed -n 's/systemd \([0-9]*\).*/\1/p')))
# Paths. All these can be overridden on the "make" command line.
-prefix =
+prefix :=
# Prefix for binaries
-exec_prefix = $(prefix)
+exec_prefix := $(prefix)
# Prefix for non-essential libraries (libdmmp)
-usr_prefix = $(prefix)
+usr_prefix := $(prefix)
# Where to install systemd-related files. systemd is usually installed under /usr
# Note: some systemd installations use separate "prefix" and "rootprefix".
# In this case, override only unitdir to use systemd's "rootprefix" instead of $(systemd_prefix)
@@ -46,13 +46,13 @@ tmpfilesdir := $(systemd_prefix)/lib/tmpfiles.d
modulesloaddir := $(systemd_prefix)/lib/modules-load.d
libudevdir := $(systemd_prefix)/lib/udev
udevrulesdir := $(libudevdir)/rules.d
-bindir = $(exec_prefix)/sbin
+bindir := $(exec_prefix)/sbin
mandir := $(usr_prefix)/share/man
LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
-syslibdir = $(prefix)/$(LIB)
-usrlibdir = $(usr_prefix)/$(LIB)
-includedir = $(usr_prefix)/include
-pkgconfdir = $(usrlibdir)/pkgconfig
+syslibdir := $(prefix)/$(LIB)
+usrlibdir := $(usr_prefix)/$(LIB)
+includedir := $(usr_prefix)/include
+pkgconfdir := $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
configdir := $(prefix)/etc/multipath/conf.d
runtimedir := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run)
@@ -60,10 +60,10 @@ devmapper_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir devmapper),/
libudev_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir libudev),/usr/include)
kernel_incdir := /usr/include
-GZIP_PROG = gzip -9 -c
-RM = rm -f
-LN = ln -sf
-INSTALL_PROGRAM = install
+GZIP_PROG := gzip -9 -c
+RM := rm -f
+LN := ln -sf
+INSTALL_PROGRAM := install
NV_VERSION_SCRIPT = $(VERSION_SCRIPT:%.version=%-nv.version)
# $(call TEST_CC_OPTION,option,fallback)
@@ -106,23 +106,23 @@ CPPFLAGS := $(FORTIFY_OPT) \
-DRUNTIME_DIR=\"$(runtimedir)\" \
-DCONFIG_DIR=\"$(configdir)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
-BIN_CFLAGS = -fPIE -DPIE
-LIB_CFLAGS = -fPIC
-SHARED_FLAGS = -shared
+BIN_CFLAGS := -fPIE -DPIE
+LIB_CFLAGS := -fPIC
+SHARED_FLAGS := -shared
LDFLAGS := $(LDFLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs
-BIN_LDFLAGS = -pie
+BIN_LDFLAGS := -pie
# Source code directories. Don't modify.
-multipathdir = $(TOPDIR)/libmultipath
-daemondir = $(TOPDIR)/multipathd
-mpathutildir = $(TOPDIR)/libmpathutil
-mpathpersistdir = $(TOPDIR)/libmpathpersist
-mpathcmddir = $(TOPDIR)/libmpathcmd
-mpathvaliddir = $(TOPDIR)/libmpathvalid
-thirdpartydir = $(TOPDIR)/third-party
-libdmmpdir = $(TOPDIR)/libdmmp
-nvmedir = $(TOPDIR)/libmultipath/nvme
+multipathdir := $(TOPDIR)/libmultipath
+daemondir := $(TOPDIR)/multipathd
+mpathutildir := $(TOPDIR)/libmpathutil
+mpathpersistdir := $(TOPDIR)/libmpathpersist
+mpathcmddir := $(TOPDIR)/libmpathcmd
+mpathvaliddir := $(TOPDIR)/libmpathvalid
+thirdpartydir := $(TOPDIR)/third-party
+libdmmpdir := $(TOPDIR)/libdmmp
+nvmedir := $(TOPDIR)/libmultipath/nvme
# Check whether a function with name $1 has been declared in header file $2.
check_func = $(shell \

View File

@ -1,165 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 11:41:40 +0200
Subject: [PATCH] libmultipath: sanitize error checking in sysfs accessors
udev_device_get_syspath() may return NULL; check for it, and check
for pathname overflow. Disallow a zero buffer length. The fstat()
calls were superfluous, as a read() or write() on the fd would
return the respective error codes depending on file type or permissions,
the extra system call and code complexity adds no value.
Log levels should be moderate in sysfs.c, because it depends
on the caller whether errors getting/setting certain attributes are
fatal.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/sysfs.c | 94 ++++++++++++++++++--------------------------
1 file changed, 39 insertions(+), 55 deletions(-)
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index 4db911cc..1f0f2074 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -47,46 +47,38 @@
static ssize_t __sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
char *value, size_t value_len, bool binary)
{
+ const char *syspath;
char devpath[PATH_SIZE];
- struct stat statbuf;
int fd;
ssize_t size = -1;
- if (!dev || !attr_name || !value)
- return 0;
+ if (!dev || !attr_name || !value || !value_len) {
+ condlog(1, "%s: invalid parameters", __func__);
+ return -EINVAL;
+ }
- snprintf(devpath, PATH_SIZE, "%s/%s", udev_device_get_syspath(dev),
- attr_name);
+ syspath = udev_device_get_syspath(dev);
+ if (!syspath) {
+ condlog(3, "%s: invalid udevice", __func__);
+ return -EINVAL;
+ }
+ if (safe_sprintf(devpath, "%s/%s", syspath, attr_name)) {
+ condlog(3, "%s: devpath overflow", __func__);
+ return -EOVERFLOW;
+ }
condlog(4, "open '%s'", devpath);
/* read attribute value */
fd = open(devpath, O_RDONLY);
if (fd < 0) {
- condlog(4, "attribute '%s' can not be opened: %s",
- devpath, strerror(errno));
+ condlog(3, "%s: attribute '%s' can not be opened: %s",
+ __func__, devpath, strerror(errno));
return -errno;
}
- if (fstat(fd, &statbuf) < 0) {
- condlog(4, "stat '%s' failed: %s", devpath, strerror(errno));
- close(fd);
- return -ENXIO;
- }
- /* skip directories */
- if (S_ISDIR(statbuf.st_mode)) {
- condlog(4, "%s is a directory", devpath);
- close(fd);
- return -EISDIR;
- }
- /* skip non-writeable files */
- if ((statbuf.st_mode & S_IRUSR) == 0) {
- condlog(4, "%s is not readable", devpath);
- close(fd);
- return -EPERM;
- }
-
size = read(fd, value, value_len);
if (size < 0) {
- condlog(4, "read from %s failed: %s", devpath, strerror(errno));
size = -errno;
+ condlog(3, "%s: read from %s failed: %s", __func__, devpath,
+ strerror(errno));
if (!binary)
value[0] = '\0';
} else if (!binary && size == (ssize_t)value_len) {
@@ -119,51 +111,43 @@ ssize_t sysfs_bin_attr_get_value(struct udev_device *dev, const char *attr_name,
ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
const char * value, size_t value_len)
{
+ const char *syspath;
char devpath[PATH_SIZE];
- struct stat statbuf;
int fd;
ssize_t size = -1;
- if (!dev || !attr_name || !value || !value_len)
- return 0;
+ if (!dev || !attr_name || !value || !value_len) {
+ condlog(1, "%s: invalid parameters", __func__);
+ return -EINVAL;
+ }
+
+ syspath = udev_device_get_syspath(dev);
+ if (!syspath) {
+ condlog(3, "%s: invalid udevice", __func__);
+ return -EINVAL;
+ }
+ if (safe_sprintf(devpath, "%s/%s", syspath, attr_name)) {
+ condlog(3, "%s: devpath overflow", __func__);
+ return -EOVERFLOW;
+ }
- snprintf(devpath, PATH_SIZE, "%s/%s", udev_device_get_syspath(dev),
- attr_name);
condlog(4, "open '%s'", devpath);
/* write attribute value */
fd = open(devpath, O_WRONLY);
if (fd < 0) {
- condlog(4, "attribute '%s' can not be opened: %s",
- devpath, strerror(errno));
- return -errno;
- }
- if (fstat(fd, &statbuf) != 0) {
- condlog(4, "stat '%s' failed: %s", devpath, strerror(errno));
- close(fd);
+ condlog(2, "%s: attribute '%s' can not be opened: %s",
+ __func__, devpath, strerror(errno));
return -errno;
}
- /* skip directories */
- if (S_ISDIR(statbuf.st_mode)) {
- condlog(4, "%s is a directory", devpath);
- close(fd);
- return -EISDIR;
- }
-
- /* skip non-writeable files */
- if ((statbuf.st_mode & S_IWUSR) == 0) {
- condlog(4, "%s is not writeable", devpath);
- close(fd);
- return -EPERM;
- }
-
size = write(fd, value, value_len);
if (size < 0) {
- condlog(4, "write to %s failed: %s", devpath, strerror(errno));
size = -errno;
+ condlog(3, "%s: write to %s failed: %s", __func__,
+ devpath, strerror(errno));
} else if (size < (ssize_t)value_len) {
- condlog(4, "tried to write %ld to %s. Wrote %ld",
- (long)value_len, devpath, (long)size);
+ condlog(3, "%s: underflow writing %zu bytes to %s. Wrote %zd bytes",
+ __func__, value_len, devpath, size);
size = 0;
}

View File

@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 17:40:30 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: fix a log message
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.inc b/Makefile.inc
index 86602e2a..77790ddf 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -159,7 +159,7 @@ check_var = $(shell \
found=0; \
status="no"; \
fi; \
- echo 1>&2 "Checking for .. $1 in $2 ... $$status"; \
+ echo 1>&2 "Checking for $1 in $2 ... $$status"; \
echo "$$found" \
)

View File

@ -1,115 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 11:52:42 +0200
Subject: [PATCH] libmultipath: get rid of PATH_SIZE
replace PATH_SIZE with the system limit PATH_MAX. In some places,
PATH_SIZE was used for file names. Use FILE_NAME_SIZE in these cases.
Also, use a constant for "multipathd.service" in systemd_service_enabled_in().
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/structs.h | 3 ---
libmultipath/sysfs.c | 8 ++++----
libmultipath/util.c | 8 +++++---
multipathd/cli_handlers.c | 2 +-
4 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index a6a09441..dfa12ff9 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -17,7 +17,6 @@
#define FILE_NAME_SIZE 256
#define CALLOUT_MAX_SIZE 256
#define BLK_DEV_SIZE 33
-#define PATH_SIZE 512
#define NAME_SIZE 512
#define HOST_NAME_LEN 16
#define SLOT_NAME_SIZE 40
@@ -519,6 +518,4 @@ int pathcmp (const struct pathgroup *, const struct pathgroup *);
int add_feature (char **, const char *);
int remove_feature (char **, const char *);
-extern char sysfs_path[PATH_SIZE];
-
#endif /* _STRUCTS_H */
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index 1f0f2074..e48b05ec 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -48,7 +48,7 @@ static ssize_t __sysfs_attr_get_value(struct udev_device *dev, const char *attr_
char *value, size_t value_len, bool binary)
{
const char *syspath;
- char devpath[PATH_SIZE];
+ char devpath[PATH_MAX];
int fd;
ssize_t size = -1;
@@ -112,7 +112,7 @@ ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
const char * value, size_t value_len)
{
const char *syspath;
- char devpath[PATH_SIZE];
+ char devpath[PATH_MAX];
int fd;
ssize_t size = -1;
@@ -184,7 +184,7 @@ sysfs_get_size (struct path *pp, unsigned long long * size)
int sysfs_check_holders(char * check_devt, char * new_devt)
{
unsigned int major, new_minor, table_minor;
- char path[PATH_MAX], check_dev[PATH_SIZE];
+ char path[PATH_MAX], check_dev[FILE_NAME_SIZE];
char * table_name;
DIR *dirfd;
struct dirent *holder;
@@ -194,7 +194,7 @@ int sysfs_check_holders(char * check_devt, char * new_devt)
return 0;
}
- if (devt2devname(check_dev, PATH_SIZE, check_devt)) {
+ if (devt2devname(check_dev, sizeof(check_dev), check_devt)) {
condlog(1, "can't get devname for %s", check_devt);
return 0;
}
diff --git a/libmultipath/util.c b/libmultipath/util.c
index ce5ea73e..e7e7d4c1 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -242,13 +242,15 @@ setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached)
int systemd_service_enabled_in(const char *dev, const char *prefix)
{
- char path[PATH_SIZE], file[PATH_MAX], service[PATH_SIZE];
+ static const char service[] = "multipathd.service";
+ char path[PATH_MAX], file[PATH_MAX];
DIR *dirfd;
struct dirent *d;
int found = 0;
- snprintf(service, PATH_SIZE, "multipathd.service");
- snprintf(path, PATH_SIZE, "%s/systemd/system", prefix);
+ if (safe_sprintf(path, "%s/systemd/system", prefix))
+ return 0;
+
condlog(3, "%s: checking for %s in %s", dev, service, path);
dirfd = opendir(path);
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index d79cdd7c..db4d4412 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -688,7 +688,7 @@ cli_add_map (void * v, struct strbuf *reply, void * data)
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, MAP);
int major = -1, minor = -1;
- char dev_path[PATH_SIZE];
+ char dev_path[FILE_NAME_SIZE];
char *refwwid, *alias = NULL;
int rc, count = 0;
struct config *conf;

View File

@ -0,0 +1,129 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:40:27 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: set systemd-specific flags
Define SYSTEMD_CPPFLAGS and SYSTEMD_LIBDEPS, and use them in Makefiles.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 3 +++
libmpathutil/Makefile | 13 ++-----------
libmultipath/Makefile | 14 +++-----------
multipathd/Makefile | 25 ++++++++-----------------
4 files changed, 16 insertions(+), 39 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 77790ddf..2cf25745 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -97,6 +97,9 @@ ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers
WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
WFORMATOVERFLOW := $(call TEST_CC_OPTION,-Wformat-overflow=2,)
+SYSTEMD_CPPFLAGS := $(if $(SYSTEMD),-DUSE_SYSTEMD=$(SYSTEMD))
+SYSTEMD_LIBDEPS := $(if $(SYSTEMD),$(if $(shell test $(SYSTEMD) -gt 209 && echo 1),-lsystemd,-lsystemd-daemon))
+
OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implicit-int \
-Werror=implicit-function-declaration -Werror=format-security \
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index c913c761..4be75d2d 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -8,19 +8,10 @@ DEVLIB = libmpathutil.so
LIBS = $(DEVLIB).$(SONAME)
VERSION_SCRIPT := libmpathutil.version
-CPPFLAGS += -I. -I$(multipathdir) -I$(mpathcmddir)
+CPPFLAGS += -I. -I$(multipathdir) -I$(mpathcmddir) $(SYSTEMD_CPPFLAGS)
CFLAGS += $(LIB_CFLAGS) -D_GNU_SOURCE
-LIBDEPS += -lpthread -ldl -ludev -L$(mpathcmddir) -lmpathcmd
-
-ifdef SYSTEMD
- CPPFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
- ifeq ($(shell test $(SYSTEMD) -gt 209 && echo 1), 1)
- LIBDEPS += -lsystemd
- else
- LIBDEPS += -lsystemd-daemon
- endif
-endif
+LIBDEPS += -lpthread -ldl -ludev -L$(mpathcmddir) -lmpathcmd $(SYSTEMD_LIBDEPS)
# object files referencing MULTIPATH_DIR or CONFIG_DIR
# they need to be recompiled for unit tests
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index c7d4fc99..009f26a3 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -8,19 +8,11 @@ DEVLIB = libmultipath.so
LIBS = $(DEVLIB).$(SONAME)
VERSION_SCRIPT := libmultipath.version
-CPPFLAGS += -I$(mpathutildir) -I$(mpathcmddir) -I$(nvmedir) -D_GNU_SOURCE
+CPPFLAGS += -I$(mpathutildir) -I$(mpathcmddir) -I$(nvmedir) -D_GNU_SOURCE $(SYSTEMD_CPPFLAGS)
CFLAGS += $(LIB_CFLAGS)
-LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd -lurcu -laio
-
-ifdef SYSTEMD
- CPPFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
- ifeq ($(shell test $(SYSTEMD) -gt 209 && echo 1), 1)
- LIBDEPS += -lsystemd
- else
- LIBDEPS += -lsystemd-daemon
- endif
-endif
+LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd \
+ -lurcu -laio $(SYSTEMD_LIBDEPS)
ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_FLUSH
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 78aefee0..cdda371b 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -18,14 +18,17 @@ endif
CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcmddir) -I$(thirdpartydir) \
$(shell $(PKGCONFIG) --modversion liburcu 2>/dev/null | \
awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') \
- -DBINDIR='"$(bindir)"'
+ -DBINDIR='"$(bindir)"' $(SYSTEMD_CPPFLAGS)
+ifeq ($(ENABLE_DMEVENTS_POLL),0)
+ CPPFLAGS += -DNO_DMEVENTS_POLL
+endif
CFLAGS += $(BIN_CFLAGS)
LDFLAGS += $(BIN_LDFLAGS)
-CLI_LIBDEPS := -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd -ludev -ldl -lurcu -lpthread
-LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
- -ldevmapper $(CLI_LIBDEPS)
-
+CLI_LIBDEPS := -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd \
+ -ludev -ldl -lurcu -lpthread $(SYSTEMD_LIBDEPS)
+LIBDEPS := -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
+ -ldevmapper $(CLI_LIBDEPS)
ifeq ($(READLINE),libedit)
RL_CPPFLAGS = -DUSE_LIBEDIT
@@ -40,18 +43,6 @@ RL_CPPFLAGS += -DBROKEN_RL_COMPLETION_FUNC
endif
endif
-ifdef SYSTEMD
- CPPFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
- ifeq ($(shell test $(SYSTEMD) -gt 209 && echo 1), 1)
- CLI_LIBDEPS += -lsystemd
- else
- CLI_LIBDEPS += -lsystemd-daemon
- endif
-endif
-ifeq ($(ENABLE_DMEVENTS_POLL),0)
- CPPFLAGS += -DNO_DMEVENTS_POLL
-endif
-
OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o waiter.o \
dmevents.o init_unwinder.o

View File

@ -1,172 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 13:33:51 +0200
Subject: [PATCH] libmultipath: sysfs_attr_get_value(): don't return 0 if
buffer too small
If the passed read buffer is too small to hold the value read plus
terminating 0 byte, return the given size value rather than 0.
This way we get similar semantics as for sysfs_bin_attr_get_get_value(),
except that sysfs_attr_get_value() must always 0-terminate the value;
thus a return value equal to the length parameter is an error for
the non-binary case.
Provide a helper macro to test this "overflow" condition.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 2 +-
libmultipath/discovery.c | 14 +++++++-------
libmultipath/propsel.c | 6 +++++-
libmultipath/sysfs.c | 3 +--
libmultipath/sysfs.h | 13 +++++++++++++
multipathd/main.c | 2 +-
6 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 09ae708d..467bbaa6 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -589,7 +589,7 @@ sysfs_set_max_sectors_kb(struct multipath *mpp, int is_reload)
ret = sysfs_attr_get_value(udd, "queue/max_sectors_kb", buff,
sizeof(buff));
udev_device_unref(udd);
- if (ret <= 0) {
+ if (!sysfs_attr_value_ok(ret, sizeof(buff))) {
condlog(1, "failed to get current max_sectors_kb from %s", mpp->alias);
return 1;
}
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index f5b8401c..54b1caf0 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -560,10 +560,10 @@ sysfs_get_asymmetric_access_state(struct path *pp, char *buff, int buflen)
if (!parent)
return -1;
- if (sysfs_attr_get_value(parent, "access_state", buff, buflen) <= 0)
+ if (!sysfs_attr_get_value_ok(parent, "access_state", buff, buflen))
return -1;
- if (sysfs_attr_get_value(parent, "preferred_path", value, 16) <= 0)
+ if (!sysfs_attr_get_value_ok(parent, "preferred_path", value, sizeof(value)))
return 0;
preferred = strtoul(value, &eptr, 0);
@@ -638,8 +638,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
/*
* read the current dev_loss_tmo value from sysfs
*/
- ret = sysfs_attr_get_value(rport_dev, "dev_loss_tmo", value, 16);
- if (ret <= 0) {
+ ret = sysfs_attr_get_value(rport_dev, "dev_loss_tmo", value, sizeof(value));
+ if (!sysfs_attr_value_ok(ret, sizeof(value))) {
condlog(0, "%s: failed to read dev_loss_tmo value, "
"error %d", rport_id, -ret);
goto out;
@@ -1737,8 +1737,8 @@ path_offline (struct path * pp)
}
memset(buff, 0x0, SCSI_STATE_SIZE);
- err = sysfs_attr_get_value(parent, "state", buff, SCSI_STATE_SIZE);
- if (err <= 0) {
+ err = sysfs_attr_get_value(parent, "state", buff, sizeof(buff));
+ if (!sysfs_attr_value_ok(err, sizeof(buff))) {
if (err == -ENXIO)
return PATH_REMOVED;
else
@@ -2142,7 +2142,7 @@ static ssize_t uid_fallback(struct path *pp, int path_state,
return -1;
len = sysfs_attr_get_value(pp->udev, "wwid", value,
sizeof(value));
- if (len <= 0)
+ if (!sysfs_attr_value_ok(len, sizeof(value)))
return -1;
len = strlcpy(pp->wwid, value, WWID_SIZE);
if (len >= WWID_SIZE) {
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index f782f251..98e3aad1 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -435,6 +435,7 @@ out:
static int get_dh_state(struct path *pp, char *value, size_t value_len)
{
struct udev_device *ud;
+ ssize_t rc;
if (pp->udev == NULL)
return -1;
@@ -444,7 +445,10 @@ static int get_dh_state(struct path *pp, char *value, size_t value_len)
if (ud == NULL)
return -1;
- return sysfs_attr_get_value(ud, "dh_state", value, value_len);
+ rc = sysfs_attr_get_value(ud, "dh_state", value, value_len);
+ if (!sysfs_attr_value_ok(rc, value_len))
+ return -1;
+ return rc;
}
int select_hwhandler(struct config *conf, struct multipath *mp)
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index e48b05ec..125f1c2b 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -85,7 +85,6 @@ static ssize_t __sysfs_attr_get_value(struct udev_device *dev, const char *attr_
condlog(3, "%s: overflow reading from %s (required len: %zu)",
__func__, devpath, size);
value[size - 1] = '\0';
- size = 0;
} else if (!binary) {
value[size] = '\0';
size = strchop(value);
@@ -165,7 +164,7 @@ sysfs_get_size (struct path *pp, unsigned long long * size)
return 1;
attr[0] = '\0';
- if (sysfs_attr_get_value(pp->udev, "size", attr, 255) <= 0) {
+ if (!sysfs_attr_get_value_ok(pp->udev, "size", attr, sizeof(attr))) {
condlog(3, "%s: No size attribute in sysfs", pp->dev);
return 1;
}
diff --git a/libmultipath/sysfs.h b/libmultipath/sysfs.h
index 72b39ab2..cdc84e40 100644
--- a/libmultipath/sysfs.h
+++ b/libmultipath/sysfs.h
@@ -12,6 +12,19 @@ ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
char * value, size_t value_len);
ssize_t sysfs_bin_attr_get_value(struct udev_device *dev, const char *attr_name,
unsigned char * value, size_t value_len);
+#define sysfs_attr_value_ok(rc, value_len) \
+ ({ \
+ ssize_t __r = rc; \
+ __r >= 0 && (size_t)__r < (size_t)value_len; \
+ })
+
+#define sysfs_attr_get_value_ok(dev, attr, val, len) \
+ ({ \
+ size_t __l = (len); \
+ ssize_t __rc = sysfs_attr_get_value(dev, attr, val, __l); \
+ sysfs_attr_value_ok(__rc, __l); \
+ })
+
int sysfs_get_size (struct path *pp, unsigned long long * size);
int sysfs_check_holders(char * check_devt, char * new_devt);
bool sysfs_is_multipathed(struct path *pp, bool set_wwid);
diff --git a/multipathd/main.c b/multipathd/main.c
index 2f2b9d4c..68eca925 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1126,7 +1126,7 @@ sysfs_get_ro (struct path *pp)
if (!pp->udev)
return -1;
- if (sysfs_attr_get_value(pp->udev, "ro", buff, sizeof(buff)) <= 0) {
+ if (!sysfs_attr_get_value_ok(pp->udev, "ro", buff, sizeof(buff))) {
condlog(3, "%s: Cannot read ro attribute in sysfs", pp->dev);
return -1;
}

View File

@ -0,0 +1,54 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 18:51:52 +0200
Subject: [PATCH] multipathd: Makefile: fix compilation flags for libedit
The workaround for the wrong prototype in older libedit versions
had ended up in the code for libreadline. Fix it, and use simple
make variables.
Fixes: 2bd80f6 ("multipathd: fix incompatible pointer type error with libedit")
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/Makefile | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/multipathd/Makefile b/multipathd/Makefile
index cdda371b..7221b6af 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -31,17 +31,17 @@ LIBDEPS := -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
-ldevmapper $(CLI_LIBDEPS)
ifeq ($(READLINE),libedit)
-RL_CPPFLAGS = -DUSE_LIBEDIT
-RL_LIBDEPS += -ledit
-endif
-ifeq ($(READLINE),libreadline)
-RL_CPPFLAGS += -DUSE_LIBREADLINE
-RL_LIBDEPS += -lreadline
-# See comment in uxclnt.c
+RL_CPPFLAGS := -DUSE_LIBEDIT
+RL_LIBDEPS := -ledit
+# See comment in multipathc.c
ifeq ($(shell sed -En 's/.*\<Function\s*\*rl_completion_entry_function;.*/yes/p' /usr/include/editline/readline.h),yes)
RL_CPPFLAGS += -DBROKEN_RL_COMPLETION_FUNC
endif
endif
+ifeq ($(READLINE),libreadline)
+RL_CPPFLAGS := -DUSE_LIBREADLINE
+RL_LIBDEPS := -lreadline
+endif
OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o waiter.o \
dmevents.o init_unwinder.o
@@ -52,8 +52,6 @@ ifeq ($(FPIN_SUPPORT),1)
OBJS += fpin_handlers.o
endif
-
-
EXEC = multipathd
CLI = multipathc

View File

@ -1,251 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 17:51:41 +0200
Subject: [PATCH] libmultipath: sysfs_attr_set_value(): don't return 0 on
partial write
sysfs_attr_set_value() returned 0 if not all requested bytes were written.
Change this to return the number of bytes written. Error checking is now
somewhat more involved; provide a helper macro for it.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 10 ++++--
libmultipath/discovery.c | 74 +++++++++++++++++++++++++---------------
libmultipath/sysfs.c | 6 ++--
libmultipath/sysfs.h | 10 ++++++
4 files changed, 66 insertions(+), 34 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 467bbaa6..0607dbac 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -568,6 +568,7 @@ sysfs_set_max_sectors_kb(struct multipath *mpp, int is_reload)
struct pathgroup * pgp;
struct path *pp;
char buff[11];
+ ssize_t len;
int i, j, ret, err = 0;
struct udev_device *udd;
int max_sectors_kb;
@@ -600,14 +601,17 @@ sysfs_set_max_sectors_kb(struct multipath *mpp, int is_reload)
}
}
snprintf(buff, 11, "%d", max_sectors_kb);
+ len = strlen(buff);
vector_foreach_slot (mpp->pg, pgp, i) {
vector_foreach_slot(pgp->paths, pp, j) {
ret = sysfs_attr_set_value(pp->udev,
"queue/max_sectors_kb",
- buff, strlen(buff));
- if (ret < 0) {
- condlog(1, "failed setting max_sectors_kb on %s : %s", pp->dev, strerror(-ret));
+ buff, len);
+ if (ret != len) {
+ log_sysfs_attr_set_value(1, ret,
+ "failed setting max_sectors_kb on %s",
+ pp->dev);
err = 1;
}
}
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 54b1caf0..ee290093 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -598,13 +598,15 @@ sysfs_set_eh_deadline(struct path *pp)
len = sprintf(value, "%d", pp->eh_deadline);
ret = sysfs_attr_set_value(hostdev, "eh_deadline",
- value, len + 1);
+ value, len);
/*
* not all scsi drivers support setting eh_deadline, so failing
* is totally reasonable
*/
- if (ret <= 0)
- condlog(3, "%s: failed to set eh_deadline to %s, error %d", udev_device_get_sysname(hostdev), value, -ret);
+ if (ret != len)
+ log_sysfs_attr_set_value(3, ret,
+ "%s: failed to set eh_deadline to %s",
+ udev_device_get_sysname(hostdev), value);
udev_device_unref(hostdev);
return (ret <= 0);
@@ -667,19 +669,22 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
pp->fast_io_fail != MP_FAST_IO_FAIL_OFF) {
/* Check if we need to temporarily increase dev_loss_tmo */
if ((unsigned int)pp->fast_io_fail >= tmo) {
+ ssize_t len;
+
/* Increase dev_loss_tmo temporarily */
snprintf(value, sizeof(value), "%u",
(unsigned int)pp->fast_io_fail + 1);
+ len = strlen(value);
ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
- value, strlen(value));
- if (ret <= 0) {
+ value, len);
+ if (ret != len) {
if (ret == -EBUSY)
condlog(3, "%s: rport blocked",
rport_id);
else
- condlog(0, "%s: failed to set "
- "dev_loss_tmo to %s, error %d",
- rport_id, value, -ret);
+ log_sysfs_attr_set_value(0, ret,
+ "%s: failed to set dev_loss_tmo to %s",
+ rport_id, value);
goto out;
}
}
@@ -691,32 +696,39 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
pp->dev_loss = DEFAULT_DEV_LOSS_TMO;
}
if (pp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
+ ssize_t len;
+
if (pp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
sprintf(value, "off");
else if (pp->fast_io_fail == MP_FAST_IO_FAIL_ZERO)
sprintf(value, "0");
else
snprintf(value, 16, "%u", pp->fast_io_fail);
+ len = strlen(value);
ret = sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo",
- value, strlen(value));
- if (ret <= 0) {
+ value, len);
+ if (ret != len) {
if (ret == -EBUSY)
condlog(3, "%s: rport blocked", rport_id);
else
- condlog(0, "%s: failed to set fast_io_fail_tmo to %s, error %d",
- rport_id, value, -ret);
+ log_sysfs_attr_set_value(0, ret,
+ "%s: failed to set fast_io_fail_tmo to %s",
+ rport_id, value);
}
}
if (pp->dev_loss != DEV_LOSS_TMO_UNSET) {
+ ssize_t len;
+
snprintf(value, 16, "%u", pp->dev_loss);
- ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
- value, strlen(value));
- if (ret <= 0) {
+ len = strlen(value);
+ ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo", value, len);
+ if (ret != len) {
if (ret == -EBUSY)
condlog(3, "%s: rport blocked", rport_id);
else
- condlog(0, "%s: failed to set dev_loss_tmo to %s, error %d",
- rport_id, value, -ret);
+ log_sysfs_attr_set_value(0, ret,
+ "%s: failed to set dev_loss_tmo to %s",
+ rport_id, value);
}
}
out:
@@ -754,12 +766,16 @@ sysfs_set_session_tmo(struct path *pp)
condlog(3, "%s: can't set fast_io_fail_tmo to '0'"
"on iSCSI", pp->dev);
} else {
+ ssize_t len, ret;
+
snprintf(value, 11, "%u", pp->fast_io_fail);
- if (sysfs_attr_set_value(session_dev, "recovery_tmo",
- value, strlen(value)) <= 0) {
- condlog(3, "%s: Failed to set recovery_tmo, "
- " error %d", pp->dev, errno);
- }
+ len = strlen(value);
+ ret = sysfs_attr_set_value(session_dev, "recovery_tmo",
+ value, len);
+ if (ret != len)
+ log_sysfs_attr_set_value(3, ret,
+ "%s: Failed to set recovery_tmo to %s",
+ pp->dev, value);
}
}
udev_device_unref(session_dev);
@@ -802,12 +818,16 @@ sysfs_set_nexus_loss_tmo(struct path *pp)
pp->sg_id.channel, pp->sg_id.scsi_id, end_dev_id);
if (pp->dev_loss != DEV_LOSS_TMO_UNSET) {
+ ssize_t len, ret;
+
snprintf(value, 11, "%u", pp->dev_loss);
- if (sysfs_attr_set_value(sas_dev, "I_T_nexus_loss_timeout",
- value, strlen(value)) <= 0)
- condlog(3, "%s: failed to update "
- "I_T Nexus loss timeout, error %d",
- pp->dev, errno);
+ len = strlen(value);
+ ret = sysfs_attr_set_value(sas_dev, "I_T_nexus_loss_timeout",
+ value, len);
+ if (ret != len)
+ log_sysfs_attr_set_value(3, ret,
+ "%s: failed to update I_T Nexus loss timeout",
+ pp->dev);
}
udev_device_unref(sas_dev);
return;
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index 125f1c2b..9c84af70 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -134,7 +134,7 @@ ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
/* write attribute value */
fd = open(devpath, O_WRONLY);
if (fd < 0) {
- condlog(2, "%s: attribute '%s' can not be opened: %s",
+ condlog(3, "%s: attribute '%s' can not be opened: %s",
__func__, devpath, strerror(errno));
return -errno;
}
@@ -144,11 +144,9 @@ ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
size = -errno;
condlog(3, "%s: write to %s failed: %s", __func__,
devpath, strerror(errno));
- } else if (size < (ssize_t)value_len) {
+ } else if (size < (ssize_t)value_len)
condlog(3, "%s: underflow writing %zu bytes to %s. Wrote %zd bytes",
__func__, value_len, devpath, size);
- size = 0;
- }
close(fd);
return size;
diff --git a/libmultipath/sysfs.h b/libmultipath/sysfs.h
index cdc84e40..799f68e9 100644
--- a/libmultipath/sysfs.h
+++ b/libmultipath/sysfs.h
@@ -5,6 +5,7 @@
#ifndef _LIBMULTIPATH_SYSFS_H
#define _LIBMULTIPATH_SYSFS_H
#include <stdbool.h>
+#include "strbuf.h"
ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
const char * value, size_t value_len);
@@ -25,6 +26,15 @@ ssize_t sysfs_bin_attr_get_value(struct udev_device *dev, const char *attr_name,
sysfs_attr_value_ok(__rc, __l); \
})
+#define log_sysfs_attr_set_value(prio, rc, fmt, __args...) \
+do { \
+ STRBUF_ON_STACK(__buf); \
+ if (print_strbuf(&__buf, fmt, ##__args) >= 0 && \
+ print_strbuf(&__buf, ": %s", rc < 0 ? strerror(-rc) : \
+ "write underflow") >= 0) \
+ condlog(prio, "%s", get_strbuf_str(&__buf)); \
+} while(0)
+
int sysfs_get_size (struct path *pp, unsigned long long * size);
int sysfs_check_holders(char * check_devt, char * new_devt);
bool sysfs_is_multipathed(struct path *pp, bool set_wwid);

View File

@ -0,0 +1,136 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 21:59:36 +0200
Subject: [PATCH] multipath-tools Makefiles: clean up executable Makefiles
Move the EXEC definition to the top, and use simple make variables
where possible.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
kpartx/Makefile | 15 +++++++--------
multipath/Makefile | 6 +++---
multipathd/Makefile | 30 ++++++++++++++----------------
3 files changed, 24 insertions(+), 27 deletions(-)
diff --git a/kpartx/Makefile b/kpartx/Makefile
index 464925ad..7ceae96b 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -3,20 +3,19 @@
#
include ../Makefile.inc
-CPPFLAGS += -I. -I$(multipathdir) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-CFLAGS += $(BIN_CFLAGS)
-LDFLAGS += $(BIN_LDFLAGS)
-
-LIBDEPS += -ldevmapper
+EXEC := kpartx
+CPPFLAGS += -I. -I$(multipathdir) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_COOKIE
endif
-OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \
- gpt.o mac.o ps3.o crc32.o lopart.o xstrncpy.o devmapper.o
+CFLAGS += $(BIN_CFLAGS)
+LDFLAGS += $(BIN_LDFLAGS)
+LIBDEPS += -ldevmapper
-EXEC = kpartx
+OBJS := bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \
+ gpt.o mac.o ps3.o crc32.o lopart.o xstrncpy.o devmapper.o
all: $(EXEC)
diff --git a/multipath/Makefile b/multipath/Makefile
index 1c4e7a52..7f7b341d 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -3,15 +3,15 @@
#
include ../Makefile.inc
+EXEC := multipath
+
CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathcmddir)
CFLAGS += $(BIN_CFLAGS)
LDFLAGS += $(BIN_LDFLAGS)
LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathutildir) -lmpathutil \
-L$(mpathcmddir) -lmpathcmd -lpthread -ldevmapper -ldl -ludev
-EXEC = multipath
-
-OBJS = main.o
+OBJS := main.o
all: $(EXEC) multipath.rules tmpfiles.conf
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 7221b6af..bb8f7770 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -1,27 +1,30 @@
include ../Makefile.inc
+EXEC := multipathd
+CLI := multipathc
+
+CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcmddir) -I$(thirdpartydir) \
+ $(shell $(PKGCONFIG) --modversion liburcu 2>/dev/null | \
+ awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') \
+ -DBINDIR='"$(bindir)"' $(SYSTEMD_CPPFLAGS)
+
+ifeq ($(ENABLE_DMEVENTS_POLL),0)
+ CPPFLAGS += -DNO_DMEVENTS_POLL
+endif
ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_GET_ERRNO
endif
-
ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
CPPFLAGS += -DFPIN_EVENT_HANDLER
FPIN_SUPPORT = 1
endif
+
#
# debugging stuff
#
#CPPFLAGS += -DLCKDBG
-#CPPFLAGS += -D_DEBUG_
#CPPFLAGS += -DLOGDBG
-CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcmddir) -I$(thirdpartydir) \
- $(shell $(PKGCONFIG) --modversion liburcu 2>/dev/null | \
- awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') \
- -DBINDIR='"$(bindir)"' $(SYSTEMD_CPPFLAGS)
-ifeq ($(ENABLE_DMEVENTS_POLL),0)
- CPPFLAGS += -DNO_DMEVENTS_POLL
-endif
CFLAGS += $(BIN_CFLAGS)
LDFLAGS += $(BIN_LDFLAGS)
@@ -43,18 +46,13 @@ RL_CPPFLAGS := -DUSE_LIBREADLINE
RL_LIBDEPS := -lreadline
endif
-OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o waiter.o \
+CLI_OBJS := multipathc.o cli.o
+OBJS := main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o waiter.o \
dmevents.o init_unwinder.o
-
-CLI_OBJS = multipathc.o cli.o
-
ifeq ($(FPIN_SUPPORT),1)
OBJS += fpin_handlers.o
endif
-EXEC = multipathd
-CLI = multipathc
-
all : $(EXEC) $(CLI)
$(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so

View File

@ -1,71 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 18:07:57 +0200
Subject: [PATCH] libmultipath: sysfs: cleanup file descriptors on
pthread_cancel()
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/sysfs.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index 9c84af70..64946385 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -49,7 +49,7 @@ static ssize_t __sysfs_attr_get_value(struct udev_device *dev, const char *attr_
{
const char *syspath;
char devpath[PATH_MAX];
- int fd;
+ long fd;
ssize_t size = -1;
if (!dev || !attr_name || !value || !value_len) {
@@ -74,6 +74,8 @@ static ssize_t __sysfs_attr_get_value(struct udev_device *dev, const char *attr_
__func__, devpath, strerror(errno));
return -errno;
}
+ pthread_cleanup_push(close_fd, (void *)fd);
+
size = read(fd, value, value_len);
if (size < 0) {
size = -errno;
@@ -90,7 +92,7 @@ static ssize_t __sysfs_attr_get_value(struct udev_device *dev, const char *attr_
size = strchop(value);
}
- close(fd);
+ pthread_cleanup_pop(1);
return size;
}
@@ -112,7 +114,7 @@ ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
{
const char *syspath;
char devpath[PATH_MAX];
- int fd;
+ long fd;
ssize_t size = -1;
if (!dev || !attr_name || !value || !value_len) {
@@ -138,6 +140,7 @@ ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
__func__, devpath, strerror(errno));
return -errno;
}
+ pthread_cleanup_push(close_fd, (void *)fd);
size = write(fd, value, value_len);
if (size < 0) {
@@ -148,7 +151,7 @@ ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
condlog(3, "%s: underflow writing %zu bytes to %s. Wrote %zd bytes",
__func__, value_len, devpath, size);
- close(fd);
+ pthread_cleanup_pop(1);
return size;
}

View File

@ -0,0 +1,261 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 21:52:06 +0200
Subject: [PATCH] multipath-tools: Makefiles: use common code for libraries
Move shared code to Makefile.inc as far as possible. Use simple
make variables where possible.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 15 ++++++++++++++-
libdmmp/Makefile | 17 ++++++++---------
libmpathcmd/Makefile | 14 ++------------
libmpathpersist/Makefile | 14 ++------------
libmpathutil/Makefile | 14 +-------------
libmpathvalid/Makefile | 14 ++------------
libmultipath/Makefile | 12 +-----------
7 files changed, 30 insertions(+), 70 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 2cf25745..fe6bc088 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -64,7 +64,6 @@ GZIP_PROG := gzip -9 -c
RM := rm -f
LN := ln -sf
INSTALL_PROGRAM := install
-NV_VERSION_SCRIPT = $(VERSION_SCRIPT:%.version=%-nv.version)
# $(call TEST_CC_OPTION,option,fallback)
# Test if the C compiler supports the option.
@@ -127,6 +126,13 @@ thirdpartydir := $(TOPDIR)/third-party
libdmmpdir := $(TOPDIR)/libdmmp
nvmedir := $(TOPDIR)/libmultipath/nvme
+# Common code for libraries - library Makefiles just set DEVLIB
+# SONAME defaults to 0 (we use version scripts)
+SONAME := 0
+LIBS = $(DEVLIB).$(SONAME)
+VERSION_SCRIPT = $(DEVLIB:%.so=%.version)
+NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
+
# Check whether a function with name $1 has been declared in header file $2.
check_func = $(shell \
if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
@@ -175,3 +181,10 @@ check_var = $(shell \
%.abi: %.so
abidw $< >$@
+
+%-nv.version: %.version
+ @echo creating $@ from $<
+ @printf 'NOVERSION {\nglobal:\n' >$@
+ @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
+ @printf 'local:\n\t*;\n};\n' >>$@
+
diff --git a/libdmmp/Makefile b/libdmmp/Makefile
index 985b694b..67b6f86f 100644
--- a/libdmmp/Makefile
+++ b/libdmmp/Makefile
@@ -5,15 +5,14 @@
#
include ../Makefile.inc
-LIBDMMP_VERSION=0.2.0
-SONAME=$(LIBDMMP_VERSION)
-DEVLIB = libdmmp.so
-LIBS = $(DEVLIB).$(SONAME)
-PKGFILE = libdmmp.pc
-EXTRA_MAN_FILES = libdmmp.h.3
-HEADERS = libdmmp/libdmmp.h
-
-OBJS = libdmmp.o libdmmp_mp.o libdmmp_pg.o libdmmp_path.o libdmmp_misc.o
+LIBDMMP_VERSION := 0.2.0
+SONAME := $(LIBDMMP_VERSION)
+DEVLIB := libdmmp.so
+PKGFILE := libdmmp.pc
+EXTRA_MAN_FILES := libdmmp.h.3
+HEADERS := libdmmp/libdmmp.h
+
+OBJS := libdmmp.o libdmmp_mp.o libdmmp_pg.o libdmmp_path.o libdmmp_misc.o
CPPFLAGS += -I$(libdmmpdir) -I$(mpathcmddir) $(shell $(PKGCONFIG) --cflags json-c)
CFLAGS += $(LIB_CFLAGS) -fvisibility=hidden
diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
index 0f83fe7b..f705c7f0 100644
--- a/libmpathcmd/Makefile
+++ b/libmpathcmd/Makefile
@@ -1,13 +1,8 @@
include ../Makefile.inc
-SONAME = 0
-DEVLIB = libmpathcmd.so
-LIBS = $(DEVLIB).$(SONAME)
-VERSION_SCRIPT := libmpathcmd.version
-
+DEVLIB := libmpathcmd.so
CFLAGS += $(LIB_CFLAGS)
-
-OBJS = mpath_cmd.o
+OBJS := mpath_cmd.o
all: $(DEVLIB)
@@ -15,11 +10,6 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-$(NV_VERSION_SCRIPT): $(VERSION_SCRIPT)
- @printf 'NOVERSION {\nglobal:\n' >$@
- @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
- @printf 'local:\n\t*;\n};\n' >>$@
-
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
index 479524d4..6f69168f 100644
--- a/libmpathpersist/Makefile
+++ b/libmpathpersist/Makefile
@@ -1,16 +1,11 @@
include ../Makefile.inc
-SONAME = 0
-DEVLIB = libmpathpersist.so
-LIBS = $(DEVLIB).$(SONAME)
-VERSION_SCRIPT:= libmpathpersist.version
-
+DEVLIB := libmpathpersist.so
CFLAGS += $(LIB_CFLAGS) -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcmddir)
LDFLAGS += -L$(multipathdir) -L$(mpathutildir) -L$(mpathcmddir)
-
LIBDEPS += -lmultipath -lmpathutil -lmpathcmd -ldevmapper -lpthread -ldl
-OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o mpath_persist_int.o
+OBJS := mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o mpath_persist_int.o
all: $(DEVLIB)
@@ -18,11 +13,6 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-$(NV_VERSION_SCRIPT): $(VERSION_SCRIPT)
- @printf 'NOVERSION {\nglobal:\n' >$@
- @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
- @printf 'local:\n\t*;\n};\n' >>$@
-
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index 4be75d2d..5665af28 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -3,14 +3,9 @@
#
include ../Makefile.inc
-SONAME = 0
-DEVLIB = libmpathutil.so
-LIBS = $(DEVLIB).$(SONAME)
-VERSION_SCRIPT := libmpathutil.version
-
+DEVLIB := libmpathutil.so
CPPFLAGS += -I. -I$(multipathdir) -I$(mpathcmddir) $(SYSTEMD_CPPFLAGS)
CFLAGS += $(LIB_CFLAGS) -D_GNU_SOURCE
-
LIBDEPS += -lpthread -ldl -ludev -L$(mpathcmddir) -lmpathcmd $(SYSTEMD_LIBDEPS)
# object files referencing MULTIPATH_DIR or CONFIG_DIR
@@ -22,8 +17,6 @@ OBJS := parser.o vector.o util.o debug.o time-util.o \
all: $(DEVLIB)
-make_static = $(shell sed '/^static/!s/^\([a-z]\{1,\} \)/static \1/' <$1 >$2)
-
$(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
@@ -31,11 +24,6 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(DEVLIB): $(LIBS)
$(LN) $(LIBS) $@
-$(NV_VERSION_SCRIPT): $(VERSION_SCRIPT)
- @printf 'NOVERSION {\nglobal:\n' >$@
- @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
- @printf 'local:\n\t*;\n};\n' >>$@
-
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile
index 5dbfb923..bd4ccc0d 100644
--- a/libmpathvalid/Makefile
+++ b/libmpathvalid/Makefile
@@ -1,17 +1,12 @@
include ../Makefile.inc
-SONAME = 0
-DEVLIB = libmpathvalid.so
-LIBS = $(DEVLIB).$(SONAME)
-VERSION_SCRIPT := libmpathvalid.version
-
+DEVLIB := libmpathvalid.so
CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathcmddir)
CFLAGS += $(LIB_CFLAGS)
-
LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath \
-L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd -ludev
-OBJS = mpath_valid.o
+OBJS := mpath_valid.o
all: $(LIBS)
@@ -20,11 +15,6 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT)
-Wl,--version-script=$(VERSION_SCRIPT)
$(LN) $(LIBS) $(DEVLIB)
-$(NV_VERSION_SCRIPT): $(VERSION_SCRIPT)
- @printf 'NOVERSION {\nglobal:\n' >$@
- @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
- @printf 'local:\n\t*;\n};\n' >>$@
-
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 009f26a3..9dc229ae 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -3,14 +3,9 @@
#
include ../Makefile.inc
-SONAME = 0
-DEVLIB = libmultipath.so
-LIBS = $(DEVLIB).$(SONAME)
-VERSION_SCRIPT := libmultipath.version
-
+DEVLIB := libmultipath.so
CPPFLAGS += -I$(mpathutildir) -I$(mpathcmddir) -I$(nvmedir) -D_GNU_SOURCE $(SYSTEMD_CPPFLAGS)
CFLAGS += $(LIB_CFLAGS)
-
LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd \
-lurcu -laio $(SYSTEMD_LIBDEPS)
@@ -85,11 +80,6 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(DEVLIB): $(LIBS)
$(LN) $(LIBS) $@
-$(NV_VERSION_SCRIPT): $(VERSION_SCRIPT)
- @printf 'NOVERSION {\nglobal:\n' >$@
- @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
- @printf 'local:\n\t*;\n};\n' >>$@
-
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)

View File

@ -1,168 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 18:45:11 +0200
Subject: [PATCH] libmultipath, multipathd: log failure setting sysfs
attributes
Failure to set a sysfs attribute is worth noting, normally.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 18 ++++++++++++++---
multipathd/fpin_handlers.c | 11 +++++++++--
multipathd/main.c | 40 ++++++++++++++++++++++++++++++--------
3 files changed, 56 insertions(+), 13 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 0607dbac..4427f910 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -489,9 +489,15 @@ void trigger_partitions_udev_change(struct udev_device *dev,
devtype = udev_device_get_devtype(part);
if (devtype && !strcmp("partition", devtype)) {
+ ssize_t ret;
+
condlog(4, "%s: triggering %s event for %s", __func__,
action, syspath);
- sysfs_attr_set_value(part, "uevent", action, len);
+ ret = sysfs_attr_set_value(part, "uevent", action, len);
+ if (ret != len)
+ log_sysfs_attr_set_value(2, ret,
+ "%s: failed to trigger %s uevent",
+ syspath, action);
}
udev_device_unref(part);
}
@@ -510,6 +516,7 @@ trigger_path_udev_change(struct path *pp, bool is_mpath)
*/
const char *action = is_mpath ? "change" : "add";
const char *env;
+ ssize_t len, ret;
if (!pp->udev)
return;
@@ -536,8 +543,13 @@ trigger_path_udev_change(struct path *pp, bool is_mpath)
condlog(3, "triggering %s uevent for %s (is %smultipath member)",
action, pp->dev, is_mpath ? "" : "no ");
- sysfs_attr_set_value(pp->udev, "uevent",
- action, strlen(action));
+
+ len = strlen(action);
+ ret = sysfs_attr_set_value(pp->udev, "uevent", action, len);
+ if (ret != len)
+ log_sysfs_attr_set_value(2, ret,
+ "%s: failed to trigger %s uevent",
+ pp->dev, action);
trigger_partitions_udev_change(pp->udev, action,
strlen(action));
}
diff --git a/multipathd/fpin_handlers.c b/multipathd/fpin_handlers.c
index 384ae318..00195721 100644
--- a/multipathd/fpin_handlers.c
+++ b/multipathd/fpin_handlers.c
@@ -172,8 +172,15 @@ fpin_els_add_li_frame(struct fc_nl_event *fc_event)
/*Sets the rport port_state to marginal*/
static void fpin_set_rport_marginal(struct udev_device *rport_dev)
{
- sysfs_attr_set_value(rport_dev, "port_state",
- "Marginal", strlen("Marginal"));
+ static const char marginal[] = "Marginal";
+ ssize_t ret;
+
+ ret = sysfs_attr_set_value(rport_dev, "port_state",
+ marginal, sizeof(marginal) - 1);
+ if (ret != sizeof(marginal) - 1)
+ log_sysfs_attr_set_value(2, ret,
+ "%s: failed to set port_state to marginal",
+ udev_device_get_syspath(rport_dev));
}
/*Add the marginal devices info into the list*/
diff --git a/multipathd/main.c b/multipathd/main.c
index 68eca925..a160c824 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -911,14 +911,22 @@ rescan_path(struct udev_device *ud)
{
ud = udev_device_get_parent_with_subsystem_devtype(ud, "scsi",
"scsi_device");
- if (ud)
- sysfs_attr_set_value(ud, "rescan", "1", strlen("1"));
+ if (ud) {
+ ssize_t ret =
+ sysfs_attr_set_value(ud, "rescan", "1", strlen("1"));
+ if (ret != strlen("1"))
+ log_sysfs_attr_set_value(1, ret,
+ "%s: failed to trigger rescan",
+ udev_device_get_syspath(ud));
+ }
}
void
handle_path_wwid_change(struct path *pp, struct vectors *vecs)
{
struct udev_device *udd;
+ static const char add[] = "add";
+ ssize_t ret;
if (!pp || !pp->udev)
return;
@@ -929,8 +937,12 @@ handle_path_wwid_change(struct path *pp, struct vectors *vecs)
dm_fail_path(pp->mpp->alias, pp->dev_t);
}
rescan_path(udd);
- sysfs_attr_set_value(udd, "uevent", "add", strlen("add"));
+ ret = sysfs_attr_set_value(udd, "uevent", add, sizeof(add) - 1);
udev_device_unref(udd);
+ if (ret != sizeof(add) - 1)
+ log_sysfs_attr_set_value(1, ret,
+ "%s: failed to trigger add event",
+ pp->dev);
}
bool
@@ -2003,9 +2015,14 @@ partial_retrigger_tick(vector pathvec)
--pp->partial_retrigger_delay == 0) {
const char *msg = udev_device_get_is_initialized(pp->udev) ?
"change" : "add";
-
- sysfs_attr_set_value(pp->udev, "uevent", msg,
- strlen(msg));
+ ssize_t len = strlen(msg);
+ ssize_t ret = sysfs_attr_set_value(pp->udev, "uevent", msg,
+ len);
+
+ if (len != ret)
+ log_sysfs_attr_set_value(2, ret,
+ "%s: failed to trigger %s event",
+ pp->dev, msg);
}
}
}
@@ -2245,12 +2262,19 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks)
if (!pp->mpp && pp->initialized == INIT_MISSING_UDEV) {
if (pp->retriggers < retrigger_tries) {
+ static const char change[] = "change";
+ ssize_t ret;
+
condlog(2, "%s: triggering change event to reinitialize",
pp->dev);
pp->initialized = INIT_REQUESTED_UDEV;
pp->retriggers++;
- sysfs_attr_set_value(pp->udev, "uevent", "change",
- strlen("change"));
+ ret = sysfs_attr_set_value(pp->udev, "uevent", change,
+ sizeof(change) - 1);
+ if (ret != sizeof(change) - 1)
+ log_sysfs_attr_set_value(1, ret,
+ "%s: failed to trigger change event",
+ pp->dev);
return 0;
} else {
condlog(1, "%s: not initialized after %d udev retriggers",

View File

@ -0,0 +1,172 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 22:18:22 +0200
Subject: [PATCH] multipath-tools: Makefiles: move common code to rules.mk
The library Makefiles contain a lot of similar rules. Just
maintain them in a single file.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathcmd/Makefile | 13 +------------
libmpathpersist/Makefile | 13 +------------
libmpathutil/Makefile | 13 +------------
libmpathvalid/Makefile | 13 ++-----------
libmultipath/Makefile | 16 ++--------------
rules.mk | 15 +++++++++++++++
6 files changed, 22 insertions(+), 61 deletions(-)
create mode 100644 rules.mk
diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
index f705c7f0..cfb202b8 100644
--- a/libmpathcmd/Makefile
+++ b/libmpathcmd/Makefile
@@ -6,18 +6,7 @@ OBJS := mpath_cmd.o
all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
+include $(TOPDIR)/rules.mk
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
index 6f69168f..94672556 100644
--- a/libmpathpersist/Makefile
+++ b/libmpathpersist/Makefile
@@ -9,18 +9,7 @@ OBJS := mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o mpath_persist_int.o
all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
+include $(TOPDIR)/rules.mk
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index 5665af28..5ab33c09 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -17,18 +17,7 @@ OBJS := parser.o vector.o util.o debug.o time-util.o \
all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
+include $(TOPDIR)/rules.mk
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile
index bd4ccc0d..88034df3 100644
--- a/libmpathvalid/Makefile
+++ b/libmpathvalid/Makefile
@@ -8,18 +8,9 @@ LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath \
OBJS := mpath_valid.o
-all: $(LIBS)
+all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) \
- -Wl,--version-script=$(VERSION_SCRIPT)
- $(LN) $(LIBS) $(DEVLIB)
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
+include $(TOPDIR)/rules.mk
install: $(LIBS)
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 9dc229ae..e24eab8a 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -56,6 +56,8 @@ OBJS := $(OBJS-O) $(OBJS-U)
all: $(DEVLIB)
+include $(TOPDIR)/rules.mk
+
nvme-lib.o: nvme-lib.c nvme-ioctl.c nvme-ioctl.h
$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-function -c -o $@ $<
@@ -72,20 +74,6 @@ nvme-ioctl.c: nvme/nvme-ioctl.c
nvme-ioctl.h: nvme/nvme-ioctl.h
$(call make_static,$<,$@)
-
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
-
../tests/$(LIBS): $(OBJS-O) $(OBJS-T) $(VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \
-o $@ $(OBJS-O) $(OBJS-T) $(LIBDEPS)
diff --git a/rules.mk b/rules.mk
new file mode 100644
index 00000000..c1d80820
--- /dev/null
+++ b/rules.mk
@@ -0,0 +1,15 @@
+# Copyright (c) SUSE LLC
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+$(DEVLIB): $(LIBS)
+ $(LN) $(LIBS) $@
+
+$(LIBS): $(OBJS) $(VERSION_SCRIPT)
+ $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
+ -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
+
+$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
+ $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
+ -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
+
+abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)

View File

@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 23:18:07 +0200
Subject: [PATCH] multipath tests: expect_condlog: skip depending on verbosity
otherwise we'll get failures if verbosity level is low.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
tests/test-log.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/test-log.c b/tests/test-log.c
index 14f25b9b..0c17cd96 100644
--- a/tests/test-log.c
+++ b/tests/test-log.c
@@ -6,6 +6,8 @@
#include <cmocka.h>
#include "log.h"
#include "test-log.h"
+#include "debug.h"
+
__attribute__((format(printf, 2, 0)))
void __wrap_dlog (int prio, const char * fmt, ...)
@@ -24,6 +26,8 @@ void __wrap_dlog (int prio, const char * fmt, ...)
void expect_condlog(int prio, char *string)
{
+ if (prio > MAX_VERBOSITY || prio > libmp_verbosity)
+ return;
expect_value(__wrap_dlog, prio, prio);
will_return(__wrap_dlog, string);
}

View File

@ -0,0 +1,603 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 00:01:46 +0200
Subject: [PATCH] multipath-tools Makefiles: create config.mk
Rather than running the test scripts for certain system features
every time "make" is called, save the configuration in "config.mk"
and "libmultipath/autoconfig.h", and reuse it later. This reduces
build time, especially in subsequent builds, and the build output is
less garbled by compiler options.
It works by invoking the separate make file "create-config.mk" at
the beginning of the build process. Most of the complex makefile
functions are moved to "create-config.mk".
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/foreign.yaml | 2 +-
.gitignore | 2 +
Makefile | 19 +++-
Makefile.inc | 76 +--------------
create-config.mk | 144 +++++++++++++++++++++++++++++
kpartx/Makefile | 4 -
kpartx/devmapper.c | 1 +
kpartx/kpartx.c | 1 +
libdmmp/test/Makefile | 1 +
libmultipath/Makefile | 30 +-----
libmultipath/devmapper.h | 2 +-
libmultipath/dict.c | 1 +
libmultipath/prioritizers/Makefile | 2 +-
libmultipath/propsel.c | 1 +
libmultipath/uevent.c | 1 +
multipathd/Makefile | 11 ---
multipathd/fpin.h | 1 +
multipathd/main.c | 1 +
rules.mk | 3 +
tests/Makefile | 8 --
20 files changed, 179 insertions(+), 132 deletions(-)
create mode 100644 create-config.mk
diff --git a/.github/workflows/foreign.yaml b/.github/workflows/foreign.yaml
index bd4e9c12..5a19913a 100644
--- a/.github/workflows/foreign.yaml
+++ b/.github/workflows/foreign.yaml
@@ -30,7 +30,7 @@ jobs:
if: ${{ matrix.arch != '' && matrix.arch != '-i386' }}
run: >
tar cfv binaries.tar
- Makefile*
+ Makefile* config.mk
libmpathcmd/*.so* libmultipath/*.so* libmpathutil/*.so*
libmultipath/checkers/*.so libmultipath/prioritizers/*.so
libmultipath/foreign/*.so
diff --git a/.gitignore b/.gitignore
index 83f8a552..535353e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
*.gz
*.d
\#*
+config.mk
cscope.files
cscope.out
kpartx/kpartx
@@ -35,5 +36,6 @@ tests/*.out
tests/*.vgr
libmultipath/nvme-ioctl.c
libmultipath/nvme-ioctl.h
+libmultipath/autoconfig.h
*/*-nv.version
reference-abi
diff --git a/Makefile b/Makefile
index 27b4641f..1b28db62 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,14 @@ BUILDDIRS.clean := $(BUILDDIRS:=.clean) tests.clean
all: $(BUILDDIRS)
-$(BUILDDIRS):
+config.mk libmultipath/autoconfig.h:
+ @$(MAKE) -f create-config.mk
+ @echo ==== config.mk ====
+ @cat config.mk
+ @echo ==== autoconfig.h ====
+ @cat libmultipath/autoconfig.h
+
+$(BUILDDIRS): config.mk
$(MAKE) -C $@
$(LIB_BUILDDIRS:=.abi): $(LIB_BUILDDIRS)
@@ -83,7 +90,7 @@ libmultipath/checkers.install \
libmultipath/prioritizers.install \
libmultipath/foreign.install: libmultipath.install
-$(BUILDDIRS.clean):
+%.clean:
$(MAKE) -C ${@:.clean=} clean
%.install: %
@@ -92,8 +99,12 @@ $(BUILDDIRS.clean):
$(BUILDDIRS:=.uninstall):
$(MAKE) -C ${@:.uninstall=} uninstall
-clean: $(BUILDDIRS.clean)
- rm -rf abi abi.tar.gz abi-test compile_commands.json
+# If config.mk is missing, "make clean" in subdir either fails, or tries to
+# build it. Both is undesirable. Avoid it by creating config.mk temporarily.
+clean:
+ @touch config.mk
+ $(MAKE) $(BUILDDIRS:=.clean) tests.clean || true
+ rm -rf abi abi.tar.gz abi-test compile_commands.json config.mk
install: $(BUILDDIRS:=.install)
uninstall: $(BUILDDIRS:=.uninstall)
diff --git a/Makefile.inc b/Makefile.inc
index fe6bc088..415634f5 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -27,9 +27,9 @@ PKGCONFIG ?= pkg-config
ifeq ($(TOPDIR),)
TOPDIR = ..
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')))
+ifneq ($(CREATE_CONFIG),1)
+include $(TOPDIR)/config.mk
+endif
# Paths. All these can be overridden on the "make" command line.
prefix :=
@@ -65,37 +65,6 @@ RM := rm -f
LN := ln -sf
INSTALL_PROGRAM := install
-# $(call TEST_CC_OPTION,option,fallback)
-# Test if the C compiler supports the option.
-# Evaluates to "option" if yes, and "fallback" otherwise.
-TEST_CC_OPTION = $(shell \
- if echo 'int main(void){return 0;}' | \
- $(CC) -o /dev/null -c -Werror "$(1)" -xc - >/dev/null 2>&1; \
- then \
- echo "$(1)"; \
- else \
- echo "$(2)"; \
- fi)
-
-# "make" on some distros will fail on explicit '#' or '\#' in the program text below
-__HASH__ := \#
-# Check if _DFORTIFY_SOURCE=3 is supported.
-# On some distros (e.g. Debian Buster) it will be falsely reported as supported
-# but it doesn't seem to make a difference wrt the compilation result.
-FORTIFY_OPT := $(shell \
- if /bin/echo -e '$(__HASH__)include <string.h>\nint main(void) { return 0; }' | \
- $(CC) -o /dev/null -c -O2 -Werror -D_FORTIFY_SOURCE=3 -xc - 2>/dev/null; \
- then \
- echo "-D_FORTIFY_SOURCE=3"; \
- else \
- echo "-D_FORTIFY_SOURCE=2"; \
- fi)
-
-STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
-ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)
-WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
-WFORMATOVERFLOW := $(call TEST_CC_OPTION,-Wformat-overflow=2,)
-
SYSTEMD_CPPFLAGS := $(if $(SYSTEMD),-DUSE_SYSTEMD=$(SYSTEMD))
SYSTEMD_LIBDEPS := $(if $(SYSTEMD),$(if $(shell test $(SYSTEMD) -gt 209 && echo 1),-lsystemd,-lsystemd-daemon))
@@ -133,45 +102,6 @@ LIBS = $(DEVLIB).$(SONAME)
VERSION_SCRIPT = $(DEVLIB:%.so=%.version)
NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
-# Check whether a function with name $1 has been declared in header file $2.
-check_func = $(shell \
- if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
- found=1; \
- status="yes"; \
- else \
- found=0; \
- status="no"; \
- fi; \
- echo 1>&2 "Checking for $1 in $2 ... $$status"; \
- echo "$$found" \
- )
-
-# Checker whether a file with name $1 exists
-check_file = $(shell \
- if [ -f "$1" ]; then \
- found=1; \
- status="yes"; \
- else \
- found=0; \
- status="no"; \
- fi; \
- echo 1>&2 "Checking if $1 exists ... $$status"; \
- echo "$$found" \
- )
-
-# Check whether a file contains a variable with name $1 in header file $2
-check_var = $(shell \
- if grep -Eq "(^|[[:blank:]])$1([[:blank:]]|=|$$)" "$2"; then \
- found=1; \
- status="yes"; \
- else \
- found=0; \
- status="no"; \
- fi; \
- echo 1>&2 "Checking for $1 in $2 ... $$status"; \
- echo "$$found" \
- )
-
%.o: %.c
@echo building $@ because of $?
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
diff --git a/create-config.mk b/create-config.mk
new file mode 100644
index 00000000..2cc5284f
--- /dev/null
+++ b/create-config.mk
@@ -0,0 +1,144 @@
+# Copyright (c) SUSE LLC
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+TOPDIR := .
+CREATE_CONFIG := 1
+include $(TOPDIR)/Makefile.inc
+
+# Check whether a function with name $1 has been declared in header file $2.
+check_func = $(shell \
+ if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
+ found=1; \
+ status="yes"; \
+ else \
+ found=0; \
+ status="no"; \
+ fi; \
+ echo 1>&2 "Checking for $1 in $2 ... $$status"; \
+ echo "$$found" \
+ )
+
+# Checker whether a file with name $1 exists
+check_file = $(shell \
+ if [ -f "$1" ]; then \
+ found=1; \
+ status="yes"; \
+ else \
+ found=0; \
+ status="no"; \
+ fi; \
+ echo 1>&2 "Checking if $1 exists ... $$status"; \
+ echo "$$found" \
+ )
+
+# Check whether a file contains a variable with name $1 in header file $2
+check_var = $(shell \
+ if grep -Eq "(^|[[:blank:]])$1([[:blank:]]|=|$$)" "$2"; then \
+ found=1; \
+ status="yes"; \
+ else \
+ found=0; \
+ status="no"; \
+ fi; \
+ echo 1>&2 "Checking for $1 in $2 ... $$status"; \
+ echo "$$found" \
+ )
+
+# Test special behavior of gcc 4.8 with nested initializers
+# gcc 4.8 compiles blacklist.c only with -Wno-missing-field-initializers
+TEST_MISSING_INITIALIZERS = $(shell \
+ echo 'struct A {int a, b;}; struct B {struct A a; int b;} b = {.a.a=1};' | \
+ $(CC) -c -Werror -Wmissing-field-initializers -o /dev/null -xc - >/dev/null 2>&1 \
+ || echo -Wno-missing-field-initializers)
+
+DEFINES :=
+
+ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
+ DEFINES += LIBDM_API_FLUSH
+endif
+
+ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
+ DEFINES += LIBDM_API_GET_ERRNO
+endif
+
+ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
+ DEFINES += LIBDM_API_COOKIE
+endif
+
+ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(libudev_incdir)/libudev.h),0)
+ DEFINES += LIBUDEV_API_RECVBUF
+endif
+
+ifneq ($(call check_func,dm_task_deferred_remove,$(devmapper_incdir)/libdevmapper.h),0)
+ DEFINES += LIBDM_API_DEFERRED
+endif
+
+ifneq ($(call check_func,dm_hold_control_dev,$(devmapper_incdir)/libdevmapper.h),0)
+ DEFINES += LIBDM_API_HOLD_CONTROL
+endif
+
+ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
+ DEFINES += FPIN_EVENT_HANDLER
+ FPIN_SUPPORT = 1
+endif
+
+ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0)
+ ANA_SUPPORT := 1
+endif
+
+ifeq ($(ENABLE_DMEVENTS_POLL),0)
+ DEFINES += -DNO_DMEVENTS_POLL
+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')))
+
+
+# $(call TEST_CC_OPTION,option,fallback)
+# Test if the C compiler supports the option.
+# Evaluates to "option" if yes, and "fallback" otherwise.
+TEST_CC_OPTION = $(shell \
+ if echo 'int main(void){return 0;}' | \
+ $(CC) -o /dev/null -c -Werror "$(1)" -xc - >/dev/null 2>&1; \
+ then \
+ echo "$(1)"; \
+ else \
+ echo "$(2)"; \
+ fi)
+
+# "make" on some distros will fail on explicit '#' or '\#' in the program text below
+__HASH__ := \#
+# Check if _DFORTIFY_SOURCE=3 is supported.
+# On some distros (e.g. Debian Buster) it will be falsely reported as supported
+# but it doesn't seem to make a difference wrt the compilation result.
+FORTIFY_OPT := $(shell \
+ if /bin/echo -e '$(__HASH__)include <string.h>\nint main(void) { return 0; }' | \
+ $(CC) -o /dev/null -c -O2 -Werror -D_FORTIFY_SOURCE=3 -xc - 2>/dev/null; \
+ then \
+ echo "-D_FORTIFY_SOURCE=3"; \
+ else \
+ echo "-D_FORTIFY_SOURCE=2"; \
+ fi)
+
+STACKPROT :=
+
+all: $(multipathdir)/autoconfig.h $(TOPDIR)/config.mk
+
+$(multipathdir)/autoconfig.h:
+ @echo creating $@
+ @echo '#ifndef _AUTOCONFIG_H' >$@
+ @echo '#define _AUTOCONFIG_H' >>$@
+ @for x in $(DEFINES); do echo "#define $$x" >>$@; done
+ @echo '#endif' >>$@
+
+$(TOPDIR)/config.mk:
+ @echo creating $@
+ @echo "FPIN_SUPPORT := $(FPIN_SUPPORT)" >$@
+ @echo "FORTIFY_OPT := $(FORTIFY_OPT)" >>$@
+ @echo "SYSTEMD := $(SYSTEMD)" >>$@
+ @echo "ANA_SUPPORT := $(ANA_SUPPORT)" >>$@
+ @echo "STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)" >>$@
+ @echo "ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)" >>$@
+ @echo "WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)" >>$@
+ @echo "WFORMATOVERFLOW := $(call TEST_CC_OPTION,-Wformat-overflow=2,)" >>$@
+ @echo "W_MISSING_INITIALIZERS := $(call TEST_MISSING_INITIALIZERS)" >>$@
diff --git a/kpartx/Makefile b/kpartx/Makefile
index 7ceae96b..31b1138a 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -6,10 +6,6 @@ include ../Makefile.inc
EXEC := kpartx
CPPFLAGS += -I. -I$(multipathdir) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_COOKIE
-endif
-
CFLAGS += $(BIN_CFLAGS)
LDFLAGS += $(BIN_LDFLAGS)
LIBDEPS += -ldevmapper
diff --git a/kpartx/devmapper.c b/kpartx/devmapper.c
index bf14c784..f12762c5 100644
--- a/kpartx/devmapper.c
+++ b/kpartx/devmapper.c
@@ -9,6 +9,7 @@
#include <ctype.h>
#include <errno.h>
#include <sys/sysmacros.h>
+#include "autoconfig.h"
#include "devmapper.h"
#include "kpartx.h"
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
index 1d568c9e..46cb76ba 100644
--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -34,6 +34,7 @@
#include <ctype.h>
#include <libdevmapper.h>
+#include "autoconfig.h"
#include "devmapper.h"
#include "crc32.h"
#include "lopart.h"
diff --git a/libdmmp/test/Makefile b/libdmmp/test/Makefile
index 76b24d61..93de64a0 100644
--- a/libdmmp/test/Makefile
+++ b/libdmmp/test/Makefile
@@ -2,6 +2,7 @@
#
# Copyright (C) 2015-2016 Gris Ge <fge@redhat.com>
#
+TOPDIR := ../..
include ../../Makefile.inc
_libdmmpdir=../$(libdmmpdir)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index e24eab8a..1cc13577 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -9,34 +9,6 @@ CFLAGS += $(LIB_CFLAGS)
LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd \
-lurcu -laio $(SYSTEMD_LIBDEPS)
-ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_FLUSH
-endif
-
-ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_GET_ERRNO
-endif
-
-ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_COOKIE
-endif
-
-ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(libudev_incdir)/libudev.h),0)
- CPPFLAGS += -DLIBUDEV_API_RECVBUF
-endif
-
-ifneq ($(call check_func,dm_task_deferred_remove,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_DEFERRED
-endif
-
-ifneq ($(call check_func,dm_hold_control_dev,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_HOLD_CONTROL
-endif
-
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
- CPPFLAGS += -DFPIN_EVENT_HANDLER
-endif
-
# object files referencing MULTIPATH_DIR or CONFIG_DIR
# they need to be recompiled for unit tests
OBJS-U := prio.o checkers.o foreign.o config.o
@@ -97,7 +69,7 @@ uninstall:
$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h $(NV_VERSION_SCRIPT)
+ $(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h autoconfig.h $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h
index 703f3bf8..42f8eccd 100644
--- a/libmultipath/devmapper.h
+++ b/libmultipath/devmapper.h
@@ -1,6 +1,6 @@
#ifndef _DEVMAPPER_H
#define _DEVMAPPER_H
-
+#include "autoconfig.h"
#include "structs.h"
#define TGT_MPATH "multipath"
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index aa93fe43..6fc77315 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <inttypes.h>
#include <libudev.h>
+#include "autoconfig.h"
#include "mpath_cmd.h"
#include "dict.h"
#include "strbuf.h"
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index 72eefe49..a699e8a6 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -26,7 +26,7 @@ LIBS = \
libpriopath_latency.so \
libpriosysfs.so
-ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0)
+ifneq ($(ANA_SUPPORT),1)
LIBS += libprioana.so
CPPFLAGS += -I../nvme
endif
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index d4f19897..d1d5cc25 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -5,6 +5,7 @@
*/
#include <stdio.h>
+#include "autoconfig.h"
#include "nvme-lib.h"
#include "checkers.h"
#include "vector.h"
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 57447ca0..bbc8e9e5 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -42,6 +42,7 @@
#include <sys/time.h>
#include <libudev.h>
+#include "autoconfig.h"
#include "debug.h"
#include "list.h"
#include "uevent.h"
diff --git a/multipathd/Makefile b/multipathd/Makefile
index bb8f7770..587bb916 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -8,17 +8,6 @@ CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcm
awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') \
-DBINDIR='"$(bindir)"' $(SYSTEMD_CPPFLAGS)
-ifeq ($(ENABLE_DMEVENTS_POLL),0)
- CPPFLAGS += -DNO_DMEVENTS_POLL
-endif
-ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_GET_ERRNO
-endif
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
- CPPFLAGS += -DFPIN_EVENT_HANDLER
- FPIN_SUPPORT = 1
-endif
-
#
# debugging stuff
#
diff --git a/multipathd/fpin.h b/multipathd/fpin.h
index bfcc1ce2..3c374441 100644
--- a/multipathd/fpin.h
+++ b/multipathd/fpin.h
@@ -1,5 +1,6 @@
#ifndef __FPIN_H__
#define __FPIN_H__
+#include "autoconfig.h"
#ifdef FPIN_EVENT_HANDLER
void *fpin_fabric_notification_receiver(void *unused);
diff --git a/multipathd/main.c b/multipathd/main.c
index ba52d393..1e1b254f 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -4,6 +4,7 @@
* Copyright (c) 2005 Benjamin Marzinski, Redhat
* Copyright (c) 2005 Edward Goggin, EMC
*/
+#include "autoconfig.h"
#include <unistd.h>
#include <sys/stat.h>
#include <libdevmapper.h>
diff --git a/rules.mk b/rules.mk
index c1d80820..d8612527 100644
--- a/rules.mk
+++ b/rules.mk
@@ -13,3 +13,6 @@ $(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
+
+$(TOPDIR)/config.mk $(multipathdir)/autoconfig.h:
+ $(MAKE) -C $(TOPDIR) -f create-config.mk
diff --git a/tests/Makefile b/tests/Makefile
index 3a5b161c..d9856d17 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -3,14 +3,6 @@ include ../Makefile.inc
# directory where to run the tests
TESTDIR := $(CURDIR)
-# Test special behavior of gcc 4.8 with nested initializers
-# gcc 4.8 compiles blacklist.c only with -Wno-missing-field-initializers
-TEST_MISSING_INITIALIZERS = $(shell \
- echo 'struct A {int a, b;}; struct B {struct A a; int b;} b = {.a.a=1};' | \
- $(CC) -c -Werror -Wmissing-field-initializers -o /dev/null -xc - >/dev/null 2>&1 \
- || echo -Wno-missing-field-initializers)
-W_MISSING_INITIALIZERS := $(call TEST_MISSING_INITIALIZERS)
-
CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathcmddir) -I$(daemondir) \
-DTESTCONFDIR=\"$(TESTDIR)/conf.d\"
CFLAGS += $(BIN_CFLAGS) -Wno-unused-parameter $(W_MISSING_INITIALIZERS)

View File

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 6 Jul 2022 11:15:27 +0200
Subject: [PATCH] multipath tests: __wrap_dlog: print log message
This makes it easier to analyze errors from __wrap_dlog().
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
tests/test-log.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/test-log.c b/tests/test-log.c
index 0c17cd96..c1745872 100644
--- a/tests/test-log.c
+++ b/tests/test-log.c
@@ -20,6 +20,7 @@ void __wrap_dlog (int prio, const char * fmt, ...)
va_start(ap, fmt);
vsnprintf(buff, MAX_MSG_SIZE, fmt, ap);
va_end(ap);
+ fprintf(stderr, "%s(%d): %s", __func__, prio, buff);
expected = mock_ptr_type(char *);
assert_memory_equal(buff, expected, strlen(expected));
}

View File

@ -0,0 +1,879 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 12:39:06 +0200
Subject: [PATCH] multipath-tools Makefiles: enable quiet build
Like many other projects, make it possible to print much less
output during build. Verbose output is enabled with "make V=1", as
usual.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile | 12 +++----
Makefile.inc | 10 +++---
kpartx/Makefile | 41 ++++++++++++-----------
libdmmp/Makefile | 48 +++++++++++++-------------
libdmmp/test/Makefile | 8 ++---
libmpathcmd/Makefile | 20 +++++------
libmpathpersist/Makefile | 32 +++++++++---------
libmpathutil/Makefile | 14 ++++----
libmpathvalid/Makefile | 20 +++++------
libmultipath/Makefile | 30 ++++++++---------
libmultipath/checkers/Makefile | 8 ++---
libmultipath/foreign/Makefile | 8 ++---
libmultipath/prioritizers/Makefile | 8 ++---
mpathpersist/Makefile | 18 +++++-----
multipath/Makefile | 54 ++++++++++++++++--------------
multipathd/Makefile | 42 ++++++++++++-----------
rules.mk | 8 ++---
tests/Makefile | 23 +++++++------
18 files changed, 206 insertions(+), 198 deletions(-)
diff --git a/Makefile b/Makefile
index 1b28db62..e3ce1a8d 100644
--- a/Makefile
+++ b/Makefile
@@ -38,17 +38,17 @@ config.mk libmultipath/autoconfig.h:
@cat libmultipath/autoconfig.h
$(BUILDDIRS): config.mk
- $(MAKE) -C $@
+ @$(MAKE) -C $@
$(LIB_BUILDDIRS:=.abi): $(LIB_BUILDDIRS)
- $(MAKE) -C ${@:.abi=} abi
+ @$(MAKE) -C ${@:.abi=} abi
# Create formal representation of the ABI
# Useful for verifying ABI compatibility
# Requires abidw from the abigail suite (https://sourceware.org/libabigail/)
.PHONY: abi
abi: $(LIB_BUILDDIRS:=.abi)
- mkdir -p $@
+ @mkdir -p $@
ln -ft $@ $(LIB_BUILDDIRS:=/*.abi)
abi.tar.gz: abi
@@ -91,13 +91,13 @@ libmultipath/checkers.install \
libmultipath/foreign.install: libmultipath.install
%.clean:
- $(MAKE) -C ${@:.clean=} clean
+ @$(MAKE) -C ${@:.clean=} clean
%.install: %
- $(MAKE) -C ${@:.install=} install
+ @$(MAKE) -C ${@:.install=} install
$(BUILDDIRS:=.uninstall):
- $(MAKE) -C ${@:.uninstall=} uninstall
+ @$(MAKE) -C ${@:.uninstall=} uninstall
# If config.mk is missing, "make clean" in subdir either fails, or tries to
# build it. Both is undesirable. Avoid it by creating config.mk temporarily.
diff --git a/Makefile.inc b/Makefile.inc
index 415634f5..3e14cb8c 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -1,4 +1,4 @@
-#
+# -*- Makefile -*-
# Copyright (C) 2004 Christophe Varoqui, <christophe.varoqui@opensvc.com>
#
@@ -60,6 +60,8 @@ devmapper_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir devmapper),/
libudev_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir libudev),/usr/include)
kernel_incdir := /usr/include
+Q := $(if $(V),,@)
+
GZIP_PROG := gzip -9 -c
RM := rm -f
LN := ln -sf
@@ -104,13 +106,13 @@ NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
%.o: %.c
@echo building $@ because of $?
- $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
%.abi: %.so.0
- abidw $< >$@
+ $(Q)abidw $< >$@
%.abi: %.so
- abidw $< >$@
+ $(Q)abidw $< >$@
%-nv.version: %.version
@echo creating $@ from $<
diff --git a/kpartx/Makefile b/kpartx/Makefile
index 31b1138a..7720a740 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -16,33 +16,34 @@ OBJS := bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \
all: $(EXEC)
$(EXEC): $(OBJS)
- $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS)
+ @echo building $@ because of $?
+ $(Q)$(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS)
install: $(EXEC) $(EXEC).8
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)
- $(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir)
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)/rules.d
- $(INSTALL_PROGRAM) -m 644 dm-parts.rules $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
- $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
- $(INSTALL_PROGRAM) -m 644 del-part-nodes.rules $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)/rules.d
+ $(Q)$(INSTALL_PROGRAM) -m 644 dm-parts.rules $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
+ $(Q)$(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
+ $(Q)$(INSTALL_PROGRAM) -m 644 del-part-nodes.rules $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
uninstall:
- $(RM) $(DESTDIR)$(bindir)/$(EXEC)
- $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
- $(RM) $(DESTDIR)$(libudevdir)/kpartx_id
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/67-kpartx-compat.rules
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules
+ $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC)
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/kpartx_id
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/67-kpartx-compat.rules
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules
clean: dep_clean
- $(RM) core *.o $(EXEC)
+ $(Q)$(RM) core *.o $(EXEC)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libdmmp/Makefile b/libdmmp/Makefile
index 67b6f86f..7693facb 100644
--- a/libdmmp/Makefile
+++ b/libdmmp/Makefile
@@ -23,62 +23,62 @@ all: $(LIBS) doc
.PHONY: doc clean install uninstall check speed_test dep_clean
$(LIBS): $(OBJS)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
+ $(Q)$(LN) $(LIBS) $@
abi: $(DEVLIB:%.so=%.abi)
install:
- mkdir -p $(DESTDIR)$(usrlibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(usrlibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 644 -D \
+ @mkdir -p $(DESTDIR)$(usrlibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(usrlibdir)/$(LIBS)
+ $(Q)$(INSTALL_PROGRAM) -m 644 -D \
$(HEADERS) $(DESTDIR)$(includedir)/$(HEADERS)
- $(LN) $(LIBS) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
- $(INSTALL_PROGRAM) -m 644 -D \
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -m 644 -D \
$(PKGFILE).in $(DESTDIR)$(pkgconfdir)/$(PKGFILE)
- perl -i -pe 's|__VERSION__|$(LIBDMMP_VERSION)|g' \
+ $(Q)perl -i -pe 's|__VERSION__|$(LIBDMMP_VERSION)|g' \
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
- perl -i -pe 's|__LIBDIR__|$(usrlibdir)|g' \
+ $(Q)perl -i -pe 's|__LIBDIR__|$(usrlibdir)|g' \
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
- perl -i -pe 's|__INCLUDEDIR__|$(includedir)|g' \
+ $(Q)perl -i -pe 's|__INCLUDEDIR__|$(includedir)|g' \
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
- $(INSTALL_PROGRAM) -d 755 $(DESTDIR)$(mandir)/man3
- $(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(mandir)/man3 docs/man/*.3
+ $(Q)$(INSTALL_PROGRAM) -d 755 $(DESTDIR)$(mandir)/man3
+ $(Q)$(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(mandir)/man3 docs/man/*.3
uninstall:
- $(RM) $(DESTDIR)$(usrlibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(includedir)/$(HEADERS)
- $(RM) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(usrlibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(includedir)/$(HEADERS)
+ $(Q)$(RM) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
@for file in $(DESTDIR)$(mandir)/man3/dmmp_*; do \
$(RM) $$file; \
done
- $(RM) $(DESTDIR)$(mandir)/man3/libdmmp.h*
- $(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE)
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man3/libdmmp.h*
+ $(Q)$(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE)
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
- $(MAKE) -C test clean
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
+ @$(MAKE) -C test clean
include $(wildcard $(OBJS:.o=.d))
check: all
- $(MAKE) -C test check
+ @$(MAKE) -C test check
speed_test: all
- $(MAKE) -C test speed_test
+ @$(MAKE) -C test speed_test
doc: docs/man/dmmp_strerror.3
docs/man/dmmp_strerror.3: $(HEADERS)
- TEMPFILE=$(shell mktemp); \
+ $(Q)TEMPFILE=$(shell mktemp); \
cat $^ | perl docs/doc-preclean.pl >$$TEMPFILE; \
LC_ALL=C \
KBUILD_BUILD_TIMESTAMP=`git log -n1 --pretty=%cd --date=iso -- $^` \
perl docs/kernel-doc -man $$TEMPFILE | \
perl docs/split-man.pl docs/man; \
- rm -f $$TEMPFILE
+ $(RM) -f $$TEMPFILE
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libdmmp/test/Makefile b/libdmmp/test/Makefile
index 93de64a0..9d0817c8 100644
--- a/libdmmp/test/Makefile
+++ b/libdmmp/test/Makefile
@@ -16,7 +16,7 @@ LDFLAGS += -L$(_libdmmpdir) -ldmmp
all: $(TEST_EXEC) $(SPD_TEST_EXEC)
check: $(TEST_EXEC) $(SPD_TEST_EXEC)
- sudo env LD_LIBRARY_PATH=$(_libdmmpdir):$(_mpathcmddir) \
+ $(Q)sudo env LD_LIBRARY_PATH=$(_libdmmpdir):$(_mpathcmddir) \
valgrind --quiet --leak-check=full \
--show-reachable=no --show-possibly-lost=no \
--trace-children=yes --error-exitcode=1 \
@@ -24,15 +24,15 @@ check: $(TEST_EXEC) $(SPD_TEST_EXEC)
$(MAKE) speed_test
speed_test: $(SPD_TEST_EXEC)
- sudo env LD_LIBRARY_PATH=$(_libdmmpdir):$(_mpathcmddir) \
+ $(Q)sudo env LD_LIBRARY_PATH=$(_libdmmpdir):$(_mpathcmddir) \
time -p ./$(SPD_TEST_EXEC)
clean: dep_clean
- rm -f $(TEST_EXEC) $(SPD_TEST_EXEC)
+ $(Q)$(RM) -f $(TEST_EXEC) $(SPD_TEST_EXEC)
OBJS = $(TEST_EXEC).o $(SPD_TEST_EXEC).o
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
index cfb202b8..be615c2f 100644
--- a/libmpathcmd/Makefile
+++ b/libmpathcmd/Makefile
@@ -9,22 +9,22 @@ all: $(DEVLIB)
include $(TOPDIR)/rules.mk
install: all
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(includedir)
- $(INSTALL_PROGRAM) -m 644 mpath_cmd.h $(DESTDIR)$(includedir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(includedir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpath_cmd.h $(DESTDIR)$(includedir)
uninstall:
- $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(RM) $(DESTDIR)$(includedir)/mpath_cmd.h
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(includedir)/mpath_cmd.h
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
index 94672556..8f9a43f6 100644
--- a/libmpathpersist/Makefile
+++ b/libmpathpersist/Makefile
@@ -12,28 +12,28 @@ all: $(DEVLIB)
include $(TOPDIR)/rules.mk
install: all
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(mandir)/man3
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
- $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_in.3 $(DESTDIR)$(mandir)/man3
- $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_out.3 $(DESTDIR)$(mandir)/man3
- $(INSTALL_PROGRAM) -m 644 mpath_persist.h $(DESTDIR)$(includedir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(mandir)/man3
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_in.3 $(DESTDIR)$(mandir)/man3
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_out.3 $(DESTDIR)$(mandir)/man3
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpath_persist.h $(DESTDIR)$(includedir)
uninstall:
- $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_in.3
- $(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_out.3
- $(RM) $(DESTDIR)$(includedir)/mpath_persist.h
- $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_in.3
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_out.3
+ $(Q)$(RM) $(DESTDIR)$(includedir)/mpath_persist.h
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index 5ab33c09..f059de14 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -20,18 +20,18 @@ all: $(DEVLIB)
include $(TOPDIR)/rules.mk
install: all
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
uninstall:
- $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h $(NV_VERSION_SCRIPT)
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile
index 88034df3..791a0398 100644
--- a/libmpathvalid/Makefile
+++ b/libmpathvalid/Makefile
@@ -13,21 +13,21 @@ all: $(DEVLIB)
include $(TOPDIR)/rules.mk
install: $(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
- $(INSTALL_PROGRAM) -m 644 mpath_valid.h $(DESTDIR)$(includedir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpath_valid.h $(DESTDIR)$(includedir)
uninstall:
- $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(RM) $(DESTDIR)$(includedir)/mpath_valid.h
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(includedir)/mpath_valid.h
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 1cc13577..3df851e2 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -31,47 +31,47 @@ all: $(DEVLIB)
include $(TOPDIR)/rules.mk
nvme-lib.o: nvme-lib.c nvme-ioctl.c nvme-ioctl.h
- $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-function -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-function -c -o $@ $<
# there are lots of "unused parameters" in dict.c
# because not all handler / snprint methods need all parameters
dict.o: dict.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
make_static = $(shell sed '/^static/!s/^\([a-z]\{1,\} \)/static \1/' <$1 >$2)
nvme-ioctl.c: nvme/nvme-ioctl.c
- $(call make_static,$<,$@)
+ $(Q)$(call make_static,$<,$@)
nvme-ioctl.h: nvme/nvme-ioctl.h
- $(call make_static,$<,$@)
+ $(Q)$(call make_static,$<,$@)
../tests/$(LIBS): $(OBJS-O) $(OBJS-T) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \
-o $@ $(OBJS-O) $(OBJS-T) $(LIBDEPS)
- $(LN) $@ ${@:.so.0=.so}
+ $(Q)$(LN) $@ ${@:.so.0=.so}
# This rule is invoked from tests/Makefile, overriding configdir and plugindir
%-test.o: %.c
@echo building $@ because of $?
- $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
test-lib: ../tests/$(LIBS)
install: all
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(plugindir)
- $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(plugindir)
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
uninstall:
- $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h autoconfig.h $(NV_VERSION_SCRIPT)
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h autoconfig.h $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile
index 39ad76e0..b3120611 100644
--- a/libmultipath/checkers/Makefile
+++ b/libmultipath/checkers/Makefile
@@ -22,16 +22,16 @@ LIBS= \
all: $(LIBS)
libcheck%.so: %.o
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
- $(RM) core *.a *.o *.gz *.so
+ $(Q)$(RM) core *.a *.o *.gz *.so
OBJS := $(LIBS:libcheck%.so=%.o)
.SECONDARY: $(OBJS)
@@ -39,4 +39,4 @@ OBJS := $(LIBS:libcheck%.so=%.o)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmultipath/foreign/Makefile b/libmultipath/foreign/Makefile
index 8bf9047b..0e245d6f 100644
--- a/libmultipath/foreign/Makefile
+++ b/libmultipath/foreign/Makefile
@@ -14,16 +14,16 @@ LIBS = libforeign-nvme.so
all: $(LIBS)
libforeign-%.so: %.o
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
- $(RM) core *.a *.o *.gz *.so
+ $(Q)$(RM) core *.a *.o *.gz *.so
OBJS := $(LIBS:libforeign-%.so=%.o)
.SECONDARY: $(OBJS)
@@ -31,4 +31,4 @@ OBJS := $(LIBS:libforeign-%.so=%.o)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index a699e8a6..e1688163 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -34,16 +34,16 @@ endif
all: $(LIBS)
libprio%.so: %.o
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install: $(LIBS)
- $(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(plugindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(plugindir)
uninstall:
for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
- $(RM) core *.a *.o *.gz *.so
+ $(Q)$(RM) core *.a *.o *.gz *.so
OBJS = $(LIBS:libprio%.so=%.o) alua_rtpg.o
.SECONDARY: $(OBJS)
@@ -51,4 +51,4 @@ OBJS = $(LIBS:libprio%.so=%.o) alua_rtpg.o
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/mpathpersist/Makefile b/mpathpersist/Makefile
index d62537b5..f57c105c 100644
--- a/mpathpersist/Makefile
+++ b/mpathpersist/Makefile
@@ -14,22 +14,22 @@ OBJS = main.o
all: $(EXEC)
$(EXEC): $(OBJS)
- $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) $(CFLAGS) $(LIBDEPS)
+ $(Q)$(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) $(CFLAGS) $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
clean: dep_clean
- $(RM) core *.o $(EXEC)
+ $(Q)$(RM) core *.o $(EXEC)
include $(wildcard $(OBJS:.o=.d))
uninstall:
- $(RM) $(DESTDIR)$(bindir)/$(EXEC)
- $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC)
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/multipath/Makefile b/multipath/Makefile
index 7f7b341d..73db991a 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -16,44 +16,46 @@ OBJS := main.o
all: $(EXEC) multipath.rules tmpfiles.conf
$(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so
- $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS)
+ @echo building $@ because of $?
+ $(Q)$(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
- $(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 multipath.rules $(DESTDIR)$(udevrulesdir)/56-multipath.rules
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(modulesloaddir)
- $(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir)
- $(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man5
- $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(mandir)/man5
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
+ $(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) -d $(DESTDIR)$(modulesloaddir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(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
ifneq ($(SCSI_DH_MODULES_PRELOAD),)
- $(INSTALL_PROGRAM) -m 644 scsi_dh.conf $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
- for _x in $(SCSI_DH_MODULES_PRELOAD); do echo "$$_x"; done \
+ $(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 \
>>$(DESTDIR)$(modulesloaddir)/scsi_dh.conf
endif
uninstall:
- $(RM) $(DESTDIR)$(bindir)/$(EXEC)
- $(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
- $(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
- $(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
- $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
- $(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5
+ $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC)
+ $(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)$(mandir)/man8/$(EXEC).8
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5
clean: dep_clean
- $(RM) core *.o $(EXEC) multipath.rules tmpfiles.conf
+ $(Q)$(RM) core *.o $(EXEC) multipath.rules tmpfiles.conf
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
%: %.in
- sed 's,@RUNTIME_DIR@,$(runtimedir),' $< >$@
+ @echo creating $@
+ $(Q)sed 's,@RUNTIME_DIR@,$(runtimedir),' $< >$@
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 587bb916..9d531329 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -45,41 +45,43 @@ endif
all : $(EXEC) $(CLI)
$(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so
- $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) $(LIBDEPS)
+ @echo building $@ because of $?
+ $(Q)$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) $(LIBDEPS)
multipathc.o: multipathc.c
- $(CC) $(CPPFLAGS) $(RL_CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(RL_CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
$(CLI): $(CLI_OBJS)
- $(CC) $(CFLAGS) $(CLI_OBJS) $(LDFLAGS) -o $@ $(CLI_LIBDEPS) $(RL_LIBDEPS)
+ @echo building $@ because of $?
+ $(Q)$(CC) $(CFLAGS) $(CLI_OBJS) $(LDFLAGS) -o $@ $(CLI_LIBDEPS) $(RL_LIBDEPS)
cli_handlers.o: cli_handlers.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
install:
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -m 755 $(CLI) $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(CLI) $(DESTDIR)$(bindir)
ifdef SYSTEMD
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(unitdir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).socket $(DESTDIR)$(unitdir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(unitdir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).socket $(DESTDIR)$(unitdir)
endif
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -m 644 $(CLI).8 $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(CLI).8 $(DESTDIR)$(mandir)/man8
uninstall:
- $(RM) $(DESTDIR)$(bindir)/$(EXEC) $(DESTDIR)$(bindir)/$(CLI)
- $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
- $(RM) $(DESTDIR)$(mandir)/man8/$(CLI).8
- $(RM) $(DESTDIR)$(unitdir)/$(EXEC).service
- $(RM) $(DESTDIR)$(unitdir)/$(EXEC).socket
+ $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC) $(DESTDIR)$(bindir)/$(CLI)
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(CLI).8
+ $(Q)$(RM) $(DESTDIR)$(unitdir)/$(EXEC).service
+ $(Q)$(RM) $(DESTDIR)$(unitdir)/$(EXEC).socket
clean: dep_clean
- $(RM) core *.o $(EXEC) $(CLI)
+ $(Q)$(RM) core *.o $(EXEC) $(CLI)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/rules.mk b/rules.mk
index d8612527..c3a8e7ac 100644
--- a/rules.mk
+++ b/rules.mk
@@ -2,17 +2,17 @@
# SPDX-License-Identifier: GPL-2.0-or-later
$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
+ $(Q)$(LN) $(LIBS) $@
$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
$(TOPDIR)/config.mk $(multipathdir)/autoconfig.h:
- $(MAKE) -C $(TOPDIR) -f create-config.mk
+ $(Q)$(MAKE) -C $(TOPDIR) -f create-config.mk
diff --git a/tests/Makefile b/tests/Makefile
index d9856d17..021da0b0 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -12,7 +12,6 @@ TESTS := uevent parser util dmevents hwtable blacklist unaligned vpd pgpolicy \
alias directio valid devt mpathvalid strbuf sysfs features cli
HELPERS := test-lib.o test-log.o
-.SILENT: $(TESTS:%=%.o)
.PRECIOUS: $(TESTS:%=%-test)
all: $(TESTS:%=%.out)
@@ -71,11 +70,12 @@ features-test_LIBDEPS := -ludev -lpthread
cli-test_OBJDEPS := $(daemondir)/cli.o
%.o: %.c
- $(CC) $(CPPFLAGS) $(CFLAGS) $($*-test_FLAGS) -c -o $@ $<
+ @echo building $@ because of $?
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $($*-test_FLAGS) -c -o $@ $<
lib/libchecktur.so:
- mkdir -p lib
- cd lib && ln -s ../$(multipathdir)/*/*.so .
+ @mkdir -p lib
+ $(Q)cd lib && ln -s ../$(multipathdir)/*/*.so .
%.out: %-test lib/libchecktur.so
@echo == running $< ==
@@ -89,34 +89,35 @@ lib/libchecktur.so:
OBJS = $(TESTS:%=%.o) $(HELPERS)
test_clean:
- $(RM) $(TESTS:%=%.out) $(TESTS:%=%.vgr) *.so*
+ $(Q)$(RM) $(TESTS:%=%.out) $(TESTS:%=%.vgr) *.so*
valgrind_clean:
- $(RM) $(TESTS:%=%.vgr)
+ $(Q)$(RM) $(TESTS:%=%.vgr)
clean: test_clean valgrind_clean dep_clean
- $(RM) $(TESTS:%=%-test) $(OBJS) *.o.wrap
- $(RM) -rf lib conf.d
+ $(Q)$(RM) $(TESTS:%=%-test) $(OBJS) *.o.wrap
+ $(Q)$(RM) -rf lib conf.d
.SECONDARY: $(OBJS)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
%.o.wrap: %.c
@sed -n 's/^.*__wrap_\([a-zA-Z0-9_]*\).*$$/-Wl,--wrap=\1/p' $< | \
sort -u | tr '\n' ' ' >$@
libmultipath.so.0: $(multipathdir)/libmultipath.so.0
- make -C $(multipathdir) configdir=$(TESTDIR)/conf.d plugindir=$(TESTDIR)/lib test-lib
+ @make -C $(multipathdir) configdir=$(TESTDIR)/conf.d plugindir=$(TESTDIR)/lib test-lib
# COLON will get expanded during second expansion below
COLON:=:
.SECONDEXPANSION:
%-test: %.o %.o.wrap $$($$@_OBJDEPS) $$($$@_TESTDEPS) $$($$@_TESTDEPS$$(COLON).o=.o.wrap) \
libmultipath.so.0 $(mpathutildir)/libmpathutil.so.0 $(mpathcmddir)/libmpathcmd.so.0 Makefile
- $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $($@_TESTDEPS) $($@_OBJDEPS) \
+ @echo building $@
+ $(Q)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $($@_TESTDEPS) $($@_OBJDEPS) \
$(LIBDEPS) $($@_LIBDEPS) \
$(shell cat $<.wrap) $(foreach dep,$($@_TESTDEPS),$(shell cat $(dep).wrap))

View File

@ -1,538 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 5 Jul 2022 23:19:30 +0200
Subject: [PATCH] multipath tests: add sysfs test
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
tests/Makefile | 5 +-
tests/sysfs.c | 494 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 498 insertions(+), 1 deletion(-)
create mode 100644 tests/sysfs.c
diff --git a/tests/Makefile b/tests/Makefile
index d20ef236..95a99908 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -16,7 +16,7 @@ CFLAGS += $(BIN_CFLAGS) -Wno-unused-parameter $(W_MISSING_INITIALIZERS)
LIBDEPS += -L. -L$(mpathcmddir) -lmultipath -lmpathcmd -lcmocka
TESTS := uevent parser util dmevents hwtable blacklist unaligned vpd pgpolicy \
- alias directio valid devt mpathvalid strbuf
+ alias directio valid devt mpathvalid strbuf sysfs
HELPERS := test-lib.o test-log.o
.SILENT: $(TESTS:%=%.o)
@@ -70,6 +70,9 @@ ifneq ($(DIO_TEST_DEV),)
directio-test_LIBDEPS := -laio
endif
strbuf-test_OBJDEPS := ../libmultipath/strbuf.o
+sysfs-test_TESTDEPS := test-log.o
+sysfs-test_OBJDEPS := ../libmultipath/sysfs.o ../libmultipath/util.o
+sysfs-test_LIBDEPS := -ludev -lpthread -ldl
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) $($*-test_FLAGS) -c -o $@ $<
diff --git a/tests/sysfs.c b/tests/sysfs.c
new file mode 100644
index 00000000..0ec135bf
--- /dev/null
+++ b/tests/sysfs.c
@@ -0,0 +1,494 @@
+/*
+ * Copyright (c) 2021 SUSE LLC
+ * SPDX-License-Identifier: GPL-2.0-only
+ */
+
+#define _GNU_SOURCE
+#include <stdbool.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <stdlib.h>
+#include <cmocka.h>
+#include <libudev.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "debug.h"
+#include "globals.c"
+#include "test-log.h"
+#include "sysfs.h"
+#include "util.h"
+
+#define TEST_FD 123
+
+char *__wrap_udev_device_get_syspath(struct udev_device *ud)
+{
+ char *val = mock_ptr_type(char *);
+
+ return val;
+}
+
+int __wrap_open(const char *pathname, int flags)
+{
+ int ret;
+
+ check_expected(pathname);
+ check_expected(flags);
+ ret = mock_type(int);
+ return ret;
+}
+
+ssize_t __wrap_read(int fd, void *buf, size_t count)
+{
+ ssize_t ret;
+ char *val;
+
+ check_expected(fd);
+ check_expected(count);
+ ret = mock_type(int);
+ val = mock_ptr_type(char *);
+ if (ret >= (ssize_t)count)
+ ret = count;
+ if (ret >= 0 && val) {
+ fprintf(stderr, "%s: '%s' -> %zd\n", __func__, val, ret);
+ memcpy(buf, val, ret);
+ }
+ return ret;
+}
+
+ssize_t __wrap_write(int fd, void *buf, size_t count)
+{
+ ssize_t ret;
+
+ check_expected(fd);
+ check_expected(count);
+ ret = mock_type(int);
+ if (ret >= (ssize_t)count)
+ ret = count;
+ return ret;
+}
+
+int __real_close(int fd);
+int __wrap_close(int fd) {
+ if (fd != TEST_FD)
+ return __real_close(fd);
+ return mock_type(int);
+}
+
+static int setup(void **state)
+{
+ udev = udev_new();
+ return 0;
+}
+
+static int teardown(void **state)
+{
+ udev_unref(udev);
+ return 0;
+}
+
+static void expect_sagv_invalid(void)
+{
+ expect_condlog(1, "__sysfs_attr_get_value: invalid parameters");
+}
+
+static void test_sagv_invalid(void **state)
+{
+ expect_sagv_invalid();
+ assert_int_equal(sysfs_attr_get_value(NULL, NULL, NULL, 0), -EINVAL);
+ expect_sagv_invalid();
+ assert_int_equal(sysfs_bin_attr_get_value(NULL, NULL, NULL, 0), -EINVAL);
+
+ expect_sagv_invalid();
+ assert_int_equal(sysfs_attr_get_value(NULL, (void *)state, (void *)state, 1),
+ -EINVAL);
+ expect_sagv_invalid();
+ assert_int_equal(sysfs_bin_attr_get_value(NULL, (void *)state, (void *)state, 1),
+ -EINVAL);
+
+ expect_sagv_invalid();
+ assert_int_equal(sysfs_attr_get_value((void *)state, NULL, (void *)state, 1),
+ -EINVAL);
+ expect_sagv_invalid();
+ assert_int_equal(sysfs_bin_attr_get_value((void *)state, NULL, (void *)state, 1),
+ -EINVAL);
+
+ expect_sagv_invalid();
+ assert_int_equal(sysfs_attr_get_value((void *)state, (void *)state, NULL, 1),
+ -EINVAL);
+ expect_sagv_invalid();
+ assert_int_equal(sysfs_bin_attr_get_value((void *)state, (void *)state, NULL, 1),
+ -EINVAL);
+
+ expect_sagv_invalid();
+ assert_int_equal(sysfs_attr_get_value((void *)state, (void *)state,
+ (void *)state, 0), -EINVAL);
+ expect_sagv_invalid();
+ assert_int_equal(sysfs_bin_attr_get_value((void *)state, (void *)state,
+ (void *)state, 0), -EINVAL);
+}
+
+static void test_sagv_bad_udev(void **state)
+{
+ will_return(__wrap_udev_device_get_syspath, NULL);
+ expect_condlog(3, "__sysfs_attr_get_value: invalid udevice");
+ assert_int_equal(sysfs_attr_get_value((void *)state, (void *)state,
+ (void *)state, 1), -EINVAL);
+
+ will_return(__wrap_udev_device_get_syspath, NULL);
+ expect_condlog(3, "__sysfs_attr_get_value: invalid udevice");
+ assert_int_equal(sysfs_bin_attr_get_value((void *)state, (void *)state,
+ (void *)state, 1), -EINVAL);
+}
+
+static void test_sagv_bad_snprintf(void **state)
+{
+ char longstr[PATH_MAX + 1];
+ char buf[1];
+
+ memset(longstr, 'a', sizeof(longstr) - 1);
+ longstr[sizeof(longstr) - 1] = '\0';
+
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(3, "__sysfs_attr_get_value: devpath overflow");
+ assert_int_equal(sysfs_attr_get_value((void *)state, longstr,
+ buf, sizeof(buf)), -EOVERFLOW);
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(3, "__sysfs_attr_get_value: devpath overflow");
+ assert_int_equal(sysfs_bin_attr_get_value((void *)state, longstr,
+ (unsigned char *)buf, sizeof(buf)),
+ -EOVERFLOW);
+}
+
+static void test_sagv_open_fail(void **state)
+{
+ char buf[1];
+
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(4, "open '/foo/bar'");
+ expect_string(__wrap_open, pathname, "/foo/bar");
+ expect_value(__wrap_open, flags, O_RDONLY);
+ errno = ENOENT;
+ will_return(__wrap_open, -1);
+ expect_condlog(3, "__sysfs_attr_get_value: attribute '/foo/bar' can not be opened");
+ assert_int_equal(sysfs_attr_get_value((void *)state, "bar",
+ buf, sizeof(buf)), -ENOENT);
+}
+
+static void test_sagv_read_fail(void **state)
+{
+ char buf[1];
+
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(4, "open '/foo/bar'");
+ expect_string(__wrap_open, pathname, "/foo/bar");
+ expect_value(__wrap_open, flags, O_RDONLY);
+ will_return(__wrap_open, TEST_FD);
+ expect_value(__wrap_read, fd, TEST_FD);
+ expect_value(__wrap_read, count, sizeof(buf));
+ errno = EISDIR;
+ will_return(__wrap_read, -1);
+ will_return(__wrap_read, NULL);
+ expect_condlog(3, "__sysfs_attr_get_value: read from /foo/bar failed:");
+ will_return(__wrap_close, 0);
+ assert_int_equal(sysfs_attr_get_value((void *)state, "bar",
+ buf, sizeof(buf)), -EISDIR);
+
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(4, "open '/foo/baz'");
+ expect_string(__wrap_open, pathname, "/foo/baz");
+ expect_value(__wrap_open, flags, O_RDONLY);
+ will_return(__wrap_open, TEST_FD);
+ expect_value(__wrap_read, fd, TEST_FD);
+ expect_value(__wrap_read, count, sizeof(buf));
+ errno = EPERM;
+ will_return(__wrap_read, -1);
+ will_return(__wrap_read, NULL);
+ expect_condlog(3, "__sysfs_attr_get_value: read from /foo/baz failed:");
+ will_return(__wrap_close, 0);
+ assert_int_equal(sysfs_bin_attr_get_value((void *)state, "baz",
+ (unsigned char *)buf, sizeof(buf)),
+ -EPERM);
+
+}
+
+static void _test_sagv_read(void **state, unsigned int bufsz)
+{
+ char buf[16];
+ char input[] = "01234567";
+ unsigned int n, trunc;
+
+ assert_in_range(bufsz, 1, sizeof(buf));
+ memset(buf, '.', sizeof(buf));
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(4, "open '/foo/bar'");
+ expect_string(__wrap_open, pathname, "/foo/bar");
+ expect_value(__wrap_open, flags, O_RDONLY);
+ will_return(__wrap_open, TEST_FD);
+ expect_value(__wrap_read, fd, TEST_FD);
+ expect_value(__wrap_read, count, bufsz);
+ will_return(__wrap_read, sizeof(input) - 1);
+ will_return(__wrap_read, input);
+
+ /* If the buffer is too small, input will be truncated by a 0 byte */
+ if (bufsz <= sizeof(input) - 1) {
+ n = bufsz;
+ trunc = 1;
+ expect_condlog(3, "__sysfs_attr_get_value: overflow reading from /foo/bar");
+ } else {
+ n = sizeof(input) - 1;
+ trunc = 0;
+ }
+ will_return(__wrap_close, 0);
+ assert_int_equal(sysfs_attr_get_value((void *)state, "bar",
+ buf, bufsz), n);
+ assert_memory_equal(buf, input, n - trunc);
+ assert_int_equal(buf[n - trunc], '\0');
+
+ /* Binary input is not truncated */
+ memset(buf, '.', sizeof(buf));
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(4, "open '/foo/baz'");
+ expect_string(__wrap_open, pathname, "/foo/baz");
+ expect_value(__wrap_open, flags, O_RDONLY);
+ will_return(__wrap_open, TEST_FD);
+ expect_value(__wrap_read, fd, TEST_FD);
+ expect_value(__wrap_read, count, bufsz);
+ will_return(__wrap_read, sizeof(input) - 1);
+ will_return(__wrap_read, input);
+ will_return(__wrap_close, 0);
+ n = bufsz < sizeof(input) - 1 ? bufsz : sizeof(input) - 1;
+ assert_int_equal(sysfs_bin_attr_get_value((void *)state, "baz",
+ (unsigned char *)buf,
+ bufsz),
+ n);
+ assert_memory_equal(buf, input, n);
+}
+
+static void test_sagv_read_overflow_8(void **state)
+{
+ _test_sagv_read(state, 8);
+}
+
+static void test_sagv_read_overflow_4(void **state)
+{
+ _test_sagv_read(state, 4);
+}
+
+static void test_sagv_read_overflow_1(void **state)
+{
+ _test_sagv_read(state, 1);
+}
+
+static void test_sagv_read_good_9(void **state)
+{
+ _test_sagv_read(state, 9);
+}
+
+static void test_sagv_read_good_15(void **state)
+{
+ _test_sagv_read(state, 15);
+}
+
+static void _test_sagv_read_zeroes(void **state, unsigned int bufsz)
+{
+ char buf[16];
+ char input[] = { '\0','\0','\0','\0','\0','\0','\0','\0' };
+ unsigned int n;
+
+ assert_in_range(bufsz, 1, sizeof(buf));
+ memset(buf, '.', sizeof(buf));
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(4, "open '/foo/bar'");
+ expect_string(__wrap_open, pathname, "/foo/bar");
+ expect_value(__wrap_open, flags, O_RDONLY);
+ will_return(__wrap_open, TEST_FD);
+ expect_value(__wrap_read, fd, TEST_FD);
+ expect_value(__wrap_read, count, bufsz);
+ will_return(__wrap_read, sizeof(input) - 1);
+ will_return(__wrap_read, input);
+
+ if (bufsz <= sizeof(input) - 1) {
+ n = bufsz;
+ expect_condlog(3, "__sysfs_attr_get_value: overflow reading from /foo/bar");
+ } else
+ n = 0;
+
+ will_return(__wrap_close, 0);
+ assert_int_equal(sysfs_attr_get_value((void *)state, "bar",
+ buf, bufsz), n);
+
+ /*
+ * The return value of sysfs_attr_get_value ignores zero bytes,
+ * but the read data should have been copied to the buffer
+ */
+ assert_memory_equal(buf, input, n == 0 ? bufsz : n);
+}
+
+static void test_sagv_read_zeroes_4(void **state)
+{
+ _test_sagv_read_zeroes(state, 4);
+}
+
+static void expect_sasv_invalid(void)
+{
+ expect_condlog(1, "sysfs_attr_set_value: invalid parameters");
+}
+
+static void test_sasv_invalid(void **state)
+{
+ expect_sasv_invalid();
+ assert_int_equal(sysfs_attr_set_value(NULL, NULL, NULL, 0), -EINVAL);
+
+ expect_sasv_invalid();
+ assert_int_equal(sysfs_attr_set_value(NULL, (void *)state, (void *)state, 1),
+ -EINVAL);
+
+ expect_sasv_invalid();
+ assert_int_equal(sysfs_attr_set_value((void *)state, NULL, (void *)state, 1),
+ -EINVAL);
+
+ expect_sasv_invalid();
+ assert_int_equal(sysfs_attr_set_value((void *)state, (void *)state, NULL, 1),
+ -EINVAL);
+
+ expect_sasv_invalid();
+ assert_int_equal(sysfs_attr_set_value((void *)state, (void *)state,
+ (void *)state, 0), -EINVAL);
+}
+
+static void test_sasv_bad_udev(void **state)
+{
+ will_return(__wrap_udev_device_get_syspath, NULL);
+ expect_condlog(3, "sysfs_attr_set_value: invalid udevice");
+ assert_int_equal(sysfs_attr_set_value((void *)state, (void *)state,
+ (void *)state, 1), -EINVAL);
+}
+
+static void test_sasv_bad_snprintf(void **state)
+{
+ char longstr[PATH_MAX + 1];
+ char buf[1];
+
+ memset(longstr, 'a', sizeof(longstr) - 1);
+ longstr[sizeof(longstr) - 1] = '\0';
+
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(3, "sysfs_attr_set_value: devpath overflow");
+ assert_int_equal(sysfs_attr_set_value((void *)state, longstr,
+ buf, sizeof(buf)), -EOVERFLOW);
+}
+
+static void test_sasv_open_fail(void **state)
+{
+ char buf[1];
+
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(4, "open '/foo/bar'");
+ expect_string(__wrap_open, pathname, "/foo/bar");
+ expect_value(__wrap_open, flags, O_WRONLY);
+ errno = EPERM;
+ will_return(__wrap_open, -1);
+ expect_condlog(3, "sysfs_attr_set_value: attribute '/foo/bar' can not be opened");
+ assert_int_equal(sysfs_attr_set_value((void *)state, "bar",
+ buf, sizeof(buf)), -EPERM);
+}
+
+static void test_sasv_write_fail(void **state)
+{
+ char buf[1];
+
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(4, "open '/foo/bar'");
+ expect_string(__wrap_open, pathname, "/foo/bar");
+ expect_value(__wrap_open, flags, O_WRONLY);
+ will_return(__wrap_open, TEST_FD);
+ expect_value(__wrap_write, fd, TEST_FD);
+ expect_value(__wrap_write, count, sizeof(buf));
+ errno = EISDIR;
+ will_return(__wrap_write, -1);
+ expect_condlog(3, "sysfs_attr_set_value: write to /foo/bar failed:");
+ will_return(__wrap_close, 0);
+ assert_int_equal(sysfs_attr_set_value((void *)state, "bar",
+ buf, sizeof(buf)), -EISDIR);
+
+}
+
+static void _test_sasv_write(void **state, unsigned int n_written)
+{
+ char buf[8];
+
+ assert_in_range(n_written, 0, sizeof(buf));
+ will_return(__wrap_udev_device_get_syspath, "/foo");
+ expect_condlog(4, "open '/foo/bar'");
+ expect_string(__wrap_open, pathname, "/foo/bar");
+ expect_value(__wrap_open, flags, O_WRONLY);
+ will_return(__wrap_open, TEST_FD);
+ expect_value(__wrap_write, fd, TEST_FD);
+ expect_value(__wrap_write, count, sizeof(buf));
+ will_return(__wrap_write, n_written);
+
+ if (n_written < sizeof(buf))
+ expect_condlog(3, "sysfs_attr_set_value: underflow writing");
+ will_return(__wrap_close, 0);
+ assert_int_equal(sysfs_attr_set_value((void *)state, "bar",
+ buf, sizeof(buf)),
+ n_written);
+}
+
+static void test_sasv_write_0(void **state)
+{
+ _test_sasv_write(state, 0);
+}
+
+static void test_sasv_write_4(void **state)
+{
+ _test_sasv_write(state, 4);
+}
+
+static void test_sasv_write_7(void **state)
+{
+ _test_sasv_write(state, 7);
+}
+
+static void test_sasv_write_8(void **state)
+{
+ _test_sasv_write(state, 8);
+}
+
+static int test_sysfs(void)
+{
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_sagv_invalid),
+ cmocka_unit_test(test_sagv_bad_udev),
+ cmocka_unit_test(test_sagv_bad_snprintf),
+ cmocka_unit_test(test_sagv_open_fail),
+ cmocka_unit_test(test_sagv_read_fail),
+ cmocka_unit_test(test_sagv_read_overflow_1),
+ cmocka_unit_test(test_sagv_read_overflow_4),
+ cmocka_unit_test(test_sagv_read_overflow_8),
+ cmocka_unit_test(test_sagv_read_good_9),
+ cmocka_unit_test(test_sagv_read_good_15),
+ cmocka_unit_test(test_sagv_read_zeroes_4),
+ cmocka_unit_test(test_sasv_invalid),
+ cmocka_unit_test(test_sasv_bad_udev),
+ cmocka_unit_test(test_sasv_bad_snprintf),
+ cmocka_unit_test(test_sasv_open_fail),
+ cmocka_unit_test(test_sasv_write_fail),
+ cmocka_unit_test(test_sasv_write_0),
+ cmocka_unit_test(test_sasv_write_4),
+ cmocka_unit_test(test_sasv_write_7),
+ cmocka_unit_test(test_sasv_write_8),
+ };
+
+ return cmocka_run_group_tests(tests, setup, teardown);
+}
+
+int main(void)
+{
+ int ret = 0;
+
+ init_test_verbosity(4);
+ ret += test_sysfs();
+ return ret;
+}

View File

@ -0,0 +1,183 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 14:39:22 +0200
Subject: [PATCH] multipath-tools: quiet build support for top-level Makefile
This requires including "Makefile.inc" in the top-level Makefile,
too.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile | 32 ++++++++++++++++++------------
Makefile.inc | 8 ++++++--
create-config.mk | 1 -
libmultipath/checkers/Makefile | 2 +-
libmultipath/foreign/Makefile | 2 +-
libmultipath/prioritizers/Makefile | 2 +-
6 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/Makefile b/Makefile
index e3ce1a8d..b9e30234 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,9 @@
# Copyright (C) 2003 Christophe Varoqui, <christophe.varoqui@opensvc.com>
#
+TOPDIR := .
+include Makefile.inc
+
LIB_BUILDDIRS := \
libmpathcmd \
libmpathutil \
@@ -32,10 +35,12 @@ all: $(BUILDDIRS)
config.mk libmultipath/autoconfig.h:
@$(MAKE) -f create-config.mk
+ifeq ($(V),1)
@echo ==== config.mk ====
@cat config.mk
@echo ==== autoconfig.h ====
@cat libmultipath/autoconfig.h
+endif
$(BUILDDIRS): config.mk
@$(MAKE) -C $@
@@ -48,11 +53,12 @@ $(LIB_BUILDDIRS:=.abi): $(LIB_BUILDDIRS)
# Requires abidw from the abigail suite (https://sourceware.org/libabigail/)
.PHONY: abi
abi: $(LIB_BUILDDIRS:=.abi)
+ @echo creating abi
@mkdir -p $@
- ln -ft $@ $(LIB_BUILDDIRS:=/*.abi)
+ $(Q)ln -ft $@ $(LIB_BUILDDIRS:=/*.abi)
abi.tar.gz: abi
- tar cfz $@ abi
+ $(Q)tar cfz $@ abi
# Check the ABI against a reference.
# This requires the ABI from a previous run to be present
@@ -77,8 +83,8 @@ abi-test: abi reference-abi $(wildcard abi/*.abi)
# Create compile_commands.json, useful for using clangd with an IDE
# Requires bear (https://github.com/rizsotto/Bear)
compile_commands.json: Makefile Makefile.inc $(BUILDDIRS:=/Makefile)
- $(MAKE) clean
- bear -- $(MAKE)
+ $(Q)$(MAKE) clean
+ $(Q)bear -- $(MAKE)
libmpathutil libdmmp: libmpathcmd
libmultipath: libmpathutil
@@ -103,24 +109,24 @@ $(BUILDDIRS:=.uninstall):
# build it. Both is undesirable. Avoid it by creating config.mk temporarily.
clean:
@touch config.mk
- $(MAKE) $(BUILDDIRS:=.clean) tests.clean || true
- rm -rf abi abi.tar.gz abi-test compile_commands.json config.mk
+ $(Q)$(MAKE) $(BUILDDIRS:=.clean) tests.clean || true
+ $(Q)$(RM) -r abi abi.tar.gz abi-test compile_commands.json config.mk
install: $(BUILDDIRS:=.install)
uninstall: $(BUILDDIRS:=.uninstall)
test-progs: all
- $(MAKE) -C tests progs
+ @$(MAKE) -C tests progs
test: all
- $(MAKE) -C tests all
+ @$(MAKE) -C tests all
valgrind-test: all
- $(MAKE) -C tests valgrind
+ @$(MAKE) -C tests valgrind
.PHONY: TAGS
TAGS:
- etags -a libmultipath/*.c
- etags -a libmultipath/*.h
- etags -a multipathd/*.c
- etags -a multipathd/*.h
+ @etags -a libmultipath/*.c
+ @etags -a libmultipath/*.h
+ @etags -a multipathd/*.c
+ @etags -a multipathd/*.h
diff --git a/Makefile.inc b/Makefile.inc
index 3e14cb8c..866ab274 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -27,7 +27,7 @@ PKGCONFIG ?= pkg-config
ifeq ($(TOPDIR),)
TOPDIR = ..
endif
-ifneq ($(CREATE_CONFIG),1)
+ifneq ($(TOPDIR),.)
include $(TOPDIR)/config.mk
endif
@@ -60,7 +60,11 @@ devmapper_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir devmapper),/
libudev_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir libudev),/usr/include)
kernel_incdir := /usr/include
-Q := $(if $(V),,@)
+ifeq ($(V),)
+Q := @
+# make's "Entering directory" messages are confusing in parallel mode
+#MAKEFLAGS = --no-print-directory
+endif
GZIP_PROG := gzip -9 -c
RM := rm -f
diff --git a/create-config.mk b/create-config.mk
index 2cc5284f..434dee06 100644
--- a/create-config.mk
+++ b/create-config.mk
@@ -2,7 +2,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
TOPDIR := .
-CREATE_CONFIG := 1
include $(TOPDIR)/Makefile.inc
# Check whether a function with name $1 has been declared in header file $2.
diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile
index b3120611..6f7cfb95 100644
--- a/libmultipath/checkers/Makefile
+++ b/libmultipath/checkers/Makefile
@@ -28,7 +28,7 @@ install:
$(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
+ $(Q)for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(Q)$(RM) core *.a *.o *.gz *.so
diff --git a/libmultipath/foreign/Makefile b/libmultipath/foreign/Makefile
index 0e245d6f..b83213d6 100644
--- a/libmultipath/foreign/Makefile
+++ b/libmultipath/foreign/Makefile
@@ -20,7 +20,7 @@ install:
$(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
+ $(Q)for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(Q)$(RM) core *.a *.o *.gz *.so
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index e1688163..fdec36e7 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -40,7 +40,7 @@ install: $(LIBS)
$(Q)$(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
+ $(Q)for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(Q)$(RM) core *.a *.o *.gz *.so

View File

@ -0,0 +1,132 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 15:29:51 +0200
Subject: [PATCH] GitHub workflows: use make -j8 -Orecurse
Without -Orecurse, quiet make output is confusing in parallel mode
because make prints "Entering directory" and "Leaving directory"
messages before and after every target.
Use parallel compilation also in native.yaml and foreign.yaml.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/abi.yaml | 2 +-
.github/workflows/build-and-unittest.yaml | 18 +++++++++---------
.github/workflows/coverity.yaml | 2 +-
.github/workflows/foreign.yaml | 4 ++--
.github/workflows/native.yaml | 6 +++---
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/abi.yaml b/.github/workflows/abi.yaml
index 89b971cd..644fcb62 100644
--- a/.github/workflows/abi.yaml
+++ b/.github/workflows/abi.yaml
@@ -32,7 +32,7 @@ jobs:
libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev
libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev
- name: create ABI
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) abi.tar.gz
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) abi.tar.gz
- name: save ABI
uses: actions/upload-artifact@v1
with:
diff --git a/.github/workflows/build-and-unittest.yaml b/.github/workflows/build-and-unittest.yaml
index a5a0717d..8b6bb776 100644
--- a/.github/workflows/build-and-unittest.yaml
+++ b/.github/workflows/build-and-unittest.yaml
@@ -32,11 +32,11 @@ jobs:
libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev
libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev
- name: build
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
- name: test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) test
- name: valgrind-test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
- name: valgrind-results
run: cat tests/*.vgr
- name: clean-nonroot-artifacts
@@ -65,11 +65,11 @@ jobs:
- name: set CC
run: echo CC=gcc-10 >> $GITHUB_ENV
- name: build
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
- name: test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) test
- name: valgrind-test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
- name: valgrind-results
run: cat tests/*.vgr
- name: clean-nonroot-artifacts
@@ -98,11 +98,11 @@ jobs:
- name: set CC
run: echo CC=clang >> $GITHUB_ENV
- name: build
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
- name: test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) test
- name: valgrind-test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
- name: valgrind-results
run: cat tests/*.vgr
- name: clean-nonroot-artifacts
diff --git a/.github/workflows/coverity.yaml b/.github/workflows/coverity.yaml
index 3c6b3824..321b94e0 100644
--- a/.github/workflows/coverity.yaml
+++ b/.github/workflows/coverity.yaml
@@ -32,7 +32,7 @@ jobs:
- name: build with cov-build
run: >
PATH="$PWD/coverity/bin:$PATH"
- cov-build --dir cov-int make -O -j"$(grep -c ^processor /proc/cpuinfo)"
+ cov-build --dir cov-int make -Orecurse -j"$(grep -c ^processor /proc/cpuinfo)"
- name: pack results
run: tar cfz multipath-tools.tgz cov-int
- name: submit results
diff --git a/.github/workflows/foreign.yaml b/.github/workflows/foreign.yaml
index 5a19913a..72ac24fb 100644
--- a/.github/workflows/foreign.yaml
+++ b/.github/workflows/foreign.yaml
@@ -21,11 +21,11 @@ jobs:
uses: actions/checkout@v1
- name: build and test
if: ${{ matrix.arch == '' || matrix.arch == '-i386' }}
- run: make test
+ run: make -j8 -Orecurse test
- name: build
if: ${{ matrix.arch != '' && matrix.arch != '-i386' }}
# The build path is different between builder and runner
- run: make TESTDIR=${{ github.workspace }}/tests test-progs
+ run: make -j8 -Orecurse TESTDIR=${{ github.workspace }}/tests test-progs
- name: archive
if: ${{ matrix.arch != '' && matrix.arch != '-i386' }}
run: >
diff --git a/.github/workflows/native.yaml b/.github/workflows/native.yaml
index 8b599209..68bf0984 100644
--- a/.github/workflows/native.yaml
+++ b/.github/workflows/native.yaml
@@ -92,10 +92,10 @@ jobs:
- name: checkout
uses: actions/checkout@v1
- name: build and test
- run: make test
+ run: make -j8 -Orecurse test
- name: clean
- run: make clean
+ run: make -j8 -Orecurse clean
- name: clang
env:
CC: clang
- run: make test
+ run: make -j8 -Orecurse test

View File

@ -1,43 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 6 Jul 2022 12:45:33 +0200
Subject: [PATCH] libmultipath.version: bump version for sysfs accessors
Formally, the ABI is still the same, but the semantics of the
return value have changed.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/libmultipath.version | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version
index b3690ac0..c1d9b156 100644
--- a/libmultipath/libmultipath.version
+++ b/libmultipath/libmultipath.version
@@ -207,7 +207,6 @@ global:
strchop;
strlcpy;
sync_map_state;
- sysfs_attr_set_value;
sysfs_get_size;
sysfs_is_multipathed;
timespeccmp;
@@ -264,8 +263,13 @@ global:
/* foreign */
free_scandir_result;
- sysfs_attr_get_value;
local:
*;
};
+
+LIBMULTIPATH_16.0.0 {
+global:
+ sysfs_attr_set_value;
+ sysfs_attr_get_value;
+};

View File

@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 15:40:16 +0200
Subject: [PATCH] README.md: Move section about libedit and libreadline
This paragraph belongs in the "Customiting build" section.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index d003e1db..52ab776b 100644
--- a/README.md
+++ b/README.md
@@ -53,14 +53,9 @@ Building multipath-tools
========================
Prerequisites: development packages of for `libdevmapper`, `libaio`, `libudev`,
-`libjson-c`, `liburcu`, and `libsystemd`.
-
-To enable commandline history and TAB completion in the interactive mode *(which
-is entered with `multipathd -k` or `multipathc`)* you might also set `READLINE`
-make variable to `libedit` or `libreadline`, like `make READLINE=libreadline`.
-That requires a development package for the library you chose. Note that using
-libreadline may [make binary indistributable due to license
-incompatibility](https://github.com/opensvc/multipath-tools/issues/36).
+`libjson-c`, `liburcu`, and `libsystemd`. If commandline editing is enabled
+(see below), the development package for either `libedit` or `libreadline` is
+required as well.
Then, build and install multipath-tools with:
@@ -82,6 +77,12 @@ The following variables can be passed to the `make` command line:
* `configdir="/some/path"` : directory to search for configuration files.
This used to be the run-time option `config_dir` in earlier versions.
The default is `/etc/multipath/conf.d`.
+ * `READLINE=libedit` or `READLINE=libreadline`: enable command line history
+ and TAB completion in the interactive mode *(which is entered with `multipathd -k` or `multipathc`)*.
+ The respective development package will be required for building.
+ By default, command line editing is disabled.
+ Note that using libreadline may
+ [make binary indistributable due to license incompatibility](https://github.com/opensvc/multipath-tools/issues/36).
* `ENABLE_LIBDMMP=0`: disable building libdmmp
* `ENABLE_DMEVENTS_POLL=0`: disable support for the device-mapper event
polling API. For use with pre-5.0 kernels that don't support dmevent polling

View File

@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 7 Jun 2022 17:45:01 -0500
Subject: [PATCH] libmultipath: unset detect_checker for clariion / Unity
arrays
Dell EMC would like to always use the emc_clariion checker. Currently
detect_checker will switch the checker to TUR for Unity arrays.
This can cause problems on some setups with replicated Unity LUNs,
which are handled correctly the the emc_checker, but not the TUR
checker.
Cc: vincent.chen1@dell.com
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/hwtable.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index c88fa09a..2085aba5 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -350,6 +350,7 @@ static struct hwentry default_hw[] = {
.no_path_retry = (300 / DEFAULT_CHECKINT),
.checker_name = EMC_CLARIION,
.prio_name = PRIO_EMC,
+ .detect_checker = DETECT_CHECKER_OFF,
},
{
/* Invista / VPLEX */

View File

@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 15:42:15 +0200
Subject: [PATCH] README.md: Fix indentation in paragraph about device handlers
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 52ab776b..b1b78fbb 100644
--- a/README.md
+++ b/README.md
@@ -94,12 +94,12 @@ The following variables can be passed to the `make` command line:
early. This option causes a *modules-load.d(5)* configuration file to be
created, thus it depends on functionality provided by *systemd*.
This variable only matters for `make install`.
-
-Note: The usefulness of the preload list depends on the kernel configuration.
-It's especially useful if `scsi_mod` is builtin but `scsi_dh_alua` and
-other device handler modules are built as modules. If `scsi_mod` itself is compiled
-as a module, it might make more sense to use a module softdep for the same
-purpose.
+
+ **Note**: The usefulness of the preload list depends on the kernel configuration.
+ It's especially useful if `scsi_mod` is builtin but `scsi_dh_alua` and
+ other device handler modules are built as modules. If `scsi_mod` itself is compiled
+ as a module, it might make more sense to use a module softdep for the same
+ purpose.
See `Makefile.inc` for additional variables to customize paths and compiler
flags.

View File

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Josh Soref <2119212+jsoref@users.noreply.github.com>
Date: Sun, 31 Jul 2022 13:11:15 -0400
Subject: [PATCH] libmultipath: spelling: cplusplus
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Reviewed-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathvalid/mpath_valid.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmpathvalid/mpath_valid.h b/libmpathvalid/mpath_valid.h
index ed06196e..ec2f9392 100644
--- a/libmpathvalid/mpath_valid.h
+++ b/libmpathvalid/mpath_valid.h
@@ -20,7 +20,7 @@
#ifndef LIB_MPATH_VALID_H
#define LIB_MPATH_VALID_H
-#ifdef __cpluscplus
+#ifdef __cplusplus
extern "C" {
#endif

View File

@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 16:01:17 +0200
Subject: [PATCH] README.md: document options for paths and optimization
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index b1b78fbb..ab7dc3c9 100644
--- a/README.md
+++ b/README.md
@@ -101,8 +101,29 @@ The following variables can be passed to the `make` command line:
as a module, it might make more sense to use a module softdep for the same
purpose.
-See `Makefile.inc` for additional variables to customize paths and compiler
-flags.
+### Installation Paths
+
+ * `prefix`: The directory prefix for (almost) all files to be installed.
+ Distributions may want to set this to `/usr`.
+ **Note**: for multipath-tools, unlike many other packages, `prefix`
+ defaults to the empty string, which resolves to the root directory (`/`).
+ * `usr_prefix`: where to install those parts of the code that aren't necessary
+ for booting. You may want to set this to `/usr` if `prefix` is empty.
+ * `systemd_prefix`: Prefix for systemd-related files. It defaults to `/usr`.
+ Some systemd installations use separate `prefix` and `rootprefix`. On such
+ a distribution, set `prefix`, and override `unitdir` to use systemd's
+ `rootprefix`.
+ * `LIB`: the subdirectory under `prefix` where shared libraries will be
+ installed. By default, the makefile uses `/lib64` if this directory is
+ found on the build system, and `/lib` otherwise.
+
+See also `configdir` and `plugindir` above. See `Makefile.inc` for more
+fine-grained control.
+
+### Compiler Options
+
+Use `OPTFLAGS` to change optimization-related compiler options;
+e.g. `OPTFLAGS="-g -O0"` to disable all optimizations.
Special Makefile targets
------------------------

View File

@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Josh Soref <2119212+jsoref@users.noreply.github.com>
Date: Sun, 31 Jul 2022 13:11:12 -0400
Subject: [PATCH] libmultipath: spelling: ascii
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/prioritizers/alua_spc3.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/prioritizers/alua_spc3.h b/libmultipath/prioritizers/alua_spc3.h
index 08e992bd..e1a6c071 100644
--- a/libmultipath/prioritizers/alua_spc3.h
+++ b/libmultipath/prioritizers/alua_spc3.h
@@ -143,7 +143,7 @@ inquiry_data_get_tpgs(struct inquiry_data *id)
*-----------------------------------------------------------------------------
*/
#define CODESET_BINARY 0x1
-#define CODESET_ACSII 0x2
+#define CODESET_ASCII 0x2
#define CODESET_UTF8 0x3
#define ASSOCIATION_UNIT 0x0

View File

@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 16:01:41 +0200
Subject: [PATCH] README.md: document how to customize build
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/README.md b/README.md
index ab7dc3c9..bbeb44fe 100644
--- a/README.md
+++ b/README.md
@@ -66,9 +66,21 @@ To uninstall, type:
make uninstall
+By default, the build will run quietly, just printing one-line messages
+about the files being built. To enable more verbose output, run `make V=1`.
+
Customizing the build
---------------------
+**Note**: With very few exceptions, the build process does not read
+configuration from the environment. So using syntax like
+
+ SOME_VAR=some_value make
+
+will **not** have the intended effect. Use the following instead:
+
+ make SOME_VAR=some_value
+
The following variables can be passed to the `make` command line:
* `plugindir="/some/path"`: directory where libmultipath plugins (path

View File

@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Josh Soref <2119212+jsoref@users.noreply.github.com>
Date: Sun, 31 Jul 2022 13:11:22 -0400
Subject: [PATCH] libmultipath: spelling: progress
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/nvme/linux/nvme.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/nvme/linux/nvme.h b/libmultipath/nvme/linux/nvme.h
index a6975549..9fc2ae7f 100644
--- a/libmultipath/nvme/linux/nvme.h
+++ b/libmultipath/nvme/linux/nvme.h
@@ -1035,7 +1035,7 @@ enum {
NVME_SANITIZE_LOG_STATUS_MASK = 0x0007,
NVME_SANITIZE_LOG_NEVER_SANITIZED = 0x0000,
NVME_SANITIZE_LOG_COMPLETED_SUCCESS = 0x0001,
- NVME_SANITIZE_LOG_IN_PROGESS = 0x0002,
+ NVME_SANITIZE_LOG_IN_PROGRESS = 0x0002,
NVME_SANITIZE_LOG_COMPLETED_FAILED = 0x0003,
NVME_SANITIZE_LOG_ND_COMPLETED_SUCCESS = 0x0004,
};

View File

@ -0,0 +1,63 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 21:10:41 +0200
Subject: [PATCH] libmultipath: avoid -Warray-bounds error with gcc 12 and musl
libc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The following error is observed with gcc 12, strangely only with
MUSL libc:
In function __uatomic_inc,
inlined from lock at ../libmultipath/lock.h:24:2,
inlined from child at main.c:3523:3,
inlined from main at main.c:3755:11:
/usr/include/urcu/uatomic/x86.h:439:17: error: array subscript struct __uatomic_dummy[0] is partly outside array bounds of unsigned char[72] [-Werror=array-bounds]
The problem is that &(vecs->lock.waiters) is casted to a pointer to
struct { long[10]; } which goes beyond the "struct vectors".
We don't read or write from/to that memory, but the compiler complains either
way.
latest liburcu has a patch for it:
http://git.liburcu.org/?p=userspace-rcu.git;a=commitdiff;h=835b9ab3ca3777fe42e37e92096226ebd19ca75b
For now, just disable the warning in lock.h, using a pragma.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reported-by: Xose Vasquez Perez <xose.vasquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/lock.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libmultipath/lock.h b/libmultipath/lock.h
index 20ca77e6..9814be76 100644
--- a/libmultipath/lock.h
+++ b/libmultipath/lock.h
@@ -13,6 +13,11 @@ struct mutex_lock {
int waiters; /* uatomic access only */
};
+#if !defined(__GLIBC__) && defined(__GNUC__) && __GNUC__ == 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+
static inline void init_lock(struct mutex_lock *a)
{
pthread_mutex_init(&a->mutex, NULL);
@@ -46,6 +51,10 @@ static inline bool lock_has_waiters(struct mutex_lock *a)
return (uatomic_read(&a->waiters) > 0);
}
+#if !defined(__GLIBC__) && defined(__GNUC__) && __GNUC__ == 12
+#pragma GCC diagnostic pop
+#endif
+
#define lock_cleanup_pop(a) pthread_cleanup_pop(1)
void cleanup_lock (void * data);

View File

@ -1,599 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Josh Soref <2119212+jsoref@users.noreply.github.com>
Date: Sun, 31 Jul 2022 13:17:53 -0400
Subject: [PATCH] multipath-tools: spelling fixes
Spelling errors detected by the GitHub check-spelling action:
https://github.com/marketplace/actions/check-spelling
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/foreign.yaml | 2 +-
kpartx/crc32.c | 2 +-
kpartx/gpt.c | 2 +-
libdmmp/libdmmp_path.c | 2 +-
libmpathcmd/mpath_cmd.h | 2 +-
libmpathpersist/mpath_persist_int.c | 2 +-
libmpathvalid/mpath_valid.h | 4 ++--
libmultipath/checkers/directio.c | 2 +-
libmultipath/config.h | 2 +-
libmultipath/configure.c | 2 +-
libmultipath/discovery.c | 2 +-
libmultipath/nvme/nvme.h | 2 +-
libmultipath/prioritizers/datacore.c | 4 ++--
libmultipath/prioritizers/hds.c | 2 +-
libmultipath/prioritizers/path_latency.c | 4 ++--
libmultipath/strbuf.h | 4 ++--
libmultipath/structs_vec.c | 2 +-
libmultipath/uevent.c | 2 +-
libmultipath/valid.h | 2 +-
mpathpersist/main.c | 2 +-
multipath/multipath.conf.5 | 14 +++++++-------
multipathd/main.c | 10 +++++-----
tests/directio.c | 2 +-
tests/hwtable.c | 10 +++++-----
tests/mpathvalid.c | 2 +-
tests/pgpolicy.c | 2 +-
tests/valid.c | 4 ++--
third-party/valgrind/valgrind.h | 8 ++++----
28 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/.github/workflows/foreign.yaml b/.github/workflows/foreign.yaml
index e9ffd3d8..32915186 100644
--- a/.github/workflows/foreign.yaml
+++ b/.github/workflows/foreign.yaml
@@ -56,7 +56,7 @@ jobs:
- name: enable foreign arch
run: sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
- name: run tests
- # Github actions doesn't support referencing docker images with
+ # GitHub actions doesn't support referencing docker images with
# context variables. Workaround: use mosteo-actions/docker-run action
# See https://github.community/t/expressions-in-docker-uri/16271
uses: mosteo-actions/docker-run@v1
diff --git a/kpartx/crc32.c b/kpartx/crc32.c
index e688f8e9..df6c6878 100644
--- a/kpartx/crc32.c
+++ b/kpartx/crc32.c
@@ -290,7 +290,7 @@ uint32_t attribute((pure)) crc32_be(uint32_t crc, unsigned char const *p, size_t
* the end, so we have to add 32 extra cycles shifting in zeros at the
* end of every message,
*
- * So the standard trick is to rearrage merging in the next_input_bit()
+ * So the standard trick is to rearrange merging in the next_input_bit()
* until the moment it's needed. Then the first 32 cycles can be precomputed,
* and merging in the final 32 zero bits to make room for the CRC can be
* skipped entirely.
diff --git a/kpartx/gpt.c b/kpartx/gpt.c
index 34a910cf..47d8743e 100644
--- a/kpartx/gpt.c
+++ b/kpartx/gpt.c
@@ -357,7 +357,7 @@ is_gpt_valid(int fd, uint64_t lba,
__le32_to_cpu((*gpt)->num_partition_entries) *
__le32_to_cpu((*gpt)->sizeof_partition_entry));
if (crc != __le32_to_cpu((*gpt)->partition_entry_array_crc32)) {
- // printf("GUID Partitition Entry Array CRC check failed.\n");
+ // printf("GUID Partition Entry Array CRC check failed.\n");
free(*gpt);
*gpt = NULL;
free(*ptes);
diff --git a/libdmmp/libdmmp_path.c b/libdmmp/libdmmp_path.c
index 47a2162c..21714b15 100644
--- a/libdmmp/libdmmp_path.c
+++ b/libdmmp/libdmmp_path.c
@@ -28,7 +28,7 @@
#include "libdmmp_private.h"
#define _DMMP_SHOW_PS_INDEX_BLK_NAME 0
-#define _DMMP_SHOW_PS_INDEX_SATAUS 1
+#define _DMMP_SHOW_PS_INDEX_STATUS 1
#define _DMMP_SHOW_PS_INDEX_WWID 2
#define _DMMP_SHOW_PS_INDEX_PGID 3
diff --git a/libmpathcmd/mpath_cmd.h b/libmpathcmd/mpath_cmd.h
index 30838b02..0c293c71 100644
--- a/libmpathcmd/mpath_cmd.h
+++ b/libmpathcmd/mpath_cmd.h
@@ -65,7 +65,7 @@ int mpath_connect(void);
/*
* DESCRIPTION:
* Disconnect from the multipathd daemon. This function must be
- * run after after processing all the multipath commands.
+ * run after processing all the multipath commands.
*
* RETURNS:
* 0 on success. -1 on failure (with errno set).
diff --git a/libmpathpersist/mpath_persist_int.c b/libmpathpersist/mpath_persist_int.c
index e34fc32d..6924b379 100644
--- a/libmpathpersist/mpath_persist_int.c
+++ b/libmpathpersist/mpath_persist_int.c
@@ -601,7 +601,7 @@ static int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope,
if (get_be64(mpp->reservation_key) &&
memcmp(pr_buff->prin_descriptor.prin_readfd.descriptors[i]->key,
&mpp->reservation_key, 8)){
- /*register with tarnsport id*/
+ /*register with transport id*/
memset(pamp, 0, length);
pamp->trnptid_list[0] = pptr;
memset (pamp->trnptid_list[0], 0, sizeof (struct transportid));
diff --git a/libmpathvalid/mpath_valid.h b/libmpathvalid/mpath_valid.h
index ec2f9392..3e34b1fd 100644
--- a/libmpathvalid/mpath_valid.h
+++ b/libmpathvalid/mpath_valid.h
@@ -112,7 +112,7 @@ int mpathvalid_exit(void);
* RETURNS:
* MPATH_STRICT, MPATH_SMART, MPATH_GREEDY, or MPATH_MODE_ERROR
*
- * MPATH_STRICT = find_multiapths (yes|on|no|off)
+ * MPATH_STRICT = find_multipaths (yes|on|no|off)
* MPATH_SMART = find_multipaths smart
* MPATH_GREEDY = find_multipaths greedy
* MPATH_MODE_ERROR = multipath configuration not initialized
@@ -126,7 +126,7 @@ unsigned int mpathvalid_get_mode(void);
* potentially claimed (MPATH_IS_VALID, MPATH_IS_VALID_NO_CHECK,
* or MPATH_IS_MAYBE_VALID) and wwid is not NULL, then *wiid will
* be set to point to the wwid of device. If set, *wwid must be
- * freed by the caller. path_wwids is an obptional parameter that
+ * freed by the caller. path_wwids is an optional parameter that
* points to an array of wwids, that were returned from previous
* calls to mpathvalid_is_path(). These are wwids of existing
* devices that are or potentially are claimed by device-mapper
diff --git a/libmultipath/checkers/directio.c b/libmultipath/checkers/directio.c
index bc7b7be5..a326e37b 100644
--- a/libmultipath/checkers/directio.c
+++ b/libmultipath/checkers/directio.c
@@ -124,7 +124,7 @@ remove_aio_group(struct aio_group *aio_grp)
/* If an aio_group is completely full of orphans, then no checkers can
* use it, which means that no checkers can clear out the orphans. To
- * avoid keeping the useless group around, simply remove remove the
+ * avoid keeping the useless group around, simply remove the
* group */
static void
check_orphaned_group(struct aio_group *aio_grp)
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 36d40157..fdcdff0a 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -248,7 +248,7 @@ struct config {
* libmultipath calls. If an application wants to keep using the
* udev variable after calling libmultipath_exit(), it should have taken
* an additional reference on it beforehand. This is the case e.g.
- * after initiazing udev with udev_new().
+ * after initializing udev with udev_new().
*/
extern struct udev *udev;
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 4427f910..8af7cd79 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -397,7 +397,7 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs)
* into a mp->params strings to feed the device-mapper
*/
if (assemble_map(mpp, params)) {
- condlog(0, "%s: problem assembing map", mpp->alias);
+ condlog(0, "%s: problem assembling map", mpp->alias);
return 1;
}
return 0;
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index ee290093..15560f8c 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1344,7 +1344,7 @@ parse_vpd_c0_hp3par(const unsigned char *in, size_t in_len,
condlog(3, "HP/3PAR vendor specific VPD page length too short: %zu", in_len);
return -EINVAL;
}
- if (in[4] <= 3) /* revision must be > 3 to have Vomlume Name */
+ if (in[4] <= 3) /* revision must be > 3 to have Volume Name */
return -ENODATA;
len = get_unaligned_be32(&in[40]);
if (len > out_len || len + 44 > in_len) {
diff --git a/libmultipath/nvme/nvme.h b/libmultipath/nvme/nvme.h
index 7e0278b5..57f82a31 100644
--- a/libmultipath/nvme/nvme.h
+++ b/libmultipath/nvme/nvme.h
@@ -224,7 +224,7 @@ char *nvme_char_from_block(char *block);
* Notes: This function does not care about transport so that the offset is
* not going to be checked inside of this function for the unsupported fields
* in a specific transport. For example, BPMBL(Boot Partition Memory Buffer
- * Location) register is not supported by fabrics, but it can be chcked here.
+ * Location) register is not supported by fabrics, but it can be checked here.
*/
static inline bool is_64bit_reg(__u32 offset)
{
diff --git a/libmultipath/prioritizers/datacore.c b/libmultipath/prioritizers/datacore.c
index 02dc2e27..d1d473d4 100644
--- a/libmultipath/prioritizers/datacore.c
+++ b/libmultipath/prioritizers/datacore.c
@@ -1,6 +1,6 @@
/*
* (C) 2010 Christophe Varoqui
- * (C) 2009 Dembach Goo Infromatik GmbH & Co KG
+ * (C) 2009 Dembach Goo Informatik GmbH & Co KG
* Manon Goo <manon.goo@dg-i.net>
*
* datacore.c
@@ -10,7 +10,7 @@
* Matthias Rudolph <matthias.rudolph@hds.com>
*
* This work is made available on the basis of the
- * GPLv2 for detials see <http://www.gnu.org/licenses/>.
+ * GPLv2 for details see <http://www.gnu.org/licenses/>.
*
* Manon Goo 2009
*
diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c
index 88cac5f0..d569f2d7 100644
--- a/libmultipath/prioritizers/hds.c
+++ b/libmultipath/prioritizers/hds.c
@@ -32,7 +32,7 @@
* Half of the LUNs are accessed via one HBA/storage controller and the other
* half via the other HBA/storage controller.
*
- * In cluster environmemnts (RAC) it also guarantees that all cluster nodes have
+ * In cluster environments (RAC) it also guarantees that all cluster nodes have
* access to the LDEVs via the same controller.
*
* You can run the prioritizer manually in verbose mode:
diff --git a/libmultipath/prioritizers/path_latency.c b/libmultipath/prioritizers/path_latency.c
index e155f6dc..2f5be9b9 100644
--- a/libmultipath/prioritizers/path_latency.c
+++ b/libmultipath/prioritizers/path_latency.c
@@ -64,7 +64,7 @@ static int prepare_directio_read(int fd, int *blksz, char **pbuf,
long flags;
if (ioctl(fd, BLKBSZGET, blksz) < 0) {
- pp_pl_log(3,"catnnot get blocksize, set default");
+ pp_pl_log(3,"cannot get blocksize, set default");
*blksz = DEF_BLK_SIZE;
}
if (posix_memalign((void **)pbuf, pgsize, *blksz))
@@ -193,7 +193,7 @@ out:
}
/*
- * Do not scale the prioriy in a certain range such as [0, 1024]
+ * Do not scale the priority in a certain range such as [0, 1024]
* because scaling will eliminate the effect of base_num.
*/
int calcPrio(double lg_avglatency, double lg_maxavglatency,
diff --git a/libmultipath/strbuf.h b/libmultipath/strbuf.h
index 41d7d54f..31ab519a 100644
--- a/libmultipath/strbuf.h
+++ b/libmultipath/strbuf.h
@@ -159,7 +159,7 @@ int fill_strbuf(struct strbuf *buf, char c, int slen);
*
* Appends the given string to @strbuf, with leading and trailing double
* quotes (") added, expanding @strbuf's size as necessary. Any double quote
- * characters (") in the string are transformed to double double quotes ("").
+ * characters (") in the string are transformed to a pair of double quotes ("").
* If the function returns an error, @strbuf is unchanged.
*/
int append_strbuf_quoted(struct strbuf *buf, const char *str);
@@ -171,7 +171,7 @@ int append_strbuf_quoted(struct strbuf *buf, const char *str);
* @returns: number of appended characters if successful, (excluding
* terminating '\0'); negative error code otherwise
*
- * Appends the the arguments following @fmt, formatted as in printf(), to
+ * Appends the arguments following @fmt, formatted as in printf(), to
* @strbuf, expanding @strbuf's size as necessary. The function makes sure that
* the output @strbuf is always 0-terminated.
* If the function returns an error, @strbuf is unchanged.
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index a69f0643..645896c6 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -205,7 +205,7 @@ static bool update_pathvec_from_dm(vector pathvec, struct multipath *mpp,
continue;
/*
- * At this point, pp->udev is valid and and pp->wwid
+ * At this point, pp->udev is valid and pp->wwid
* is the best we could get
*/
if (*pp->wwid && strcmp(mpp->wwid, pp->wwid)) {
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 5793af94..57447ca0 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -373,7 +373,7 @@ uevent_filter(struct uevent *later, struct uevent_filter_state *st)
list_for_some_entry_reverse_safe(earlier, tmp, &later->node, &st->uevq, node) {
/*
- * filter unnessary earlier uevents
+ * filter unnecessary earlier uevents
* by the later uevent
*/
if (!list_empty(&earlier->merge_node)) {
diff --git a/libmultipath/valid.h b/libmultipath/valid.h
index ce1c7cbf..731e6eff 100644
--- a/libmultipath/valid.h
+++ b/libmultipath/valid.h
@@ -23,7 +23,7 @@
* already.
* PATH_IS_VALID is returned by is_path_valid, when the path is
* valid only if it hasn't been released to systemd already.
- * PATH_IS_MAYBE_VALID is returned when the the path would be valid
+ * PATH_IS_MAYBE_VALID is returned when the path would be valid
* if other paths with the same wwid existed. It is up to the caller
* to check for these other paths.
*/
diff --git a/mpathpersist/main.c b/mpathpersist/main.c
index 4bdd55c2..894e8c94 100644
--- a/mpathpersist/main.c
+++ b/mpathpersist/main.c
@@ -480,7 +480,7 @@ static int handle_args(int argc, char * argv[], int nline)
}
if ((verbose > 2) && num_transportids)
{
- fprintf (stderr, "number of tranport-ids decoded from "
+ fprintf (stderr, "number of transport-ids decoded from "
"command line : %d\n", num_transportids);
}
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index c2d34f18..853e0feb 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -455,7 +455,7 @@ precedence. See KNOWN ISSUES.
(Since kernel 2.6.38) Number of msecs before pg_init retry, it must be between 0 and 60000.
.TP
.I queue_mode <mode>
-(Since kernel 4.8) Select the the queueing mode per multipath device.
+(Since kernel 4.8) Select the queueing mode per multipath device.
<mode> can be \fIbio\fR, \fIrq\fR or \fImq\fR, which corresponds to
bio-based, request-based, and block-multiqueue (blk-mq) request-based,
respectively.
@@ -935,7 +935,7 @@ This option is not supported any more. The value is ignored.
.B san_path_err_threshold
If set to a value greater than 0, multipathd will watch paths and check how many
times a path has been failed due to errors.If the number of failures on a particular
-path is greater then the san_path_err_threshold, then the path will not reinstate
+path is greater than the san_path_err_threshold, then the path will not reinstate
till san_path_err_recovery_time. These path failures should occur within a
san_path_err_forget_rate checks, if not we will consider the path is good enough
to reinstantate. See "Shaky paths detection" below.
@@ -949,7 +949,7 @@ The default is: \fBno\fR
.B san_path_err_forget_rate
If set to a value greater than 0, multipathd will check whether the path failures
has exceeded the san_path_err_threshold within this many checks i.e
-san_path_err_forget_rate . If so we will not reinstante the path till
+san_path_err_forget_rate . If so we will not reinstate the path till
san_path_err_recovery_time. See "Shaky paths detection" below.
.RS
.TP
@@ -962,7 +962,7 @@ The default is: \fBno\fR
If set to a value greater than 0, multipathd will make sure that when path failures
has exceeded the san_path_err_threshold within san_path_err_forget_rate then the path
will be placed in failed state for san_path_err_recovery_time duration.Once san_path_err_recovery_time
-has timeout we will reinstante the failed path .
+has timeout we will reinstate the failed path .
san_path_err_recovery_time value should be in secs.
See "Shaky paths detection" below.
.RS
@@ -1000,7 +1000,7 @@ If the rate of IO error on a particular path is greater than the
\fImarginal_path_err_rate_threshold\fR, then the path will not reinstate for
\fImarginal_path_err_recheck_gap_time\fR seconds unless there is only one
active path. After \fImarginal_path_err_recheck_gap_time\fR expires, the path
-will be requeueed for rechecking. If checking result is good enough, the
+will be requeued for rechecking. If checking result is good enough, the
path will be reinstated. See "Shaky paths detection" below.
.RS
.TP
@@ -1031,7 +1031,7 @@ value, the failed path of which the IO error rate is larger than
\fImarginal_path_err_rate_threshold\fR will be kept in failed state for
\fImarginal_path_err_recheck_gap_time\fR seconds. When
\fImarginal_path_err_recheck_gap_time\fR seconds expires, the path will be
-requeueed for checking. If checking result is good enough, the path will be
+requeued for checking. If checking result is good enough, the path will be
reinstated, or else it will keep failed. See "Shaky paths detection" below.
.RS
.TP
@@ -1379,7 +1379,7 @@ The protocol that a path is using can be viewed by running
\fBmultipathd show paths format "%d %P"\fR
.RE
.LP
-For every device, these 5 blacklist criteria are evaluated in the the order
+For every device, these 5 blacklist criteria are evaluated in the order
"property, dev\%node, device, protocol, wwid". If a device turns out to be
blacklisted by any criterion, it's excluded from handling by multipathd, and
the later criteria aren't evaluated any more. For each
diff --git a/multipathd/main.c b/multipathd/main.c
index a160c824..defee10a 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -583,7 +583,7 @@ retry:
if (mpp->prflag) {
vector_foreach_slot(mpp->paths, pp, i) {
if ((pp->state == PATH_UP) || (pp->state == PATH_GHOST)) {
- /* persistent reseravtion check*/
+ /* persistent reservation check*/
mpath_pr_event_handle(pp);
}
}
@@ -1515,7 +1515,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
condlog(3, "%s: error in change_foreign", __func__);
break;
default:
- condlog(1, "%s: return code %d of change_forein is unsupported",
+ condlog(1, "%s: return code %d of change_foreign is unsupported",
__func__, rc);
break;
}
@@ -1966,7 +1966,7 @@ ghost_delay_tick(struct vectors *vecs)
}
static void
-defered_failback_tick (vector mpvec)
+deferred_failback_tick (vector mpvec)
{
struct multipath * mpp;
unsigned int i;
@@ -2186,7 +2186,7 @@ static int check_path_reinstate_state(struct path * pp) {
get_monotonic_time(&curr_time);
/* when path failures has exceeded the san_path_err_threshold
* place the path in delayed state till san_path_err_recovery_time
- * so that the cutomer can rectify the issue within this time. After
+ * so that the customer can rectify the issue within this time. After
* the completion of san_path_err_recovery_time it should
* automatically reinstate the path
* (note: we know that san_path_err_threshold > 0 here).
@@ -2647,7 +2647,7 @@ checkerloop (void *ap)
pthread_cleanup_push(cleanup_lock, &vecs->lock);
lock(&vecs->lock);
pthread_testcancel();
- defered_failback_tick(vecs->mpvec);
+ deferred_failback_tick(vecs->mpvec);
retry_count_tick(vecs->mpvec);
missing_uev_wait_tick(vecs);
ghost_delay_tick(vecs);
diff --git a/tests/directio.c b/tests/directio.c
index 20ccc47a..01fdef28 100644
--- a/tests/directio.c
+++ b/tests/directio.c
@@ -497,7 +497,7 @@ static void test_free_with_pending(void **state)
do_libcheck_reset(1);
}
-/* test removing orpahed aio_group on free */
+/* test removing orphaned aio_group on free */
static void test_orphaned_aio_group(void **state)
{
struct checker c[AIO_GROUP_SIZE] = {{.cls = NULL}};
diff --git a/tests/hwtable.c b/tests/hwtable.c
index bfaf613f..334b75e8 100644
--- a/tests/hwtable.c
+++ b/tests/hwtable.c
@@ -29,7 +29,7 @@
#define N_CONF_FILES 2
-static const char tmplate[] = "/tmp/hwtable-XXXXXX";
+static const char template[] = "/tmp/hwtable-XXXXXX";
struct key_value {
const char *key;
@@ -136,7 +136,7 @@ static int setup(void **state)
if (hwt == NULL)
return -1;
- snprintf(buf, sizeof(buf), "%s", tmplate);
+ snprintf(buf, sizeof(buf), "%s", template);
if (mkdtemp(buf) == NULL) {
condlog(0, "mkdtemp: %s", strerror(errno));
goto err;
@@ -255,7 +255,7 @@ static void write_defaults(const struct hwt_state *hwt)
{ "detect_prio", "no" },
{ "detect_checker", "no" },
};
- char buf[sizeof(tmplate) + sizeof(bindings_name)];
+ char buf[sizeof(template) + sizeof(bindings_name)];
char dirbuf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/%s", hwt->tmpname, bindings_name);
@@ -308,7 +308,7 @@ static void write_device(FILE *ff, int nkv, const struct key_value *kv)
}
/*
- * Some macros to avoid boilerplace code
+ * Some macros to avoid boilerplate code
*/
#define CHECK_STATE(state) ({ \
@@ -448,7 +448,7 @@ static const struct key_value npr_queue = { _no_path_retry, "queue" };
/***** BEGIN TESTS SECTION *****/
/*
- * Dump the configuration, subistitute the dumped configuration
+ * Dump the configuration, substitute the dumped configuration
* for the current one, and verify that the result is identical.
*/
static void replicate_config(const struct hwt_state *hwt, bool local)
diff --git a/tests/mpathvalid.c b/tests/mpathvalid.c
index 0230a88f..df66ed6a 100644
--- a/tests/mpathvalid.c
+++ b/tests/mpathvalid.c
@@ -399,7 +399,7 @@ static void test_mpathvalid_is_path_good3(void **state)
free(wwid);
}
-/* mabybe valid with no matching paths */
+/* maybe valid with no matching paths */
static void test_mpathvalid_is_path_good4(void **state)
{
const char *wwids[] = { "WWID_A", "WWID_B", "WWID_C", "WWID_D" };
diff --git a/tests/pgpolicy.c b/tests/pgpolicy.c
index f116d12c..43be831f 100644
--- a/tests/pgpolicy.c
+++ b/tests/pgpolicy.c
@@ -191,7 +191,7 @@ verify_pathgroups(struct multipath *mp, struct path *pp, int **groups,
/* Test names instead of pointers to get a more
* useful error message */
assert_string_equal(pgp_path->dev, pp_path->dev);
- /* This test is just a backkup in case the
+ /* This test is just a backup in case the
* something wenth wrong naming the paths */
assert_ptr_equal(pgp_path, pp_path);
}
diff --git a/tests/valid.c b/tests/valid.c
index e7393a1c..398b771e 100644
--- a/tests/valid.c
+++ b/tests/valid.c
@@ -293,7 +293,7 @@ static void test_sysfs_is_multipathed(void **state)
memset(&pp, 0, sizeof(pp));
conf.find_multipaths = FIND_MULTIPATHS_STRICT;
- /* test for already existing multiapthed device */
+ /* test for already existing multipathed device */
will_return(__wrap_sysfs_is_multipathed, true);
will_return(__wrap_sysfs_is_multipathed, wwid);
assert_int_equal(is_path_valid(name, &conf, &pp, true),
@@ -452,7 +452,7 @@ static void test_greedy(void **state)
assert_string_equal(pp.dev, name);
assert_ptr_equal(pp.udev, &test_udev);
assert_string_equal(pp.wwid, wwid);
- /* test greedy success without checking multiapthd */
+ /* test greedy success without checking multipathd */
memset(&pp, 0, sizeof(pp));
setup_passing(name, wwid, CHECK_MPATHD_SKIP, STAGE_IS_FAILED);
assert_int_equal(is_path_valid(name, &conf, &pp, false),
diff --git a/third-party/valgrind/valgrind.h b/third-party/valgrind/valgrind.h
index 577c8f05..1633b318 100644
--- a/third-party/valgrind/valgrind.h
+++ b/third-party/valgrind/valgrind.h
@@ -1075,7 +1075,7 @@ typedef
/* Use these to write the name of your wrapper. NOTE: duplicates
VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. NOTE also: inserts
- the default behaviour equivalance class tag "0000" into the name.
+ the default behaviour equivalence class tag "0000" into the name.
See pub_tool_redir.h for details -- normally you don't need to
think about this, though. */
@@ -1620,11 +1620,11 @@ typedef
and say that %r15 is trashed instead. gcc seems happy to go with
that.
- Oh .. and this all needs to be conditionalised so that it is
+ Oh .. and this all needs to be conditionalized so that it is
unchanged from before this commit, when compiled with older gccs
that don't support __builtin_dwarf_cfa. Furthermore, since
this header file is freestanding, it has to be independent of
- config.h, and so the following conditionalisation cannot depend on
+ config.h, and so the following conditionalization cannot depend on
configure time checks.
Although it's not clear from
@@ -1673,7 +1673,7 @@ typedef
/* NB 9 Sept 07. There is a nasty kludge here in all these CALL_FN_
macros. In order not to trash the stack redzone, we need to drop
%rsp by 128 before the hidden call, and restore afterwards. The
- nastyness is that it is only by luck that the stack still appears
+ nastiness is that it is only by luck that the stack still appears
to be unwindable during the hidden call - since then the behaviour
of any routine using this macro does not match what the CFI data
says. Sigh.

View File

@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 27 Sep 2022 12:14:09 +0200
Subject: [PATCH] multipath: avoid NULL string in released_to_systemd()
Fixes: b28c406 ("multipath -u: don't grab devices already passed to system")
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/multipath/main.c b/multipath/main.c
index 7b69a3ce..b9f360b4 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -435,7 +435,8 @@ static bool released_to_systemd(void)
bool ret;
ret = dm_mp_dev_path != NULL && !strcmp(dm_mp_dev_path, "0");
- condlog(4, "%s: %s=%s -> %d", __func__, dmdp, dm_mp_dev_path, ret);
+ condlog(4, "%s: %s=%s -> %d", __func__, dmdp,
+ dm_mp_dev_path ? dm_mp_dev_path : "", ret);
return ret;
}

View File

@ -1,57 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Thu, 21 Jul 2022 19:22:04 +0200
Subject: [PATCH] multipath-tools: remove list of rebranded arrays vendors from
man page
It does not provide useful info, and it is incomplete.
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/multipath.conf.5 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 853e0feb..8b7dc511 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -315,12 +315,12 @@ accepts the optional prio_arg \fIexclusive_pref_bit\fR.
.TP
.I ontap
(Hardware-dependent)
-Generate the path priority for NetApp ONTAP class and OEM arrays as IBM NSeries.
+Generate the path priority for NetApp ONTAP class, and rebranded arrays.
.TP
.I rdac
(Hardware-dependent)
Generate the path priority for LSI/Engenio/NetApp RDAC class as NetApp SANtricity
-E/EF Series, and OEM arrays from IBM DELL SGI STK and SUN.
+E/EF Series, and rebranded arrays.
.TP
.I hp_sw
(Hardware-dependent)
@@ -496,7 +496,7 @@ Active/Standby mode exclusively.
.I rdac
(Hardware-dependent)
Check the path state for LSI/Engenio/NetApp RDAC class as NetApp SANtricity E/EF
-Series, and OEM arrays from IBM DELL SGI STK and SUN.
+Series, and rebranded arrays.
.TP
.I directio
Read the first sector with direct I/O. This checker could cause spurious path
@@ -1568,7 +1568,7 @@ families.
.I 1 rdac
(Hardware-dependent)
Hardware handler for LSI/Engenio/NetApp RDAC class as NetApp SANtricity E/EF
-Series, and OEM arrays from IBM DELL SGI STK and SUN.
+Series, and rebranded arrays.
.TP
.I 1 hp_sw
(Hardware-dependent)

View File

@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 27 Sep 2022 12:28:26 +0200
Subject: [PATCH] libmultipath: avoid NULL string in is_udev_ready()
Fixes: 2b25a9e ("libmultipath: select_action(): force udev reload for uninitialized maps")
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index e5249fc1..e551047a 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -662,7 +662,8 @@ static bool is_udev_ready(struct multipath *cmpp)
env = udev_device_get_property_value(mpp_ud, "MPATH_DEVICE_READY");
rc = (env != NULL && !strcmp(env, "1"));
udev_device_unref(mpp_ud);
- condlog(4, "%s: %s: \"%s\" -> %d\n", __func__, cmpp->alias, env, rc);
+ condlog(4, "%s: %s: \"%s\" -> %d\n", __func__, cmpp->alias,
+ env ? env : "", rc);
return rc;
}

View File

@ -1,47 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Sat, 23 Jul 2022 00:01:13 +0200
Subject: [PATCH] multipath-tools: correct CLARiiON info from multipath.conf
man page
Remove "Unity" from emc prio and hardware_handler, because
Unity does not support PNR mode, just ALUA (page 113 and 153):
https://www.delltechnologies.com/asset/en-us/products/storage/technical-support/docu5128.pdf
And add PNR info.
Cc: Yanfei Chen <vincent.chen1@dell.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/multipath.conf.5 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 8b7dc511..acdd1ae6 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -306,7 +306,7 @@ generate the path priority. This prioritizer accepts the optional prio_arg
.I emc
(Hardware-dependent)
Generate the path priority for DGC class arrays as CLARiiON CX/AX and
-EMC VNX and Unity families.
+EMC VNX families with Failover Mode 1 (Passive Not Ready(PNR)).
.TP
.I alua
(Hardware-dependent)
@@ -1562,8 +1562,8 @@ The following hardware handler are implemented:
.TP 12
.I 1 emc
(Hardware-dependent)
-Hardware handler for DGC class arrays as CLARiiON CX/AX and EMC VNX and Unity
-families.
+Hardware handler for DGC class arrays as CLARiiON CX/AX and EMC VNX families
+with Failover Mode 1 (Passive Not Ready(PNR)).
.TP
.I 1 rdac
(Hardware-dependent)

View File

@ -0,0 +1,115 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 9 Nov 2022 15:49:41 -0600
Subject: [PATCH] libmultipath: impove add_feature() variable names
Use descriptive names, instead of single letters. No functional changes.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/structs.c | 63 +++++++++++++++++++++---------------------
1 file changed, 32 insertions(+), 31 deletions(-)
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 7a2ff589..f90bd0b6 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -604,65 +604,66 @@ first_path (const struct multipath * mpp)
return pgp?VECTOR_SLOT(pgp->paths, 0):NULL;
}
-int add_feature(char **f, const char *n)
+int add_feature(char **features_p, const char *new_feat)
{
- int c = 0, d, l;
- char *e, *t;
- const char *p;
+ int count = 0, new_count, len;
+ char *tmp, *feats;
+ const char *ptr;
- if (!f)
+ if (!features_p)
return 1;
/* Nothing to do */
- if (!n || *n == '\0')
+ if (!new_feat || *new_feat == '\0')
return 0;
- l = strlen(n);
- if (isspace(*n) || isspace(*(n + l - 1))) {
- condlog(0, "internal error: feature \"%s\" has leading or trailing spaces", n);
+ len = strlen(new_feat);
+ if (isspace(*new_feat) || isspace(*(new_feat + len - 1))) {
+ condlog(0, "internal error: feature \"%s\" has leading or trailing spaces",
+ new_feat);
return 1;
}
- p = n;
- d = 1;
- while (*p != '\0') {
- if (isspace(*p) && !isspace(*(p + 1)) && *(p + 1) != '\0')
- d++;
- p++;
+ ptr = new_feat;
+ new_count = 1;
+ while (*ptr != '\0') {
+ if (isspace(*ptr) && !isspace(*(ptr + 1)) && *(ptr + 1) != '\0')
+ new_count++;
+ ptr++;
}
/* default feature is null */
- if(!*f)
+ if(!*features_p)
{
- l = asprintf(&t, "%0d %s", d, n);
- if(l == -1)
+ len = asprintf(&feats, "%0d %s", new_count, new_feat);
+ if(len == -1)
return 1;
- *f = t;
+ *features_p = feats;
return 0;
}
/* Check if feature is already present */
- e = *f;
- while ((e = strstr(e, n)) != NULL) {
- if (isspace(*(e - 1)) &&
- (isspace(*(e + l)) || *(e + l) == '\0'))
+ tmp = *features_p;
+ while ((tmp = strstr(tmp, new_feat)) != NULL) {
+ if (isspace(*(tmp - 1)) &&
+ (isspace(*(tmp + len)) || *(tmp + len) == '\0'))
return 0;
- e += l;
+ tmp += len;
}
/* Get feature count */
- c = strtoul(*f, &e, 10);
- if (*f == e || (!isspace(*e) && *e != '\0')) {
- condlog(0, "parse error in feature string \"%s\"", *f);
+ count = strtoul(*features_p, &tmp, 10);
+ if (*features_p == tmp || (!isspace(*tmp) && *tmp != '\0')) {
+ condlog(0, "parse error in feature string \"%s\"", *features_p);
return 1;
}
- c += d;
- if (asprintf(&t, "%0d%s %s", c, e, n) < 0)
+ count += new_count;
+ if (asprintf(&feats, "%0d%s %s", count, tmp, new_feat) < 0)
return 1;
- free(*f);
- *f = t;
+ free(*features_p);
+ *features_p = feats;
return 0;
}

View File

@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Sat, 23 Jul 2022 15:12:04 +0200
Subject: [PATCH] multipath-tools: add basic info on how to use multipath-tools
with NVMe devices
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/README.md b/README.md
index 2322082c..b05b1332 100644
--- a/README.md
+++ b/README.md
@@ -174,3 +174,19 @@ To enable ALUA, the following options should be changed:
- Huawei OceanStor:
"Host Access Mode" should be changed to "Asymmetric".
+
+
+NVMe
+====
+To use Device Mapper/multipath-tools with NVMe devices,
+if the Native NVMe Multipath subsystem is enabled
+( "Y" in `/sys/module/nvme_core/parameters/multipath` ),
+it has to be disabled:
+
+`echo "options nvme_core multipath=N" > /etc/modprobe.d/01-nvme_core-mp.conf`,
+regenerate the initramfs (`dracut -f` or `update-initramfs`) and reboot.
+
+Check that it is disabled(N) with:
+`cat /sys/module/nvme_core/parameters/multipath`
+or
+`systool -m nvme_core -A multipath`

View File

@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 9 Nov 2022 15:49:42 -0600
Subject: [PATCH] multipathd: don't initialize the field width in show_path()
It's not used, so don't set it up.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipathd/cli_handlers.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 5f0dd04e..e65fb75c 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -67,12 +67,7 @@ static int
show_path (struct strbuf *reply, struct vectors *vecs, struct path *pp,
char *style)
{
- fieldwidth_t *width __attribute__((cleanup(cleanup_ucharp))) = NULL;
-
- if ((width = alloc_path_layout()) == NULL)
- return 1;
- get_path_layout(vecs->pathvec, 1, width);
- if (snprint_path(reply, style, pp, 0) < 0)
+ if (snprint_path(reply, style, pp, NULL) < 0)
return 1;
return 0;
}

View File

@ -1,90 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Aug 2022 16:46:26 -0500
Subject: [PATCH] multipathd: factor out the code to flush a map with no paths
The code to flush a multipath device because all of its paths have
been removed will be used by another caller, so factor it out of
ev_remove_path().
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipathd/main.c | 56 ++++++++++++++++++++++++-----------------------
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index defee10a..53cbdb61 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -561,6 +561,30 @@ int update_multipath (struct vectors *vecs, char *mapname, int reset)
return 0;
}
+static bool
+flush_map_nopaths(struct multipath *mpp, struct vectors *vecs) {
+ char alias[WWID_SIZE];
+
+ /*
+ * flush_map will fail if the device is open
+ */
+ strlcpy(alias, mpp->alias, WWID_SIZE);
+ if (mpp->flush_on_last_del == FLUSH_ENABLED) {
+ condlog(2, "%s Last path deleted, disabling queueing",
+ mpp->alias);
+ mpp->retry_tick = 0;
+ mpp->no_path_retry = NO_PATH_RETRY_FAIL;
+ mpp->disable_queueing = 1;
+ mpp->stat_map_failures++;
+ dm_queue_if_no_path(mpp->alias, 0);
+ }
+ if (!flush_map(mpp, vecs, 1)) {
+ condlog(2, "%s: removed map after removing all paths", alias);
+ return true;
+ }
+ return false;
+}
+
static int
update_map (struct multipath *mpp, struct vectors *vecs, int new_map)
{
@@ -1363,34 +1387,12 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)
vector_del_slot(mpp->paths, i);
/*
- * remove the map IF removing the last path
+ * remove the map IF removing the last path. If
+ * flush_map_nopaths succeeds, the path has been removed.
*/
- if (VECTOR_SIZE(mpp->paths) == 0) {
- char alias[WWID_SIZE];
-
- /*
- * flush_map will fail if the device is open
- */
- strlcpy(alias, mpp->alias, WWID_SIZE);
- if (mpp->flush_on_last_del == FLUSH_ENABLED) {
- condlog(2, "%s Last path deleted, disabling queueing", mpp->alias);
- mpp->retry_tick = 0;
- mpp->no_path_retry = NO_PATH_RETRY_FAIL;
- mpp->disable_queueing = 1;
- mpp->stat_map_failures++;
- dm_queue_if_no_path(mpp->alias, 0);
- }
- if (!flush_map(mpp, vecs, 1)) {
- condlog(2, "%s: removed map after"
- " removing all paths",
- alias);
- /* flush_map() has freed the path */
- goto out;
- }
- /*
- * Not an error, continue
- */
- }
+ if (VECTOR_SIZE(mpp->paths) == 0 &&
+ flush_map_nopaths(mpp, vecs))
+ goto out;
if (setup_map(mpp, &params, vecs)) {
condlog(0, "%s: failed to setup map for"

View File

@ -0,0 +1,144 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 9 Nov 2022 15:49:43 -0600
Subject: [PATCH] libmultipath: improve remove_feature() variable names
Use descriptive names, instead of single letters. No functional changes.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/structs.c | 80 +++++++++++++++++++++---------------------
1 file changed, 40 insertions(+), 40 deletions(-)
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index f90bd0b6..87e84d5d 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -668,86 +668,86 @@ int add_feature(char **features_p, const char *new_feat)
return 0;
}
-int remove_feature(char **f, const char *o)
+int remove_feature(char **features_p, const char *old_feat)
{
- int c = 0, d;
- char *e, *p, *n;
- const char *q;
+ int count = 0, len;
+ char *feats_start, *ptr, *new;
- if (!f || !*f)
+ if (!features_p || !*features_p)
return 1;
/* Nothing to do */
- if (!o || *o == '\0')
+ if (!old_feat || *old_feat == '\0')
return 0;
- d = strlen(o);
- if (isspace(*o) || isspace(*(o + d - 1))) {
- condlog(0, "internal error: feature \"%s\" has leading or trailing spaces", o);
+ len = strlen(old_feat);
+ if (isspace(*old_feat) || isspace(*(old_feat + len - 1))) {
+ condlog(0, "internal error: feature \"%s\" has leading or trailing spaces",
+ old_feat);
return 1;
}
/* Check if present and not part of a larger feature token*/
- p = *f + 1; /* the size must be at the start of the features string */
- while ((p = strstr(p, o)) != NULL) {
- if (isspace(*(p - 1)) &&
- (isspace(*(p + d)) || *(p + d) == '\0'))
+ ptr = *features_p + 1;
+ while ((ptr = strstr(ptr, old_feat)) != NULL) {
+ if (isspace(*(ptr - 1)) &&
+ (isspace(*(ptr + len)) || *(ptr + len) == '\0'))
break;
- p += d;
+ ptr += len;
}
- if (!p)
+ if (!ptr)
return 0;
/* Get feature count */
- c = strtoul(*f, &e, 10);
- if (*f == e || !isspace(*e)) {
- condlog(0, "parse error in feature string \"%s\"", *f);
+ count = strtoul(*features_p, &feats_start, 10);
+ if (*features_p == feats_start || !isspace(*feats_start)) {
+ condlog(0, "parse error in feature string \"%s\"", *features_p);
return 1;
}
/* Update feature count */
- c--;
- q = o;
- while (*q != '\0') {
- if (isspace(*q) && !isspace(*(q + 1)) && *(q + 1) != '\0')
- c--;
- q++;
+ count--;
+ while (*old_feat != '\0') {
+ if (isspace(*old_feat) && !isspace(*(old_feat + 1)) &&
+ *(old_feat + 1) != '\0')
+ count--;
+ old_feat++;
}
/* Quick exit if all features have been removed */
- if (c == 0) {
- n = malloc(2);
- if (!n)
+ if (count == 0) {
+ new = malloc(2);
+ if (!new)
return 1;
- strcpy(n, "0");
+ strcpy(new, "0");
goto out;
}
/* Update feature count space */
- n = malloc(strlen(*f) - d + 1);
- if (!n)
+ new = malloc(strlen(*features_p) - len + 1);
+ if (!new)
return 1;
/* Copy the feature count */
- sprintf(n, "%0d", c);
+ sprintf(new, "%0d", count);
/*
* Copy existing features up to the feature
* about to be removed
*/
- strncat(n, e, (size_t)(p - e));
+ strncat(new, feats_start, (size_t)(ptr - feats_start));
/* Skip feature to be removed */
- p += d;
+ ptr += len;
/* Copy remaining features */
- while (isspace(*p))
- p++;
- if (*p != '\0')
- strcat(n, p);
+ while (isspace(*ptr))
+ ptr++;
+ if (*ptr != '\0')
+ strcat(new, ptr);
else
- strchop(n);
+ strchop(new);
out:
- free(*f);
- *f = n;
+ free(*features_p);
+ *features_p = new;
return 0;
}

View File

@ -1,47 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Aug 2022 16:46:27 -0500
Subject: [PATCH] libmultipath: return success if we raced to remove a map and
lost
_dm_flush_map() was returning failure if it failed to remove a map,
even if that was because the map had already been removed. Return
success in this case.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/devmapper.c | 4 ++++
multipathd/main.c | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 1748d258..a49db3b0 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -1111,6 +1111,10 @@ int _dm_flush_map (const char * mapname, int need_sync, int deferred_remove,
}
condlog(4, "multipath map %s removed", mapname);
return 0;
+ } else if (dm_is_mpath(mapname) != 1) {
+ condlog(4, "multipath map %s removed externally",
+ mapname);
+ return 0; /*we raced with someone else removing it */
} else {
condlog(2, "failed to remove multipath map %s",
mapname);
diff --git a/multipathd/main.c b/multipathd/main.c
index 53cbdb61..3fcd6bdb 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -758,10 +758,6 @@ flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths)
* the spurious uevent we may generate with the dm_flush_map call below
*/
if (r) {
- /*
- * May not really be an error -- if the map was already flushed
- * from the device mapper by dmsetup(8) for instance.
- */
if (r == 1)
condlog(0, "%s: can't flush", mpp->alias);
else {

View File

@ -0,0 +1,66 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 13 Apr 2017 07:22:23 -0500
Subject: [PATCH] RH: fixup udev rules for redhat
The multipath rules need to run after scsi_id is run. This means moving
them after 60-persistent-storage.rules for redhat. Redhat also uses a
different naming scheme for partitions than SuSE.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 4 ++--
kpartx/kpartx.rules | 2 +-
multipath/Makefile | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 866ab274..8c5a08a2 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -34,9 +34,9 @@ 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)
+usr_prefix := $(prefix)/usr
# Where to install systemd-related files. systemd is usually installed under /usr
# Note: some systemd installations use separate "prefix" and "rootprefix".
# In this case, override only unitdir to use systemd's "rootprefix" instead of $(systemd_prefix)
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index 1969dee0..d2b28233 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -39,6 +39,6 @@ LABEL="mpath_kpartx_end"
GOTO="kpartx_end"
LABEL="run_kpartx"
-RUN+="/sbin/kpartx -un -p -part /dev/$name"
+RUN+="/sbin/kpartx -un /dev/$name"
LABEL="kpartx_end"
diff --git a/multipath/Makefile b/multipath/Makefile
index 73db991a..b3c2cc81 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -24,7 +24,7 @@ install:
$(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

View File

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Aug 2022 16:46:28 -0500
Subject: [PATCH] multipathd: Handle losing all path in update_map
Its possible that when a multipath device is being updated, it will end
up that all the paths for it are gone. This can happen if paths are
added and then removed again before multipathd processes the uevent for
the newly created multipath device. In this case multipathd wasn't
taking the proper action for the case where all the paths had been
removed. If flush_on_last_del was set, multipathd wasn't disabling
flushing and if deferred_remove was set, it wasn't doing a deferred
remove. Multipathd should call flush_map_nopaths(), just like
ev_remove_path() does when the last path is removed.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipathd/main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/multipathd/main.c b/multipathd/main.c
index 3fcd6bdb..7d127dbe 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -602,6 +602,10 @@ retry:
goto fail;
}
verify_paths(mpp);
+ if (VECTOR_SIZE(mpp->paths) == 0 &&
+ flush_map_nopaths(mpp, vecs))
+ return 1;
+
mpp->action = ACT_RELOAD;
if (mpp->prflag) {

View File

@ -43,10 +43,10 @@ index 8d15d2ea..eff690fd 100644
udev_device_get_properties_list_entry(udev)) { udev_device_get_properties_list_entry(udev)) {
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index acdd1ae6..5ab770ba 100644 index 1fea9d5a..eef3c605 100644
--- a/multipath/multipath.conf.5 --- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5
@@ -1348,9 +1348,14 @@ keywords. Both are regular expressions. For a full description of these keywords @@ -1353,9 +1353,14 @@ keywords. Both are regular expressions. For a full description of these keywords
Regular expression for an udev property. All Regular expression for an udev property. All
devices that have matching udev properties will be excluded/included. devices that have matching udev properties will be excluded/included.
The handling of the \fIproperty\fR keyword is special, The handling of the \fIproperty\fR keyword is special,
@ -62,7 +62,7 @@ index acdd1ae6..5ab770ba 100644
. .
.RS .RS
.PP .PP
@@ -1361,10 +1366,6 @@ Blacklisting by missing properties is only applied to devices which do have the @@ -1366,10 +1371,6 @@ Blacklisting by missing properties is only applied to devices which do have the
property specified by \fIuid_attribute\fR (e.g. \fIID_SERIAL\fR) property specified by \fIuid_attribute\fR (e.g. \fIID_SERIAL\fR)
set. Previously, it was applied to every device, possibly causing devices to be set. Previously, it was applied to every device, possibly causing devices to be
blacklisted because of temporary I/O error conditions. blacklisted because of temporary I/O error conditions.

View File

@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 5 Aug 2022 18:16:03 -0500
Subject: [PATCH] multipath: fix systemd timers in the initramfs
The systemd timers created for "find_multipaths smart" conflict with
shutdown.target, but not with initrd-cleanup.service. This can make
these timers trigger after the inirtd has started shutting down,
restarting multipathd (which then stops initrd-cleanup.service, since it
conflicts). To avoid this, make sure the timers and the unit they
trigger conflict with inird-cleanup.service. Also don't make them start
multipathd. "multipath -u" will not return "maybe" if multipathd isn't
running or set to run, and since we no longer wait for udev-settle,
multipathd starts up pretty quickly, so it shouldn't be a problem to
not trigger it here.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipath/multipath.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/multipath/multipath.rules b/multipath/multipath.rules
index 9df11a95..f993d996 100644
--- a/multipath/multipath.rules
+++ b/multipath/multipath.rules
@@ -71,7 +71,7 @@ ENV{.SAVED_FM_WAIT_UNTIL}=="?*", GOTO="pretend_mpath"
#
# We must trigger an "add" event because LVM2 will only act on those.
-RUN+="/usr/bin/systemd-run --unit=cancel-multipath-wait-$kernel --description 'cancel waiting for multipath siblings of $kernel' --no-block --timer-property DefaultDependencies=no --timer-property Conflicts=shutdown.target --timer-property Before=shutdown.target --timer-property AccuracySec=500ms --property DefaultDependencies=no --property Conflicts=shutdown.target --property Before=shutdown.target --property Wants=multipathd.service --property After=multipathd.service --on-active=$env{FIND_MULTIPATHS_WAIT_UNTIL} /usr/bin/udevadm trigger --action=add $sys$devpath"
+RUN+="/usr/bin/systemd-run --unit=cancel-multipath-wait-$kernel --description 'cancel waiting for multipath siblings of $kernel' --no-block --timer-property DefaultDependencies=no --timer-property Conflicts=shutdown.target --timer-property Before=shutdown.target --timer-property Conflicts=initrd-cleanup.service --timer-property Before=initrd-cleanup.service --timer-property AccuracySec=500ms --property DefaultDependencies=no --property Conflicts=shutdown.target --property Before=shutdown.target --property Conflicts=initrd-cleanup.service --property Before=initrd-cleanup.service --on-active=$env{FIND_MULTIPATHS_WAIT_UNTIL} /usr/bin/udevadm trigger --action=add $sys$devpath"
LABEL="pretend_mpath"
ENV{DM_MULTIPATH_DEVICE_PATH}="1"

View File

@ -14,17 +14,17 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
--- ---
libmultipath/config.c | 13 +++++++++++++ libmultipath/config.c | 13 +++++++++++++
libmultipath/config.h | 1 + libmultipath/config.h | 1 +
multipath/multipath.rules | 1 + multipath/multipath.rules.in | 1 +
multipathd/multipathd.8 | 2 ++ multipathd/multipathd.8 | 2 ++
multipathd/multipathd.service | 1 + multipathd/multipathd.service | 1 +
multipathd/multipathd.socket | 1 + multipathd/multipathd.socket | 1 +
6 files changed, 19 insertions(+) 6 files changed, 19 insertions(+)
diff --git a/libmultipath/config.c b/libmultipath/config.c diff --git a/libmultipath/config.c b/libmultipath/config.c
index ab8b26e7..f06fcbf9 100644 index 5c5c0726..183b319d 100644
--- a/libmultipath/config.c --- a/libmultipath/config.c
+++ b/libmultipath/config.c +++ b/libmultipath/config.c
@@ -955,6 +955,19 @@ int _init_config (const char *file, struct config *conf) @@ -966,6 +966,19 @@ int _init_config (const char *file, struct config *conf)
} }
factorize_hwtable(conf->hwtable, builtin_hwtable_size, file); factorize_hwtable(conf->hwtable, builtin_hwtable_size, file);
validate_pctable(conf->overrides, 0, file); validate_pctable(conf->overrides, 0, file);
@ -45,10 +45,10 @@ index ab8b26e7..f06fcbf9 100644
conf->processed_main_config = 1; conf->processed_main_config = 1;
diff --git a/libmultipath/config.h b/libmultipath/config.h diff --git a/libmultipath/config.h b/libmultipath/config.h
index fdcdff0a..affba937 100644 index 87947469..0dc89c16 100644
--- a/libmultipath/config.h --- a/libmultipath/config.h
+++ b/libmultipath/config.h +++ b/libmultipath/config.h
@@ -9,6 +9,7 @@ @@ -10,6 +10,7 @@
#define ORIGIN_DEFAULT 0 #define ORIGIN_DEFAULT 0
#define ORIGIN_CONFIG 1 #define ORIGIN_CONFIG 1
@ -56,10 +56,10 @@ index fdcdff0a..affba937 100644
enum devtypes { enum devtypes {
DEV_NONE, DEV_NONE,
diff --git a/multipath/multipath.rules b/multipath/multipath.rules diff --git a/multipath/multipath.rules.in b/multipath/multipath.rules.in
index f993d996..68c30644 100644 index 8d3cf33a..5c4447a2 100644
--- a/multipath/multipath.rules --- a/multipath/multipath.rules.in
+++ b/multipath/multipath.rules +++ b/multipath/multipath.rules.in
@@ -9,6 +9,7 @@ IMPORT{cmdline}="nompath" @@ -9,6 +9,7 @@ IMPORT{cmdline}="nompath"
ENV{nompath}=="?*", GOTO="end_mpath" ENV{nompath}=="?*", GOTO="end_mpath"
IMPORT{cmdline}="multipath" IMPORT{cmdline}="multipath"
@ -69,13 +69,13 @@ index f993d996..68c30644 100644
ENV{DEVTYPE}!="partition", GOTO="test_dev" ENV{DEVTYPE}!="partition", GOTO="test_dev"
IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH" IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH"
diff --git a/multipathd/multipathd.8 b/multipathd/multipathd.8 diff --git a/multipathd/multipathd.8 b/multipathd/multipathd.8
index 1e318bdc..6aab9325 100644 index bdf102eb..a16a0bd5 100644
--- a/multipathd/multipathd.8 --- a/multipathd/multipathd.8
+++ b/multipathd/multipathd.8 +++ b/multipathd/multipathd.8
@@ -39,6 +39,8 @@ map regains its maximum performance and redundancy. @@ -48,6 +48,8 @@ map regains its maximum performance and redundancy.
This daemon executes the external \fBmultipath\fR tool when events occur. With the \fB-k\fR option, \fBmultipathd\fR acts as a client utility that
In turn, the multipath tool signals the multipathd daemon when it is done with sends commands to a running instance of the multipathd daemon (see
devmap reconfiguration, so that it can refresh its failed path list. \fBCOMMANDS\fR below).
+ +
+In this Linux distribution, multipathd does not run unless a /etc/multipath.conf file exists. +In this Linux distribution, multipathd does not run unless a /etc/multipath.conf file exists.
. .

View File

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bastian Germann <bage@debian.org>
Date: Thu, 14 Oct 2021 00:34:33 +0200
Subject: [PATCH] multipathd: Add missing ctype include
In uxclnt.c, there are isspace calls. Add an explicit include.
Signed-off-by: Bastian Germann <bage@debian.org>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/uxclnt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c
index b1b058bd..bdcc7c3f 100644
--- a/multipathd/uxclnt.c
+++ b/multipathd/uxclnt.c
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
+#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>

View File

@ -1,102 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 12 Aug 2022 18:58:15 +0200
Subject: [PATCH] multipathd: replace libreadline with libedit
Linking multipathd with libreadline may cause a license conflict,
because libreadline is licensed under GPL-3.0-or-later, and
libmultipath contains several files under GPL-2.0.
See:
https://github.com/opensvc/multipath-tools/issues/36
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=979095
https://www.gnu.org/licenses/gpl-faq.html#AllCompatibility
Replace the readline functionality with libedit, which comes under
a BSD license. The readline library can still be enabled (e.g. for
binaries not intended to be distributed) by running
"make READLINE=libreadline".
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 5 +++++
multipathd/Makefile | 11 ++++++++++-
multipathd/cli.c | 5 +++++
multipathd/uxclnt.c | 6 ++++++
4 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/Makefile.inc b/Makefile.inc
index bcd2212a..ad7afd04 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -8,6 +8,11 @@
#
# Uncomment to disable dmevents polling support
# ENABLE_DMEVENTS_POLL = 0
+#
+# Readline library to use, libedit or libreadline
+# Caution: Using libreadline may make the multipathd binary undistributable,
+# see https://github.com/opensvc/multipath-tools/issues/36
+READLINE = libedit
# List of scsi device handler modules to load on boot, e.g.
# SCSI_DH_MODULES_PRELOAD := scsi_dh_alua scsi_dh_rdac
diff --git a/multipathd/Makefile b/multipathd/Makefile
index c937cd55..95acd887 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -22,7 +22,16 @@ CFLAGS += $(BIN_CFLAGS)
LDFLAGS += $(BIN_LDFLAGS)
LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
-L$(mpathcmddir) -lmpathcmd -ludev -ldl -lurcu -lpthread \
- -ldevmapper -lreadline
+ -ldevmapper
+
+ifeq ($(READLINE),libedit)
+CPPFLAGS += -DUSE_LIBEDIT
+LIBDEPS += -ledit
+endif
+ifeq ($(READLINE),libreadline)
+CPPFLAGS += -DUSE_LIBREADLINE
+LIBDEPS += -lreadline
+endif
ifdef SYSTEMD
CPPFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
diff --git a/multipathd/cli.c b/multipathd/cli.c
index b2ee9a99..fa482a67 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -11,7 +11,12 @@
#include "parser.h"
#include "util.h"
#include "version.h"
+#ifdef USE_LIBEDIT
+#include <editline/readline.h>
+#endif
+#ifdef USE_LIBREADLINE
#include <readline/readline.h>
+#endif
#include "mpath_cmd.h"
#include "cli.h"
diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c
index bdcc7c3f..251e7d75 100644
--- a/multipathd/uxclnt.c
+++ b/multipathd/uxclnt.c
@@ -16,8 +16,14 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <poll.h>
+
+#ifdef USE_LIBEDIT
+#include <editline/readline.h>
+#endif
+#ifdef USE_LIBREADLINE
#include <readline/readline.h>
#include <readline/history.h>
+#endif
#include "mpath_cmd.h"
#include "uxsock.h"

View File

@ -13,19 +13,19 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 18 insertions(+), 6 deletions(-) 1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc diff --git a/Makefile.inc b/Makefile.inc
index 03450610..2cf6e85f 100644 index 8c5a08a2..e6e7f7d7 100644
--- a/Makefile.inc --- a/Makefile.inc
+++ b/Makefile.inc +++ b/Makefile.inc
@@ -141,18 +141,30 @@ ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers @@ -74,19 +74,31 @@ INSTALL_PROGRAM := install
WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,) SYSTEMD_CPPFLAGS := $(if $(SYSTEMD),-DUSE_SYSTEMD=$(SYSTEMD))
WFORMATOVERFLOW := $(call TEST_CC_OPTION,-Wformat-overflow=2,) SYSTEMD_LIBDEPS := $(if $(SYSTEMD),$(if $(shell test $(SYSTEMD) -gt 209 && echo 1),-lsystemd,-lsystemd-daemon))
-OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4 -OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
-WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implicit-int \ -WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implicit-int \
+ifndef RPM_OPT_FLAGS +ifndef RPM_OPT_FLAGS
+ OPTFLAGS := -O2 -g -Wall $(FORTIFY_OPT) -fexceptions \ + OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4 \
+ $(STACKPROT) -grecord-gcc-switches \ + -Wall $(FORTIFY_OPT) -fexceptions -grecord-gcc-switches \
+ -fasynchronous-unwind-tables --param=ssp-buffer-size=4 + -fasynchronous-unwind-tables
+ ifeq ($(shell test -f /usr/lib/rpm/redhat/redhat-hardened-cc1 && echo 1),1) + ifeq ($(shell test -f /usr/lib/rpm/redhat/redhat-hardened-cc1 && echo 1),1)
+ OPTFLAGS += -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 + OPTFLAGS += -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
+ endif + endif
@ -39,17 +39,18 @@ index 03450610..2cf6e85f 100644
-Werror=implicit-function-declaration -Werror=format-security \ -Werror=implicit-function-declaration -Werror=format-security \
- $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) - $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS)
-CPPFLAGS := $(FORTIFY_OPT) \ -CPPFLAGS := $(FORTIFY_OPT) \
- -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" -DRUN_DIR=\"${RUN}\" \ - -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
+ $(WNOCLOBBERED) -Werror=cast-qual \ + $(WNOCLOBBERED) -Werror=cast-qual \
+ $(ERROR_DISCARDED_QUALIFIERS) -Wstrict-prototypes + $(ERROR_DISCARDED_QUALIFIERS) -Wstrict-prototypes
+CPPFLAGS := -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" -DRUN_DIR=\"${RUN}\" \ +CPPFLAGS := -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
-DRUNTIME_DIR=\"$(runtimedir)\" \
-DCONFIG_DIR=\"$(configdir)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP -DCONFIG_DIR=\"$(configdir)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
BIN_CFLAGS = -fPIE -DPIE BIN_CFLAGS := -fPIE -DPIE
LIB_CFLAGS = -fPIC LIB_CFLAGS := -fPIC
SHARED_FLAGS = -shared SHARED_FLAGS := -shared
-LDFLAGS := $(LDFLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -LDFLAGS := $(LDFLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs
+LDFLAGS := $(LDFLAGS) $(RPM_LD_FLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs +LDFLAGS := $(LDFLAGS) $(RPM_LD_FLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs
BIN_LDFLAGS = -pie BIN_LDFLAGS := -pie
# Check whether a function with name $1 has been declared in header file $2. # Source code directories. Don't modify.

View File

@ -1,42 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 12 Aug 2022 21:25:37 +0200
Subject: [PATCH] libmultipath: convert license of strbuf code to GPL-2.0+
This (partly) fixes the license incompatibility reported in
https://github.com/opensvc/multipath-tools/issues/36
As I'm the only author (except for a trivial spelling fix),
I see no issue with changing the license.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/strbuf.c | 2 +-
libmultipath/strbuf.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libmultipath/strbuf.c b/libmultipath/strbuf.c
index f654594d..e23b65e8 100644
--- a/libmultipath/strbuf.c
+++ b/libmultipath/strbuf.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2021 SUSE LLC
- * SPDX-License-Identifier: GPL-2.0-only
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <inttypes.h>
#include <stdint.h>
diff --git a/libmultipath/strbuf.h b/libmultipath/strbuf.h
index 31ab519a..ae863417 100644
--- a/libmultipath/strbuf.h
+++ b/libmultipath/strbuf.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2021 SUSE LLC
- * SPDX-License-Identifier: GPL-2.0-only
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef _STRBUF_H
#define _STRBUF_H

View File

@ -21,10 +21,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
create mode 100644 multipath/mpathconf.8 create mode 100644 multipath/mpathconf.8
diff --git a/libmultipath/config.c b/libmultipath/config.c diff --git a/libmultipath/config.c b/libmultipath/config.c
index f06fcbf9..e2840839 100644 index 183b319d..01f36a4f 100644
--- a/libmultipath/config.c --- a/libmultipath/config.c
+++ b/libmultipath/config.c +++ b/libmultipath/config.c
@@ -957,6 +957,8 @@ int _init_config (const char *file, struct config *conf) @@ -968,6 +968,8 @@ int _init_config (const char *file, struct config *conf)
validate_pctable(conf->overrides, 0, file); validate_pctable(conf->overrides, 0, file);
} else { } else {
condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices."); condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
@ -34,36 +34,39 @@ index f06fcbf9..e2840839 100644
conf->blist_devnode = vector_alloc(); conf->blist_devnode = vector_alloc();
if (!conf->blist_devnode) { if (!conf->blist_devnode) {
diff --git a/multipath/Makefile b/multipath/Makefile diff --git a/multipath/Makefile b/multipath/Makefile
index d2b3fd82..00e46a0d 100644 index b3c2cc81..413294ef 100644
--- a/multipath/Makefile --- a/multipath/Makefile
+++ b/multipath/Makefile +++ b/multipath/Makefile
@@ -21,6 +21,7 @@ $(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so @@ -22,6 +22,7 @@ $(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so
install: install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
+ $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/ + $(Q)$(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir) $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) $(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(udevrulesdir)/62-multipath.rules $(Q)$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/62-multipath.rules
@@ -30,6 +31,7 @@ install: @@ -31,6 +32,7 @@ install:
$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir) $(Q)$(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(man5dir) $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 mpathconf.8 $(DESTDIR)$(man8dir) + $(Q)$(INSTALL_PROGRAM) -m 644 mpathconf.8 $(DESTDIR)$(mandir)/man8
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man5
$(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(mandir)/man5
ifneq ($(SCSI_DH_MODULES_PRELOAD),) ifneq ($(SCSI_DH_MODULES_PRELOAD),)
$(INSTALL_PROGRAM) -m 644 scsi_dh.conf $(DESTDIR)$(modulesloaddir)/scsi_dh.conf @@ -41,11 +43,13 @@ endif
for _x in $(SCSI_DH_MODULES_PRELOAD); do echo "$$_x"; done \
@@ -42,8 +44,10 @@ uninstall: uninstall:
$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC)
$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf + $(Q)$(RM) $(DESTDIR)$(bindir)/mpathconf
$(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules $(Q)$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
+ $(RM) $(DESTDIR)$(bindir)/mpathconf $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
$(RM) $(DESTDIR)$(man8dir)/$(EXEC).8 $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5 $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules
+ $(RM) $(DESTDIR)$(man8dir)/mpathconf.8 $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/mpathconf.8
$(Q)$(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5
clean: dep_clean clean: dep_clean
$(RM) core *.o $(EXEC)
diff --git a/multipath/mpathconf b/multipath/mpathconf diff --git a/multipath/mpathconf b/multipath/mpathconf
new file mode 100644 new file mode 100644
index 00000000..319664b1 index 00000000..319664b1

View File

@ -1,44 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 16 Aug 2022 14:10:39 +0200
Subject: [PATCH] github workflows: build-and-unittest.yaml: add libedit-dev
This is is required after switching from libreadline to libedit.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/build-and-unittest.yaml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/build-and-unittest.yaml b/.github/workflows/build-and-unittest.yaml
index 7ff45842..1ab0d36c 100644
--- a/.github/workflows/build-and-unittest.yaml
+++ b/.github/workflows/build-and-unittest.yaml
@@ -27,7 +27,7 @@ jobs:
sudo apt-get install --yes gcc
make perl-base pkg-config valgrind
libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev
- libudev-dev libjson-c-dev liburcu-dev libcmocka-dev
+ libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev
- name: build
run: make -O -j$(grep -c ^processor /proc/cpuinfo)
- name: test
@@ -55,7 +55,7 @@ jobs:
sudo apt-get install --yes gcc-10
make perl-base pkg-config valgrind
libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev
- libudev-dev libjson-c-dev liburcu-dev libcmocka-dev
+ libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev
- name: set CC
run: echo CC=gcc-10 >> $GITHUB_ENV
- name: build
@@ -85,7 +85,7 @@ jobs:
sudo apt-get install --yes clang
make perl-base pkg-config valgrind
libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev
- libudev-dev libjson-c-dev liburcu-dev libcmocka-dev
+ libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev
- name: set CC
run: echo CC=clang >> $GITHUB_ENV
- name: build

View File

@ -20,7 +20,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 files changed, 59 insertions(+), 3 deletions(-) 3 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/multipath/main.c b/multipath/main.c diff --git a/multipath/main.c b/multipath/main.c
index 034dd2f4..4c31820b 100644 index b9f360b4..5eb752ee 100644
--- a/multipath/main.c --- a/multipath/main.c
+++ b/multipath/main.c +++ b/multipath/main.c
@@ -120,7 +120,7 @@ usage (char * progname) @@ -120,7 +120,7 @@ usage (char * progname)
@ -41,7 +41,7 @@ index 034dd2f4..4c31820b 100644
" -c check if a device should be a path in a multipath device\n" " -c check if a device should be a path in a multipath device\n"
" -C check if a multipath device has usable paths\n" " -C check if a multipath device has usable paths\n"
" -q allow queue_if_no_path when multipathd is not running\n" " -q allow queue_if_no_path when multipathd is not running\n"
@@ -448,6 +450,50 @@ static void cleanup_vecs(void) @@ -447,6 +449,50 @@ static void cleanup_vecs(void)
free_pathvec(vecs.pathvec, FREE_PATHS); free_pathvec(vecs.pathvec, FREE_PATHS);
} }
@ -92,7 +92,7 @@ index 034dd2f4..4c31820b 100644
static int static int
configure (struct config *conf, enum mpath_cmds cmd, configure (struct config *conf, enum mpath_cmds cmd,
enum devtypes dev_type, char *devpath) enum devtypes dev_type, char *devpath)
@@ -841,7 +887,7 @@ main (int argc, char *argv[]) @@ -840,7 +886,7 @@ main (int argc, char *argv[])
conf->force_sync = 1; conf->force_sync = 1;
if (atexit(cleanup_vecs)) if (atexit(cleanup_vecs))
condlog(1, "failed to register cleanup handler for vecs: %m"); condlog(1, "failed to register cleanup handler for vecs: %m");
@ -101,7 +101,7 @@ index 034dd2f4..4c31820b 100644
switch(arg) { switch(arg) {
case 'v': case 'v':
if (!isdigit(optarg[0])) { if (!isdigit(optarg[0])) {
@@ -912,6 +958,10 @@ main (int argc, char *argv[]) @@ -911,6 +957,10 @@ main (int argc, char *argv[])
case 'T': case 'T':
cmd = CMD_DUMP_CONFIG; cmd = CMD_DUMP_CONFIG;
break; break;
@ -113,7 +113,7 @@ index 034dd2f4..4c31820b 100644
usage(argv[0]); usage(argv[0]);
exit(RTVL_OK); exit(RTVL_OK);
diff --git a/multipath/multipath.8 b/multipath/multipath.8 diff --git a/multipath/multipath.8 b/multipath/multipath.8
index 4c7e9885..1d062664 100644 index 88149d53..072a03ee 100644
--- a/multipath/multipath.8 --- a/multipath/multipath.8
+++ b/multipath/multipath.8 +++ b/multipath/multipath.8
@@ -63,7 +63,7 @@ multipath \- Device mapper target autoconfig. @@ -63,7 +63,7 @@ multipath \- Device mapper target autoconfig.

View File

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 16 Aug 2022 14:10:39 +0200
Subject: [PATCH] github workflows: coverity.yaml: add libedit-dev
This is is required after switching from libreadline to libedit.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/coverity.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/coverity.yaml b/.github/workflows/coverity.yaml
index a8b56d43..3c6b3824 100644
--- a/.github/workflows/coverity.yaml
+++ b/.github/workflows/coverity.yaml
@@ -15,7 +15,7 @@ jobs:
sudo apt-get install --yes
gcc make pkg-config
libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev
- libudev-dev libjson-c-dev liburcu-dev libcmocka-dev
+ libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev
- name: download coverity
run: >
curl -o cov-analysis-linux64.tar.gz

View File

@ -12,7 +12,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index 7979f208..78b3d938 100644 index a5e9ea0c..514fd880 100644
--- a/libmultipath/defaults.h --- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h +++ b/libmultipath/defaults.h
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@

View File

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 16 Aug 2022 14:10:39 +0200
Subject: [PATCH] github workflows: abi.yaml: add libedit-dev
This is is required after switching from libreadline to libedit.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/abi.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/abi.yaml b/.github/workflows/abi.yaml
index 0a40104a..89b971cd 100644
--- a/.github/workflows/abi.yaml
+++ b/.github/workflows/abi.yaml
@@ -30,7 +30,7 @@ jobs:
sudo apt-get install --yes gcc
gcc make pkg-config abigail-tools
libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev
- libudev-dev libjson-c-dev liburcu-dev libcmocka-dev
+ libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev
- name: create ABI
run: make -O -j$(grep -c ^processor /proc/cpuinfo) abi.tar.gz
- name: save ABI

View File

@ -1,71 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 16 Aug 2022 16:52:07 +0200
Subject: [PATCH] GitHub workflows: native.yaml: add libedit-dev, except for
jessie
This is is required after switching from libreadline to libedit.
On jessie, we can use libreadline5 (libreadline-gpl2-dev) without
license issues. Trying to compile against libedit results in an
"incompatible pointer type" error on jessie, because libedit
uses a different prototype for rl_completion_entry_function.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/native.yaml | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/native.yaml b/.github/workflows/native.yaml
index ddfd4a09..8b599209 100644
--- a/.github/workflows/native.yaml
+++ b/.github/workflows/native.yaml
@@ -22,13 +22,24 @@ jobs:
- name: checkout
uses: actions/checkout@v1
- name: build and test
+ if: ${{ matrix.os != 'jessie' }}
run: make test
+ - name: build and test (jessie)
+ # On jessie, we use libreadline 5 (no licensing issue)
+ if: ${{ matrix.os == 'jessie' }}
+ run: make READLINE=libreadline test
- name: clean
run: make clean
- name: clang
+ if: ${{ matrix.os != 'jessie' }}
env:
CC: clang
run: make test
+ - name: clang (jessie)
+ if: ${{ matrix.os == 'jessie' }}
+ env:
+ CC: clang
+ run: make READLINE=libreadline test
rolling:
runs-on: ubuntu-20.04
@@ -56,12 +67,13 @@ jobs:
libjson-c-dev
liburcu-dev
libcmocka-dev
+ libedit-dev
- name: dependencies-alpine
if: ${{ matrix.os == 'alpine' }}
run: >
apk add make gcc clang cmocka
musl-dev lvm2-dev libaio-dev readline-dev ncurses-dev eudev-dev
- userspace-rcu-dev json-c-dev cmocka-dev
+ userspace-rcu-dev json-c-dev cmocka-dev libedit-dev
- name: dependencies-fedora
if: ${{ matrix.os == 'fedora:rawhide' }}
run: >
@@ -76,6 +88,7 @@ jobs:
userspace-rcu-devel
json-c-devel
libcmocka-devel
+ libedit-devel
- name: checkout
uses: actions/checkout@v1
- name: build and test

View File

@ -1,40 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 16 Aug 2022 23:38:18 +0200
Subject: [PATCH] GitHub workflows: foreign.yaml: switch to Debian 11
(bullseye)
Building the containers in the build-multipath project recently
started failing for buster/s390x and buster/ppc64el. That failure
had nothing to do with the switch to libedit.
It's about time to switch to bullseye anyway.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/foreign.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/foreign.yaml b/.github/workflows/foreign.yaml
index 32915186..f6e69709 100644
--- a/.github/workflows/foreign.yaml
+++ b/.github/workflows/foreign.yaml
@@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
- os: [buster]
+ os: [bullseye]
arch: ['ppc64le', 'aarch64', 's390x']
container: mwilck/multipath-build-${{ matrix.os }}-${{ matrix.arch }}
steps:
@@ -44,7 +44,7 @@ jobs:
needs: build
strategy:
matrix:
- os: [buster]
+ os: [bullseye]
arch: ['ppc64le', 'aarch64', 's390x']
steps:
- name: get binaries

View File

@ -14,10 +14,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 files changed, 8 insertions(+), 10 deletions(-) 2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 15560f8c..2339c9a9 100644 index f3fccedd..c883fd02 100644
--- a/libmultipath/discovery.c --- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c +++ b/libmultipath/discovery.c
@@ -1175,13 +1175,9 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len, @@ -1176,13 +1176,9 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
good_len = 8; good_len = 8;
break; break;
case 2: case 2:
@ -33,7 +33,7 @@ index 15560f8c..2339c9a9 100644
good_len = 8; good_len = 8;
break; break;
default: default:
@@ -1199,10 +1195,6 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len, @@ -1200,10 +1196,6 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
break; break;
case 0x8: case 0x8:
/* SCSI Name: Prio 3 */ /* SCSI Name: Prio 3 */

View File

@ -11,10 +11,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.inc b/Makefile.inc diff --git a/Makefile.inc b/Makefile.inc
index 2cf6e85f..7277cf5f 100644 index e6e7f7d7..15f0b9f6 100644
--- a/Makefile.inc --- a/Makefile.inc
+++ b/Makefile.inc +++ b/Makefile.inc
@@ -16,7 +16,7 @@ READLINE = libedit @@ -16,7 +16,7 @@ READLINE :=
# List of scsi device handler modules to load on boot, e.g. # List of scsi device handler modules to load on boot, e.g.
# SCSI_DH_MODULES_PRELOAD := scsi_dh_alua scsi_dh_rdac # SCSI_DH_MODULES_PRELOAD := scsi_dh_alua scsi_dh_rdac

View File

@ -1,63 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 13 Apr 2017 07:22:23 -0500
Subject: [PATCH] RH: fixup udev rules for redhat
The multipath rules need to run after scsi_id is run. This means moving
them after 60-persistent-storage.rules for redhat. Redhat also uses a
different naming scheme for partitions than SuSE.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 2 +-
kpartx/kpartx.rules | 2 +-
multipath/Makefile | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index ad7afd04..03450610 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -81,7 +81,7 @@ endif
prefix =
exec_prefix = $(prefix)
usr_prefix = $(prefix)
-bindir = $(exec_prefix)/sbin
+bindir = $(exec_prefix)/usr/sbin
libudevdir = $(prefix)/$(SYSTEMDPATH)/udev
udevrulesdir = $(libudevdir)/rules.d
modulesloaddir = $(prefix)/$(SYSTEMDPATH)/modules-load.d
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index 1969dee0..d2b28233 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -39,6 +39,6 @@ LABEL="mpath_kpartx_end"
GOTO="kpartx_end"
LABEL="run_kpartx"
-RUN+="/sbin/kpartx -un -p -part /dev/$name"
+RUN+="/sbin/kpartx -un /dev/$name"
LABEL="kpartx_end"
diff --git a/multipath/Makefile b/multipath/Makefile
index bcb04533..d2b3fd82 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -23,7 +23,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)$(udevrulesdir)/56-multipath.rules
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(udevrulesdir)/62-multipath.rules
$(INSTALL_PROGRAM) -d $(DESTDIR)$(modulesloaddir)
$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
@@ -41,7 +41,7 @@ uninstall:
$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
+ $(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules
$(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5

View File

@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 15 Nov 2022 18:03:33 -0600
Subject: [PATCH] RH: compile with libreadline support
Since the license issue has been resolved, and there are problems with
the command completion with libedit, use libreadline.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.inc b/Makefile.inc
index 15f0b9f6..881c1d52 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -12,7 +12,7 @@
# Readline library to use, libedit, libreadline, or empty
# Caution: Using libreadline may make the multipathd binary undistributable,
# see https://github.com/opensvc/multipath-tools/issues/36
-READLINE :=
+READLINE := libreadline
# List of scsi device handler modules to load on boot, e.g.
# SCSI_DH_MODULES_PRELOAD := scsi_dh_alua scsi_dh_rdac

View File

@ -1,75 +1,66 @@
Name: device-mapper-multipath Name: device-mapper-multipath
Version: 0.9.0 Version: 0.9.3
Release: 3%{?dist} Release: 1%{?dist}
Summary: Tools to manage multipath devices using device-mapper Summary: Tools to manage multipath devices using device-mapper
License: GPLv2 License: GPLv2
URL: http://christophe.varoqui.free.fr/ URL: http://christophe.varoqui.free.fr/
# The source for this package was pulled from upstream's git repo. Use the # The source for this package was pulled from upstream's git repo. Use the
# following command to generate the tarball # following command to generate the tarball
# curl -L https://github.com/opensvc/multipath-tools/archive/0.9.0.tar.gz -o multipath-tools-0.9.0.tgz # curl -L https://github.com/opensvc/multipath-tools/archive/0.9.3.tar.gz -o multipath-tools-0.9.3.tgz
Source0: multipath-tools-0.9.0.tgz Source0: multipath-tools-0.9.3.tgz
Source1: multipath.conf Source1: multipath.conf
Patch0001: 0001-github-workflows-switch-to-fedora-36.patch Patch0001: 0001-libmultipath-fix-show-paths-format-failure.patch
Patch0002: 0002-multipath-tools-fix-multipath-ll-bug-for-Native-NVME.patch Patch0002: 0002-fixup-Makefile.inc-fix-man-and-include-paths.patch
Patch0003: 0003-multipath-tools-update-Huawei-OceanStor-NVMe-vendor-.patch Patch0003: 0003-multipath-tools-Makefile.inc-Fix-paths-for-systemd.patch
Patch0004: 0004-multipath-tools-update-Generic-NVMe-vendor-regex-in-.patch Patch0004: 0004-multipath-tools-Makefile.inc-don-t-take-values-from-.patch
Patch0005: 0005-libmultipath-fix-find_multipaths_timeout-for-unknown.patch Patch0005: 0005-multipath-tools-Makefile.inc-get-rid-of-RUN.patch
Patch0006: 0006-multipath-tools-update-devel-repo-info-in-README.md.patch Patch0006: 0006-multipath-tools-Makefile.inc-more-compact-code-for-L.patch
Patch0007: 0007-multipath-tools-delete-README.alua.patch Patch0007: 0007-multipath-tools-Makefiles-simplify-code-for-include-.patch
Patch0008: 0008-multipath-tools-add-ALUA-info-to-README.md.patch Patch0008: 0008-multipath-tools-Makefiles-use-mandir.patch
Patch0009: 0009-libmultipath-alua-remove-get_sysfs_pg83.patch Patch0009: 0009-multipath-tools-Makefile.inc-simplify-expression-for.patch
Patch0010: 0010-libmultipath-remove-sysfs_get_binary.patch Patch0010: 0010-multipath-tools-Makefile.inc-untangle-paths-and-sour.patch
Patch0011: 0011-libmultipath-sysfs_bin_attr_get_value-no-error-if-bu.patch Patch0011: 0011-multipath-tools-Makefiles-replace-libdir-by-plugindi.patch
Patch0012: 0012-libmultipath-common-code-path-for-sysfs_attr_get_val.patch Patch0012: 0012-multipath-tools-Makefile.inc-use-simple-make-variabl.patch
Patch0013: 0013-libmultipath-sanitize-error-checking-in-sysfs-access.patch Patch0013: 0013-multipath-tools-Makefile.inc-fix-a-log-message.patch
Patch0014: 0014-libmultipath-get-rid-of-PATH_SIZE.patch Patch0014: 0014-multipath-tools-Makefile.inc-set-systemd-specific-fl.patch
Patch0015: 0015-libmultipath-sysfs_attr_get_value-don-t-return-0-if-.patch Patch0015: 0015-multipathd-Makefile-fix-compilation-flags-for-libedi.patch
Patch0016: 0016-libmultipath-sysfs_attr_set_value-don-t-return-0-on-.patch Patch0016: 0016-multipath-tools-Makefiles-clean-up-executable-Makefi.patch
Patch0017: 0017-libmultipath-sysfs-cleanup-file-descriptors-on-pthre.patch Patch0017: 0017-multipath-tools-Makefiles-use-common-code-for-librar.patch
Patch0018: 0018-libmultipath-multipathd-log-failure-setting-sysfs-at.patch Patch0018: 0018-multipath-tools-Makefiles-move-common-code-to-rules..patch
Patch0019: 0019-multipath-tests-expect_condlog-skip-depending-on-ver.patch Patch0019: 0019-multipath-tools-Makefiles-create-config.mk.patch
Patch0020: 0020-multipath-tests-__wrap_dlog-print-log-message.patch Patch0020: 0020-multipath-tools-Makefiles-enable-quiet-build.patch
Patch0021: 0021-multipath-tests-add-sysfs-test.patch Patch0021: 0021-multipath-tools-quiet-build-support-for-top-level-Ma.patch
Patch0022: 0022-libmultipath.version-bump-version-for-sysfs-accessor.patch Patch0022: 0022-GitHub-workflows-use-make-j8-Orecurse.patch
Patch0023: 0023-libmultipath-unset-detect_checker-for-clariion-Unity.patch Patch0023: 0023-README.md-Move-section-about-libedit-and-libreadline.patch
Patch0024: 0024-libmultipath-spelling-cplusplus.patch Patch0024: 0024-README.md-Fix-indentation-in-paragraph-about-device-.patch
Patch0025: 0025-libmultipath-spelling-ascii.patch Patch0025: 0025-README.md-document-options-for-paths-and-optimizatio.patch
Patch0026: 0026-libmultipath-spelling-progress.patch Patch0026: 0026-README.md-document-how-to-customize-build.patch
Patch0027: 0027-multipath-tools-spelling-fixes.patch Patch0027: 0027-libmultipath-avoid-Warray-bounds-error-with-gcc-12-a.patch
Patch0028: 0028-multipath-tools-remove-list-of-rebranded-arrays-vend.patch Patch0028: 0028-multipath-avoid-NULL-string-in-released_to_systemd.patch
Patch0029: 0029-multipath-tools-correct-CLARiiON-info-from-multipath.patch Patch0029: 0029-libmultipath-avoid-NULL-string-in-is_udev_ready.patch
Patch0030: 0030-multipath-tools-add-basic-info-on-how-to-use-multipa.patch Patch0030: 0030-libmultipath-impove-add_feature-variable-names.patch
Patch0031: 0031-multipathd-factor-out-the-code-to-flush-a-map-with-n.patch Patch0031: 0031-multipathd-don-t-initialize-the-field-width-in-show_.patch
Patch0032: 0032-libmultipath-return-success-if-we-raced-to-remove-a-.patch Patch0032: 0032-libmultipath-improve-remove_feature-variable-names.patch
Patch0033: 0033-multipathd-Handle-losing-all-path-in-update_map.patch Patch0033: 0033-RH-fixup-udev-rules-for-redhat.patch
Patch0034: 0034-multipath-fix-systemd-timers-in-the-initramfs.patch Patch0034: 0034-RH-Remove-the-property-blacklist-exception-builtin.patch
Patch0035: 0035-multipathd-Add-missing-ctype-include.patch Patch0035: 0035-RH-don-t-start-without-a-config-file.patch
Patch0036: 0036-multipathd-replace-libreadline-with-libedit.patch Patch0036: 0036-RH-Fix-nvme-function-missing-argument.patch
Patch0037: 0037-libmultipath-convert-license-of-strbuf-code-to-GPL-2.patch Patch0037: 0037-RH-use-rpm-optflags-if-present.patch
Patch0038: 0038-github-workflows-build-and-unittest.yaml-add-libedit.patch Patch0038: 0038-RH-add-mpathconf.patch
Patch0039: 0039-github-workflows-coverity.yaml-add-libedit-dev.patch Patch0039: 0039-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
Patch0040: 0040-github-workflows-abi.yaml-add-libedit-dev.patch Patch0040: 0040-RH-reset-default-find_mutipaths-value-to-off.patch
Patch0041: 0041-GitHub-workflows-native.yaml-add-libedit-dev-except-.patch Patch0041: 0041-RH-attempt-to-get-ANA-info-via-sysfs-first.patch
Patch0042: 0042-GitHub-workflows-foreign.yaml-switch-to-Debian-11-bu.patch Patch0042: 0042-RH-make-parse_vpd_pg83-match-scsi_id-output.patch
Patch0043: 0043-RH-fixup-udev-rules-for-redhat.patch Patch0043: 0043-RH-add-scsi-device-handlers-to-modules-load.d.patch
Patch0044: 0044-RH-Remove-the-property-blacklist-exception-builtin.patch Patch0044: 0044-RH-compile-with-libreadline-support.patch
Patch0045: 0045-RH-don-t-start-without-a-config-file.patch
Patch0046: 0046-RH-Fix-nvme-function-missing-argument.patch
Patch0047: 0047-RH-use-rpm-optflags-if-present.patch
Patch0048: 0048-RH-add-mpathconf.patch
Patch0049: 0049-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
Patch0050: 0050-RH-reset-default-find_mutipaths-value-to-off.patch
Patch0051: 0051-RH-attempt-to-get-ANA-info-via-sysfs-first.patch
Patch0052: 0052-RH-make-parse_vpd_pg83-match-scsi_id-output.patch
Patch0053: 0053-RH-add-scsi-device-handlers-to-modules-load.d.patch
# runtime # runtime
Requires: %{name}-libs = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release}
Requires: kpartx = %{version}-%{release} Requires: kpartx = %{version}-%{release}
Requires: device-mapper >= 1.02.96 Requires: device-mapper >= 1.02.96
Requires: userspace-rcu Requires: userspace-rcu
Requires: libedit Requires: readline
Requires(post): systemd-units Requires(post): systemd-units
Requires(preun): systemd-units Requires(preun): systemd-units
Requires(postun): systemd-units Requires(postun): systemd-units
@ -87,7 +78,7 @@ Conflicts: udisks2 < 2.8.0-2
# build/setup # build/setup
BuildRequires: libaio-devel, device-mapper-devel >= 1.02.89 BuildRequires: libaio-devel, device-mapper-devel >= 1.02.89
BuildRequires: libselinux-devel, libsepol-devel BuildRequires: libselinux-devel, libsepol-devel
BuildRequires: libedit-devel, ncurses-devel BuildRequires: readline-devel, ncurses-devel
BuildRequires: systemd-units, systemd-devel BuildRequires: systemd-units, systemd-devel
BuildRequires: json-c-devel, perl-interpreter, pkgconfig, gcc BuildRequires: json-c-devel, perl-interpreter, pkgconfig, gcc
BuildRequires: userspace-rcu-devel BuildRequires: userspace-rcu-devel
@ -147,7 +138,7 @@ This package contains the files needed to develop applications that use
device-mapper-multipath's libdmmp C API library device-mapper-multipath's libdmmp C API library
%prep %prep
%autosetup -n multipath-tools-0.9.0 -p1 %autosetup -n multipath-tools-0.9.3 -p1
cp %{SOURCE1} . cp %{SOURCE1} .
%build %build
@ -162,11 +153,12 @@ cp %{SOURCE1} .
bindir=%{_sbindir} \ bindir=%{_sbindir} \
syslibdir=%{_libdir} \ syslibdir=%{_libdir} \
usrlibdir=%{_libdir} \ usrlibdir=%{_libdir} \
libdir=%{_libmpathdir} \ plugindir=%{_libmpathdir} \
rcdir=%{_initrddir} \ mandir=%{_mandir} \
unitdir=%{_unitdir} \ unitdir=%{_unitdir} \
includedir=%{_includedir} \ includedir=%{_includedir} \
pkgconfdir=%{_pkgconfdir} pkgconfdir=%{_pkgconfdir} \
tmpfilesdir=%{_tmpfilesdir}
# tree fix up # tree fix up
install -d %{buildroot}/etc/multipath install -d %{buildroot}/etc/multipath
@ -191,32 +183,37 @@ fi
/bin/systemctl --quiet is-enabled multipathd.service >/dev/null 2>&1 && /bin/systemctl reenable multipathd.service ||: /bin/systemctl --quiet is-enabled multipathd.service >/dev/null 2>&1 && /bin/systemctl reenable multipathd.service ||:
%files %files
%license LICENSES/GPL-2.0 LICENSES/LGPL-2.0 %license LICENSES/GPL-2.0 LICENSES/LGPL-2.0 LICENSES/GPL-3.0
%{_sbindir}/multipath %{_sbindir}/multipath
%{_sbindir}/multipathd %{_sbindir}/multipathd
%{_sbindir}/multipathc
%{_sbindir}/mpathconf %{_sbindir}/mpathconf
%{_sbindir}/mpathpersist %{_sbindir}/mpathpersist
%{_unitdir}/multipathd.service %{_unitdir}/multipathd.service
%{_unitdir}/multipathd.socket %{_unitdir}/multipathd.socket
%{_mandir}/man5/multipath.conf.5.gz %{_mandir}/man5/multipath.conf.5*
%{_mandir}/man8/multipath.8.gz %{_mandir}/man8/multipath.8*
%{_mandir}/man8/multipathd.8.gz %{_mandir}/man8/multipathd.8*
%{_mandir}/man8/mpathconf.8.gz %{_mandir}/man8/multipathc.8*
%{_mandir}/man8/mpathpersist.8.gz %{_mandir}/man8/mpathconf.8*
%{_mandir}/man8/mpathpersist.8*
%config /usr/lib/udev/rules.d/62-multipath.rules %config /usr/lib/udev/rules.d/62-multipath.rules
%config /usr/lib/udev/rules.d/11-dm-mpath.rules %config /usr/lib/udev/rules.d/11-dm-mpath.rules
%dir /usr/lib/modules-load.d %dir /usr/lib/modules-load.d
/usr/lib/modules-load.d/multipath.conf /usr/lib/modules-load.d/multipath.conf
/usr/lib/modules-load.d/scsi_dh.conf /usr/lib/modules-load.d/scsi_dh.conf
%{_tmpfilesdir}/multipath.conf
%doc README.md %doc README.md
%doc multipath.conf %doc multipath.conf
%dir /etc/multipath %dir /etc/multipath
%files libs %files libs
%license LICENSES/GPL-2.0 LICENSES/LGPL-2.0 %license LICENSES/GPL-2.0 LICENSES/LGPL-2.0 LICENSES/LGPL-2.1
%doc README.md %doc README.md
%{_libdir}/libmultipath.so %{_libdir}/libmultipath.so
%{_libdir}/libmultipath.so.* %{_libdir}/libmultipath.so.*
%{_libdir}/libmpathutil.so
%{_libdir}/libmpathutil.so.*
%{_libdir}/libmpathpersist.so.* %{_libdir}/libmpathpersist.so.*
%{_libdir}/libmpathcmd.so.* %{_libdir}/libmpathcmd.so.*
%{_libdir}/libmpathvalid.so.* %{_libdir}/libmpathvalid.so.*
@ -233,15 +230,15 @@ fi
%{_includedir}/mpath_cmd.h %{_includedir}/mpath_cmd.h
%{_includedir}/mpath_persist.h %{_includedir}/mpath_persist.h
%{_includedir}/mpath_valid.h %{_includedir}/mpath_valid.h
%{_mandir}/man3/mpath_persistent_reserve_in.3.gz %{_mandir}/man3/mpath_persistent_reserve_in.3*
%{_mandir}/man3/mpath_persistent_reserve_out.3.gz %{_mandir}/man3/mpath_persistent_reserve_out.3*
%files -n kpartx %files -n kpartx
%license LICENSES/GPL-2.0 %license LICENSES/GPL-2.0
%doc README.md %doc README.md
%{_sbindir}/kpartx %{_sbindir}/kpartx
/usr/lib/udev/kpartx_id /usr/lib/udev/kpartx_id
%{_mandir}/man8/kpartx.8.gz %{_mandir}/man8/kpartx.8*
%config /usr/lib/udev/rules.d/11-dm-parts.rules %config /usr/lib/udev/rules.d/11-dm-parts.rules
%config /usr/lib/udev/rules.d/66-kpartx.rules %config /usr/lib/udev/rules.d/66-kpartx.rules
%config /usr/lib/udev/rules.d/68-del-part-nodes.rules %config /usr/lib/udev/rules.d/68-del-part-nodes.rules
@ -259,10 +256,24 @@ fi
%dir %{_includedir}/libdmmp %dir %{_includedir}/libdmmp
%{_includedir}/libdmmp/* %{_includedir}/libdmmp/*
%{_mandir}/man3/dmmp_* %{_mandir}/man3/dmmp_*
%{_mandir}/man3/libdmmp.h.3.gz %{_mandir}/man3/libdmmp.h.3*
%{_pkgconfdir}/libdmmp.pc %{_pkgconfdir}/libdmmp.pc
%changelog %changelog
* Tue Nov 15 2022 Benjamin Marzinski <bmarzins@redhat.com> - 0.9.3-1
- Update to the head of the upstream staging branch
* Previous patches 0001-0042 are included in the source tarball
* Patches 0001-0032 are from the upstream staging branch
- Rename redhat patches
* Previous patches 0043-0053 are now patches 0033-0043
- Change back to using readline instead of libedit
* The code the uses readline has been isolated from the code that
is licensed gpl v2 only.
- Add libmpathutil libraries to spec file
- Add multipathc program to spec file
- Add multipath.conf systemd tempfile configuration to spec file
- Misc spec file cleanups
* Fri Aug 19 2022 Benjamin Marzinski <bmarzins@redhat.com> - 0.9.0-3 * Fri Aug 19 2022 Benjamin Marzinski <bmarzins@redhat.com> - 0.9.0-3
- Update to the head of the upstream staging branch - Update to the head of the upstream staging branch
* Patches 0005-0042 are from the upstream staging branch * Patches 0005-0042 are from the upstream staging branch

View File

@ -1,2 +1,2 @@
SHA512 (multipath-tools-0.9.0.tgz) = 6c417f6d1d116fa43bedb9f77769ece9cbb7b35b78a9b3558c41df2360e52a65a07314b12ab7e4a7bbc867b9755250de9db96a2f7eb4a6a37f0b0b3f0bbc840e SHA512 (multipath-tools-0.9.3.tgz) = 4faa2ee5a96a9d5d752219931ebc885cb70ed6b022d45ede985ad7919c043a3aee166e6f126d32dffd187c5c32d5cbce91747d87d0b55557e2f7f68b279583da
SHA512 (multipath.conf) = 71953dce5a68adcf60a942305f5a66023e6f4c4baf53b1bfdb4edf65ed5b8e03db804363c36d1dcfd85591f4766f52b515269904c53b84d7b076da0b80b09942 SHA512 (multipath.conf) = 71953dce5a68adcf60a942305f5a66023e6f4c4baf53b1bfdb4edf65ed5b8e03db804363c36d1dcfd85591f4766f52b515269904c53b84d7b076da0b80b09942