Skip to content

Commit

Permalink
Merge pull request opensvc#77 from openSUSE/queue
Browse files Browse the repository at this point in the history
multipath-tools 0.9.7
  • Loading branch information
cvaroqui authored Nov 21, 2023
2 parents f3004b4 + bbb7478 commit 6bb7330
Show file tree
Hide file tree
Showing 49 changed files with 2,511 additions and 1,298 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ cscope.files
cscope.out
kpartx/kpartx
multipath/multipath
multipath/multipath.8
multipath/multipath.conf.5
multipath/multipath.rules
multipath/tmpfiles.conf
multipathd/multipathd
multipathd/multipathd.8
multipathd/multipathc
multipathd/multipathd.service
mpathpersist/mpathpersist
mpathpersist/mpathpersist.8
abi.tar.gz
abi
abi-test
Expand Down
55 changes: 38 additions & 17 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,40 @@ prefix :=
# Prefix for binaries
exec_prefix := $(prefix)
# Prefix for non-essential libraries (libdmmp)
usr_prefix := $(prefix)
usr_prefix := $(if $(prefix),$(prefix),/usr)
# Prefix for configfuration files (multipath.conf)
etc_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)
# Note: systemd installations with "split-usr=true" use separate "prefixdir" and
# "rootprefixdir". Our systemd_prefix corresponds to "prefixdir".
# In this case, override only unitdir and libudevdir below to use
# systemd's "rootprefixdir" 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

# Make sure all prefix variables end in "/"
append-slash = $(1)$(if $(filter %/,$(1)),,/)
override prefix := $(call append-slash,$(prefix))
override exec_prefix := $(call append-slash,$(exec_prefix))
override usr_prefix := $(call append-slash,$(usr_prefix))
override etc_prefix := $(call append-slash,$(etc_prefix))
override systemd_prefix := $(call append-slash,$(systemd_prefix))

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
mandir := $(usr_prefix)/share/man
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
syslibdir := $(prefix)$(LIB)
usrlibdir := $(usr_prefix)$(LIB)
includedir := $(usr_prefix)include
pkgconfdir := $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
configdir := $(prefix)/etc/multipath/conf.d
plugindir := $(prefix)$(LIB)/multipath
configdir := $(etc_prefix)etc/multipath/conf.d
configfile := $(etc_prefix)etc/multipath.conf
statedir := $(etc_prefix)etc/multipath
runtimedir := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run)
devmapper_incdir := $(or $(shell $(PKG_CONFIG) --variable=includedir devmapper),/usr/include)
libudev_incdir := $(or $(shell $(PKG_CONFIG) --variable=includedir libudev),/usr/include)
Expand All @@ -77,15 +92,18 @@ ORIG_LDFLAGS := $(LDFLAGS)

SYSTEMD_CPPFLAGS := $(if $(SYSTEMD),-DUSE_SYSTEMD=$(SYSTEMD))
SYSTEMD_LIBDEPS := $(if $(SYSTEMD),$(if $(shell test $(SYSTEMD) -gt 209 && echo 1),-lsystemd,-lsystemd-daemon))
MODPROBE_UNIT := $(shell test "0$(SYSTEMD)" -lt 245 2>/dev/null || \
echo "modprobe@dm_multipath.service")

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 \
$(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) $(W_URCU_TYPE_LIMITS)
CPPFLAGS := $(FORTIFY_OPT) $(CPPFLAGS) \
CPPFLAGS := $(FORTIFY_OPT) $(CPPFLAGS) $(D_URCU_VERSION) \
-DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
-DRUNTIME_DIR=\"$(runtimedir)\" \
-DCONFIG_DIR=\"$(configdir)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
-DRUNTIME_DIR=\"$(runtimedir)\" -DCONFIG_DIR=\"$(configdir)\" \
-DDEFAULT_CONFIGFILE=\"$(configfile)\" -DSTATE_DIR=\"$(statedir)\" \
-DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
BIN_CFLAGS := -fPIE -DPIE
LIB_CFLAGS := -fPIC
Expand Down Expand Up @@ -128,3 +146,6 @@ NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
@grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
@printf 'local:\n\t*;\n};\n' >>$@

%: %.in
@echo creating $@
$(Q)sed 's:@CONFIGFILE@:'$(configfile)':g;s:@CONFIGDIR@:'$(configdir)':g;s:@STATE_DIR@:'$(statedir)':g;s:@RUNTIME_DIR@:'$(runtimedir)':g;s/@MODPROBE_UNIT@/'$(MODPROBE_UNIT)'/g' $< >$@
140 changes: 96 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ Go to: https://github.com/opensvc/multipath-tools/tags
Select a release-tag and then click on "zip" or "tar.gz".


Devel code
==========

To get latest devel code:

git clone -b queue https://github.com/openSUSE/multipath-tools


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

Expand Down Expand Up @@ -89,9 +81,17 @@ The following variables can be passed to the `make` command line:
* `plugindir="/some/path"`: directory where libmultipath plugins (path
checkers, prioritizers, and foreign multipath support) will be looked up.
This used to be the run-time option `multipath_dir` in earlier versions.
* `configdir="/some/path"` : directory to search for configuration files.
The default is `$(prefix)/$(LIB)/multipath`, where `$(LIB)` is `lib64` on
systems that have `/lib64`, and `lib` otherwise.
* `configfile="/some/path`": The path to the main configuration file.
The default is `$(etc_prefix)/etc/multipath.conf`.
* `configdir="/some/path"` : directory to search for additional configuration files.
This used to be the run-time option `config_dir` in earlier versions.
The default is `/etc/multipath/conf.d`.
The default is `$(etc_prefix)/etc/multipath/conf.d`.
* `statedir="/some/path"`: The path of the directory where multipath-tools
stores run-time settings that need persist between reboots, such as known
WWIDs, user-friendly names, and persistent reservation keys.
The default is `$(etc_prefix)/etc/multipath`.
* `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.
Expand All @@ -103,6 +103,13 @@ The following variables can be passed to the `make` command line:
polling API. For use with pre-5.0 kernels that don't support dmevent polling
(but even if you don't use this option, multipath-tools will work with
these kernels).
* `SYSTEMD`: The version number of systemd (e.g. "244") to compile the code for.
The default is autodetected, assuming that the systemd version in the build
environment is the same as on the target system. Override the value to
build for a different systemd version, or set it to `""` to build for a
system without systemd.
**Caution:** multipathd without systemd has been largely untested by the
upstream maintainers since at least 2020.
* `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
Expand All @@ -114,26 +121,35 @@ The following variables can be passed to the `make` command line:
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.
purpose by creating a `modprobe.d` file like this:

softdep scsi_mod post: scsi_dh_alua scsi_dh_rdac

### 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-merged" distributions[^systemd] may want to set this to `/usr`. The
default is empty (`""`).
* `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`.
for booting. The default is `/usr` if `$(prefix)` is empty, and `$(prefix)` otherwise.
* `systemd_prefix`: Prefix for systemd-related files[^systemd]. The default is `/usr`.
* `etc_prefix`: The prefix for configuration files. "usr-merged"
distributions with immutable `/usr`[^systemd] may want to set this to
`""`. The default is `$(prefix)`.
* `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.
The options `configdir`, `plugindir`, `configfile`, and `statedir` above can
be used for setting individual paths where the `prefix` variables don't provide
sufficient control. See `Makefile.inc` for even more fine-grained control.

[^systemd]: systemd installations up to v254 which have been built with
`split-usr=true` may use separate `prefixdir` and `rootprefixdir`
directories, where `prefixdir` is a subdirectory of `rootprefixdir`.
multipath-tools' `systemd_prefix` corresponds to systemd's `prefixdir`.
On such distributions, override `unitdir` and `libudevdir` to use systemd's
`rootprefix`: `make libudevdir=/lib/udev unitdir=/lib/systemd/system`

### Compiler Options

Expand Down Expand Up @@ -163,32 +179,58 @@ The following targets are intended for developers only.
* `make compile-commands.json` to create input for [clangd](https://clangd.llvm.org/).


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

Follow the instructions in the `libmultipath/hwtable.c` header.
Contributing
============

Please send patches or contributions for general discussion about
multipath tools to the mailing list (see below). You can also create
issues or pull requests on
[GitHub](https://github.com/opensvc/multipath-tools).
You will be asked to send your patches to the mailing list
unless your patch is trivial.

Mailing list
============
------------

The mailing list for multipath-tools is `[email protected]`.
To subscribe, send an email to `[email protected]`.
Mailing list archives are available on
[lore.kernel.org](https://lore.kernel.org/dm-devel/) and
[marc.info](https://marc.info/?l=dm-devel). See also the
[lists.linux.dev home page](https://subspace.kernel.org/lists.linux.dev.html).

(subscribers-only)
To subscribe and archives: https://listman.redhat.com/mailman/listinfo/dm-devel
Searchable: https://marc.info/?l=dm-devel
When sending patches to the mailing list, please add a `Signed-off-by:`
tag, and add Benjamin Marzinski <bmarzins@redhat.com> and
Martin Wilck <[email protected]> to the Cc list.

Staging area
------------

Between releases, the latest reviewed code can be obtained from
[the queue branch](https://github.com/openSUSE/multipath-tools/tree/queue)
in the openSUSE/multipath-tools repository on GitHub. From there,
pull requests for new releases in the master repository are
created roughly every 3 months.

Adding new storage devices
--------------------------

If you want to add special settings for a storage device which is
new on the market, follow the instructions at the top of the
file `libmultipath/hwtable.c`.

Changelog
=========

pre-0.4.5: https://web.archive.org/web/20070309224034/http://christophe.varoqui.free.fr/wiki/wakka.php?wiki=ChangeLog
post-0.4.5: https://github.com/opensvc/multipath-tools/commits/master
* pre-0.4.5: https://web.archive.org/web/20070309224034/http://christophe.varoqui.free.fr/wiki/wakka.php?wiki=ChangeLog
* post-0.4.5: https://github.com/opensvc/multipath-tools/commits/master


Maintainer
==========

Christophe Varoqui <[email protected]>
Device-mapper development mailing list <dm-devel@redhat.com>
Device-mapper development mailing list <dm-devel@lists.linux.dev>


Licence
Expand Down Expand Up @@ -230,15 +272,25 @@ To enable ALUA, the following options should be changed:

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`

Using dm-multipath with NVMe
----------------------------

NVMe multipath is natively supported by the Linux kernel. If for some reason
you prefer using device mapper multipath with NVMe devices,
you need to disable native multipathing first:

echo "options nvme_core multipath=N" > /etc/modprobe.d/01-nvme_core-mp.conf

Afterwards, regenerate the initramfs (`dracut -f` or `update-initramfs`) and reboot.

Using multipath-tools with native NVMe multipath
------------------------------------------------

If native NVMe multipathing is enabled, you can still use multipath-tools
for displaying the topology and some other information about native NVMe
multipath setups. This feature is disabled by default. To enable it, set
`enable_foreign nvme` in the `defaults` section of `multipath.conf`.
Commands like `multipath -ll` will then display information about NVMe
native multipath. This support is read-only; modifying the native multipath
configuration is not supported.
5 changes: 5 additions & 0 deletions create-config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ TEST_URCU_TYPE_LIMITS = $(shell \
$(CC) -c -Werror=type-limits -o /dev/null -xc - 2>/dev/null \
|| echo -Wno-type-limits )

URCU_VERSION = $(shell \
$(PKG_CONFIG) --modversion liburcu 2>/dev/null | \
awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }')

DEFINES :=

ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
Expand Down Expand Up @@ -168,6 +172,7 @@ $(TOPDIR)/config.mk: $(multipathdir)/autoconfig.h
@echo creating $@
@echo "FPIN_SUPPORT := $(FPIN_SUPPORT)" >$@
@echo "FORTIFY_OPT := $(FORTIFY_OPT)" >>$@
@echo "D_URCU_VERSION := $(call URCU_VERSION)" >>$@
@echo "SYSTEMD := $(SYSTEMD)" >>$@
@echo "ANA_SUPPORT := $(ANA_SUPPORT)" >>$@
@echo "STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)" >>$@
Expand Down
2 changes: 1 addition & 1 deletion libdmmp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ install:
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
$(Q)sed -i 's|__INCLUDEDIR__|$(includedir)|g' \
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
$(Q)$(INSTALL_PROGRAM) -d 755 $(DESTDIR)$(mandir)/man3
$(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(mandir)/man3
$(Q)$(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(mandir)/man3 docs/man/*.3

uninstall:
Expand Down
18 changes: 4 additions & 14 deletions libmpathutil/libmpathutil.version
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,15 @@ local:
};

/* symbols referenced internally by libmultipath */
LIBMPATHUTIL_1.0 {
LIBMPATHUTIL_2.0 {
alloc_bitfield;
__append_strbuf_str;
append_strbuf_quoted;
basenamecpy;
cleanup_fd_ptr;
cleanup_free_ptr;
cleanup_vector_free;
cleanup_fclose;
filepresent;
find_keyword;
free_keywords;
Expand All @@ -113,29 +116,16 @@ LIBMPATHUTIL_1.0 {
log_safe;
msort;
parse_devt;
parse_prkey;
process_file;
safe_write;
set_value;
should_exit;
snprint_keyword;
steal_strbuf_str;
strlcat;
systemd_service_enabled;
validate_config_strvec;
vector_find_or_add_slot;
vector_insert_slot;
vector_move_up;
vector_sort;
};

LIBMPATHUTIL_1.1 {
global:
cleanup_fd_ptr;
} LIBMPATHUTIL_1.0;

LIBMPATHUTIL_1.2 {
global:
cleanup_vector_free;
cleanup_fclose;
} LIBMPATHUTIL_1.0;
Loading

0 comments on commit 6bb7330

Please sign in to comment.