Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version #27

Merged
merged 48 commits into from Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6afb78f
multipathd.service: remove LimitCORE=infinity directive
mwilck Dec 7, 2021
e90c387
multipathd.service: don't load SCSI device handler modules
mwilck Dec 7, 2021
11f0440
multipathd.service: add dependency on initrd-cleanup.service
mwilck Dec 7, 2021
7b251a0
multipathd.service: drop dependencies on iscsi and iscsid
mwilck Dec 7, 2021
cc18bab
libmultipath: embed dm_info in multipath structure
bmarzins Dec 15, 2021
67c86ad
multipathd: update dm_info on multipath change events
bmarzins Dec 15, 2021
6e40bf9
multipathd: avoid unnecessary path read-only reloads
bmarzins Dec 15, 2021
54e7ed6
libmpathpersist: split public and internal API
mwilck Dec 15, 2021
2f7fc4f
multipathd: remove duplicate definitions from main.h
mwilck Dec 16, 2021
ac8da60
libmpathpersist/multipathd: remove duplicate definition
mwilck Dec 16, 2021
e179cb8
libmpathpersist: remove __STDC_FORMAT_MACROS
mwilck Dec 16, 2021
e608144
libmpathpersist: cleanup mpathpr.h
mwilck Dec 16, 2021
69d5e81
multipath-tools: fix misspellings
xosevp Dec 18, 2021
1834dc4
libmultipath: fix DI_NOIO pathinfo PATH_PENDING handling
bmarzins Dec 23, 2021
5c88969
libmultipath: simplify out __set_no_path_retry()
bmarzins Dec 23, 2021
7278108
libmultipath: don't enter recovery mode with pending paths
bmarzins Dec 23, 2021
dd6338d
libmultipath.version: bump major version
mwilck Dec 23, 2021
a220dd1
build: don't compress man pages
thesamesam Jan 3, 2022
c54d933
multipath-tools: remove duplicate headers
xosevp Jan 4, 2022
2316566
kpartx/devmapper.c: fix unused-but-set variable error
trofi Jan 9, 2022
be16f42
kpartx/devmapper.c: fix unused variable error
trofi Jan 9, 2022
921fabd
multipath-tools: autodiscover libdevmapper.h headers
trofi Jan 9, 2022
1017d59
multipath-tools: autodiscover libudev.h headers
trofi Jan 9, 2022
193455b
multipath-tools: allow passing non-standard linux-headers location
trofi Jan 9, 2022
02bc889
multipath-tools: avoid using GZIP Makefile variable
trofi Jan 9, 2022
353419e
libmultipath: fix disassemble status for historical-service-time PS
bmarzins Jan 18, 2022
ad16d0b
libmultipath: make helper function to trigger path uevents
bmarzins Jan 18, 2022
9b634e8
multipathd: trigger udev change on path addition
bmarzins Jan 18, 2022
378932f
libmultipath: use asprintf() to allocate prefixed_uuid
bmarzins Jan 26, 2022
1ef4541
multipath/Makefile: use $(udevrulesdir)
mwilck Feb 1, 2022
41d0b66
multipath-tools: Makefile.inc: delete obsolete comment
mwilck Feb 1, 2022
92f0893
multipath-tools: install modules-load.d/multipath.conf
mwilck Feb 1, 2022
a1eabea
multipathd.service: drop ExecStartPre for loading dm-multipath
mwilck Feb 1, 2022
2159f76
multipath: Makefile: modules-load.d file for SCSI device handlers
mwilck Feb 1, 2022
5e5e51c
README.md: add basic information about building multipath-tools
mwilck Feb 1, 2022
544c4f4
libmultipath: hwtable: use ALUA for all LIO targets
mwilck Feb 2, 2022
4f50e0e
kpartx.rules: skip MD devices
mwilck Feb 7, 2022
cfff03e
multipathd: handle fpin events
muneendramandala Feb 10, 2022
3af023b
multipathd: disallow changing to/from fpin marginal paths on reconfig
bmarzins Feb 14, 2022
852a1df
libmultipath: support host adapter name lookup for s390x ccw bus
steffen-maier Feb 15, 2022
260d7cb
libmultipath: add %L path wildcard for 64-bit hex LUN
steffen-maier Feb 15, 2022
1a2f329
libmultipath: fix printing native nvme multipath topology.
bmarzins Feb 16, 2022
d11793a
Add missing include <assert.h>
Uglymotha Jan 8, 2022
571f28b
libmultipath: enable linear ordering of bus/proto tuple
mwilck Feb 17, 2022
28fcf23
libmultipath: use bus_protocol_id() in snprint_path_protocol()
mwilck Feb 17, 2022
6ae1b0c
libmultipath: enable defining a static bitfield
mwilck Feb 17, 2022
ac61ccc
libmultipath: only warn once about unsupported dev_loss_tmo
mwilck Feb 17, 2022
fc87ba4
Bump version to 0.8.9
mwilck Feb 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 41 additions & 7 deletions Makefile.inc
Expand Up @@ -2,19 +2,18 @@
# Copyright (C) 2004 Christophe Varoqui, <christophe.varoqui@opensvc.com>
#

#
# Allow to force some libraries to be used statically. (Uncomment one of the
# following lines or define the values when calling make.)
#
# WITH_LOCAL_LIBDM = 1
# WITH_LOCAL_LIBSYSFS = 1
#
# Uncomment to disable libdmmp support
# ENABLE_LIBDMMP = 0
#
# Uncomment to disable dmevents polling support
# ENABLE_DMEVENTS_POLL = 0

# 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 :=


PKGCONFIG ?= pkg-config

ifeq ($(TOPDIR),)
Expand Down Expand Up @@ -52,12 +51,34 @@ 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)
else
DEVMAPPER_INCDIR = /usr/include
endif
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
endif

# Allow user to override default location.
ifndef LINUX_HEADERS_INCDIR
LINUX_HEADERS_INCDIR = /usr/include
endif

prefix =
exec_prefix = $(prefix)
usr_prefix = $(prefix)
bindir = $(exec_prefix)/sbin
libudevdir = $(prefix)/$(SYSTEMDPATH)/udev
udevrulesdir = $(libudevdir)/rules.d
modulesloaddir = $(prefix)/$(SYSTEMDPATH)/modules-load.d
multipathdir = $(TOPDIR)/libmultipath
man8dir = $(prefix)/usr/share/man/man8
man5dir = $(prefix)/usr/share/man/man5
Expand All @@ -75,7 +96,7 @@ nvmedir = $(TOPDIR)/libmultipath/nvme
includedir = $(prefix)/usr/include
pkgconfdir = $(usrlibdir)/pkgconfig

GZIP = gzip -9 -c
GZIP_PROG = gzip -9 -c
RM = rm -f
LN = ln -sf
INSTALL_PROGRAM = install
Expand Down Expand Up @@ -138,6 +159,19 @@ check_file = $(shell \
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) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
Expand Down
56 changes: 56 additions & 0 deletions README.md
Expand Up @@ -52,6 +52,62 @@ To get latest devel code:
Github page: https://github.com/opensvc/multipath-tools


Building multipath-tools
========================

Prerequisites: development packages of for `libdevmapper`, `libreadline`,
`libaio`, `libudev`, `libjson-c`, `liburcu`, and `libsystemd`.

To build multipath-tools, type:

make
make DESTDIR="/my/target/dir" install

To uninstall, type:

make uninstall

Customizing the build
---------------------

The following variables can be passed to the `make` command line:

* `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 supprt dmevent polling
(but even if you don't use this option, multipath-tools will work with
these kernels).
* `SCSI_DH_MODULES_PRELOAD="(list)"`: specify a space-separated list of SCSI
device handler kernel modules to load early during boot. Some
multipath-tools functionality depends on these modules being loaded
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.

See `Makefile.inc` for additional variables to customize paths and compiler
flags.

Special Makefile targets
------------------------

The following targets are intended for developers only.

* `make test` to build and run the unit tests
* `make valgrind-test` to run the unit tests under valgrind
* `make abi` to create an XML representation of the ABI of the libraries in
the `abi/` subdirectory
* `make abi-test` to compare the ABI of a different multipath-tools version,
which must be stored in the `reference-abi/` subdirectory. If this test
fails, the ABI has changed wrt the reference.
* `make compile-commands.json` to create input for [clangd](https://clangd.llvm.org/).


Add storage devices
===================

Expand Down
9 changes: 4 additions & 5 deletions kpartx/Makefile
Expand Up @@ -8,7 +8,7 @@ LDFLAGS += $(BIN_LDFLAGS)

LIBDEPS += -ldevmapper

ifneq ($(call check_func,dm_task_set_cookie,/usr/include/libdevmapper.h),0)
ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
CFLAGS += -DLIBDM_API_COOKIE
endif

Expand All @@ -21,7 +21,6 @@ all: $(EXEC)

$(EXEC): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS)
$(GZIP) $(EXEC).8 > $(EXEC).8.gz

install: $(EXEC) $(EXEC).8
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
Expand All @@ -33,19 +32,19 @@ install: $(EXEC) $(EXEC).8
$(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.gz $(DESTDIR)$(man8dir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)

uninstall:
$(RM) $(DESTDIR)$(bindir)/$(EXEC)
$(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz
$(RM) $(DESTDIR)$(man8dir)/$(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

clean: dep_clean
$(RM) core *.o $(EXEC) *.gz
$(RM) core *.o $(EXEC)

include $(wildcard $(OBJS:.o=.d))

Expand Down
2 changes: 1 addition & 1 deletion kpartx/crc32.c
Expand Up @@ -342,7 +342,7 @@ uint32_t attribute((pure)) crc32_be(uint32_t crc, unsigned char const *p, size_t
* but again the multiple of the polynomial to subtract depends only on
* the high bits, the high 8 bits in this case.
*
* The multile we need in that case is the low 32 bits of a 40-bit
* The multiple we need in that case is the low 32 bits of a 40-bit
* value whose high 8 bits are given, and which is a multiple of the
* generator polynomial. This is simply the CRC-32 of the given
* one-byte message.
Expand Down
10 changes: 8 additions & 2 deletions kpartx/devmapper.c
Expand Up @@ -18,6 +18,12 @@
#define MAX_PREFIX_LEN (_UUID_PREFIX_LEN + 4)
#define PARAMS_SIZE 1024

#ifdef LIBDM_API_COOKIE
# define __DM_API_COOKIE_UNUSED__ /* empty */
#else
# define __DM_API_COOKIE_UNUSED__ __attribute__((unused))
#endif

int dm_prereq(char * str, uint32_t x, uint32_t y, uint32_t z)
{
int r = 1;
Expand Down Expand Up @@ -55,12 +61,12 @@ int dm_prereq(char * str, uint32_t x, uint32_t y, uint32_t z)
return r;
}

int dm_simplecmd(int task, const char *name, int no_flush, uint16_t udev_flags)
int dm_simplecmd(int task, const char *name, int no_flush, __DM_API_COOKIE_UNUSED__ uint16_t udev_flags)
{
int r = 0;
#ifdef LIBDM_API_COOKIE
int udev_wait_flag = (task == DM_DEVICE_RESUME ||
task == DM_DEVICE_REMOVE);
#ifdef LIBDM_API_COOKIE
uint32_t cookie = 0;
#endif
struct dm_task *dmt;
Expand Down
2 changes: 1 addition & 1 deletion kpartx/gpt.c
Expand Up @@ -94,7 +94,7 @@ efi_crc32(const void *buf, unsigned long len)
*
* Description: Returns 1 if PMBR is valid, 0 otherwise.
* Validity depends on two things:
* 1) MSDOS signature is in the last two bytes of the MBR
* 1) MS-DOS signature is in the last two bytes of the MBR
* 2) One partition of type 0xEE is found
*/
static int
Expand Down
3 changes: 3 additions & 0 deletions kpartx/kpartx.rules
Expand Up @@ -12,6 +12,9 @@ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="kpartx_end"
# Create dm tables for partitions on multipath devices.
ENV{DM_UUID}!="mpath-?*", GOTO="mpath_kpartx_end"

# Ignore RAID members
ENV{ID_FS_TYPE}=="linux_raid_member|isw_raid_member|ddf_raid_member", GOTO="mpath_kpartx_end"

# DM_SUBSYSTEM_UDEV_FLAG1 is the "skip_kpartx" flag.
# For events not generated by libdevmapper, we need to fetch it from db:
# - "change" events with DM_ACTIVATION!="1" (e.g. partition table changes)
Expand Down
14 changes: 4 additions & 10 deletions libdmmp/Makefile
Expand Up @@ -21,7 +21,7 @@ CFLAGS += $(LIB_CFLAGS) -fvisibility=hidden -I$(libdmmpdir) -I$(mpathcmddir) \
LIBDEPS += $(shell $(PKGCONFIG) --libs json-c) -L$(mpathcmddir) -lmpathcmd -lpthread

all: $(LIBS) doc
.PHONY: doc doc.gz clean install uninstall check speed_test dep_clean
.PHONY: doc clean install uninstall check speed_test dep_clean

$(LIBS): $(OBJS)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
Expand All @@ -31,7 +31,7 @@ $(DEVLIB): $(LIBS)

abi: $(DEVLIB:%.so=%.abi)

install: doc.gz
install:
mkdir -p $(DESTDIR)$(usrlibdir)
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(usrlibdir)/$(LIBS)
$(INSTALL_PROGRAM) -m 644 -D \
Expand All @@ -45,7 +45,7 @@ install: doc.gz
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
perl -i -pe 's|__INCLUDEDIR__|$(includedir)|g' \
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
$(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(man3dir) docs/man/*.3.gz
$(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(man3dir) docs/man/*.3

uninstall:
$(RM) $(DESTDIR)$(usrlibdir)/$(LIBS)
Expand All @@ -58,8 +58,7 @@ uninstall:
$(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE)

clean: dep_clean
$(RM) core *.a *.o *.gz *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
$(RM) docs/man/*.gz
$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
$(MAKE) -C test clean

include $(wildcard $(OBJS:.o=.d))
Expand All @@ -70,13 +69,8 @@ check: all
speed_test: all
$(MAKE) -C test speed_test

doc.gz: doc $(patsubst %,%.gz,$(wildcard docs/man/*.3))

doc: docs/man/dmmp_strerror.3

docs/man/%.3.gz: docs/man/%.3
gzip -c $< >$@

docs/man/dmmp_strerror.3: $(HEADERS)
TEMPFILE=$(shell mktemp); \
cat $^ | perl docs/doc-preclean.pl >$$TEMPFILE; \
Expand Down
3 changes: 1 addition & 2 deletions libdmmp/libdmmp.c
Expand Up @@ -26,7 +26,6 @@
#include <libudev.h>
#include <errno.h>
#include <libdevmapper.h>
#include <stdbool.h>
#include <unistd.h>
#include <assert.h>
#include <json.h>
Expand Down Expand Up @@ -189,7 +188,7 @@ int dmmp_mpath_array_get(struct dmmp_context *ctx,
j_token = json_tokener_new();
if (j_token == NULL) {
rc = DMMP_ERR_BUG;
_error(ctx, "BUG: json_tokener_new() retuned NULL");
_error(ctx, "BUG: json_tokener_new() returned NULL");
goto out;
}
j_obj = json_tokener_parse_ex(j_token, j_str, strlen(j_str) + 1);
Expand Down
2 changes: 1 addition & 1 deletion libmpathcmd/Makefile
Expand Up @@ -42,7 +42,7 @@ uninstall:
$(RM) $(DESTDIR)$(includedir)/mpath_cmd.h

clean: dep_clean
$(RM) core *.a *.o *.so *.so.* *.gz *.abi $(NV_VERSION_SCRIPT)
$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)

include $(wildcard $(OBJS:.o=.d))

Expand Down
2 changes: 1 addition & 1 deletion libmpathcmd/mpath_cmd.h
Expand Up @@ -80,7 +80,7 @@ int mpath_disconnect(int fd);
* mpath_recv_reply()
*
* RETURNS:
* 0 on successs, and reply will either be NULL (if there was no
* 0 on success, and reply will either be NULL (if there was no
* reply data), or point to the reply string, which must be freed by
* the caller. -1 on failure (with errno set).
*/
Expand Down
18 changes: 7 additions & 11 deletions libmpathpersist/Makefile
Expand Up @@ -10,9 +10,9 @@ LDFLAGS += -L$(multipathdir) -L$(mpathcmddir)

LIBDEPS += -lmultipath -lmpathcmd -ldevmapper -lpthread -ldl

OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o
OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o mpath_persist_int.o

all: $(DEVLIB) man
all: $(DEVLIB)

$(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
Expand All @@ -32,30 +32,26 @@ abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
$(DEVLIB): $(LIBS)
$(LN) $(LIBS) $@

man:
$(GZIP) mpath_persistent_reserve_in.3 > mpath_persistent_reserve_in.3.gz
$(GZIP) mpath_persistent_reserve_out.3 > mpath_persistent_reserve_out.3.gz

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)$(includedir)
$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
$(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_in.3.gz $(DESTDIR)$(man3dir)
$(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_out.3.gz $(DESTDIR)$(man3dir)
$(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_persist.h $(DESTDIR)$(includedir)

uninstall:
$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
$(RM) $(DESTDIR)$(man3dir)/mpath_persistent_reserve_in.3.gz
$(RM) $(DESTDIR)$(man3dir)/mpath_persistent_reserve_out.3.gz
$(RM) $(DESTDIR)$(man3dir)/mpath_persistent_reserve_in.3
$(RM) $(DESTDIR)$(man3dir)/mpath_persistent_reserve_out.3
$(RM) $(DESTDIR)$(includedir)/mpath_persist.h
$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)

clean: dep_clean
$(RM) core *.a *.o *.so *.so.* *.gz *.abi $(NV_VERSION_SCRIPT)
$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)

include $(wildcard $(OBJS:.o=.d))

Expand Down