All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-devel] [PATCH 0/6] multipath-tools: kernel module loading improvements
@ 2022-02-01 23:40 mwilck
  2022-02-01 23:40 ` [dm-devel] [PATCH 1/6] multipath/Makefile: use $(udevrulesdir) mwilck
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: mwilck @ 2022-02-01 23:40 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

Continuation of my previous series with cleanup of systemd services.
This series drops the ExecStartPre directive for loading dm-multipath
in favor of a modules-load.d entry. That has the advantage to apply
also for multipath when called in udev rules, and to be added to
the initramfs automatically.

The loading of SCSI device handlers was dropped in the previous series
already. Here, too, a modules-load.d file makes more sense than
ExecStartPre. Some distributions may be served better with a softdep
on scsi_mod, but that's out of scope for upstream. Therefore the list
of device handler modules to preload is configurable.

Martin Wilck (6):
  multipath/Makefile: use $(udevrulesdir)
  multipath-tools: Makefile.inc: delete obsolete comment
  multipath-tools: install modules-load.d/multipath.conf
  multipathd.service: drop ExecStartPre for loading dm-multipath
  multipath: Makefile: modules-load.d file for SCSI device handlers
  README.md: add basic information about building multipath-tools

 Makefile.inc                  | 12 ++++----
 README.md                     | 56 +++++++++++++++++++++++++++++++++++
 multipath/Makefile            | 11 ++++++-
 multipath/modules-load.conf   |  3 ++
 multipathd/multipathd.service |  1 -
 5 files changed, 75 insertions(+), 8 deletions(-)
 create mode 100644 multipath/modules-load.conf

-- 
2.34.1


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dm-devel] [PATCH 1/6] multipath/Makefile: use $(udevrulesdir)
  2022-02-01 23:40 [dm-devel] [PATCH 0/6] multipath-tools: kernel module loading improvements mwilck
@ 2022-02-01 23:40 ` mwilck
  2022-02-03  0:39   ` Benjamin Marzinski
  2022-02-01 23:40 ` [dm-devel] [PATCH 2/6] multipath-tools: Makefile.inc: delete obsolete comment mwilck
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: mwilck @ 2022-02-01 23:40 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 multipath/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/multipath/Makefile b/multipath/Makefile
index 7673553..c690368 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -22,7 +22,7 @@ install:
 	$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
 	$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
 	$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
-	$(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
+	$(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(udevrulesdir)/56-multipath.rules
 	$(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
 	$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
 	$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
-- 
2.34.1


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [dm-devel] [PATCH 2/6] multipath-tools: Makefile.inc: delete obsolete comment
  2022-02-01 23:40 [dm-devel] [PATCH 0/6] multipath-tools: kernel module loading improvements mwilck
  2022-02-01 23:40 ` [dm-devel] [PATCH 1/6] multipath/Makefile: use $(udevrulesdir) mwilck
@ 2022-02-01 23:40 ` mwilck
  2022-02-03  0:39   ` Benjamin Marzinski
  2022-02-01 23:40 ` [dm-devel] [PATCH 3/6] multipath-tools: install modules-load.d/multipath.conf mwilck
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: mwilck @ 2022-02-01 23:40 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

We haven't used the options since 0.4.5.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 Makefile.inc | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/Makefile.inc b/Makefile.inc
index a7d16df..c5f1fa5 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -2,12 +2,6 @@
 # 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
-- 
2.34.1


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [dm-devel] [PATCH 3/6] multipath-tools: install modules-load.d/multipath.conf
  2022-02-01 23:40 [dm-devel] [PATCH 0/6] multipath-tools: kernel module loading improvements mwilck
  2022-02-01 23:40 ` [dm-devel] [PATCH 1/6] multipath/Makefile: use $(udevrulesdir) mwilck
  2022-02-01 23:40 ` [dm-devel] [PATCH 2/6] multipath-tools: Makefile.inc: delete obsolete comment mwilck
@ 2022-02-01 23:40 ` mwilck
  2022-02-03  0:40   ` Benjamin Marzinski
  2022-02-01 23:40 ` [dm-devel] [PATCH 4/6] multipathd.service: drop ExecStartPre for loading dm-multipath mwilck
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: mwilck @ 2022-02-01 23:40 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

If multipath-tools is installed, we want to load the dm-multipath
module early on, because multipath -u might spit out irritating
error messages in syslog otherwise.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 Makefile.inc                | 1 +
 multipath/Makefile          | 3 +++
 multipath/modules-load.conf | 3 +++
 3 files changed, 7 insertions(+)
 create mode 100644 multipath/modules-load.conf

diff --git a/Makefile.inc b/Makefile.inc
index c5f1fa5..5223c96 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -73,6 +73,7 @@ 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
diff --git a/multipath/Makefile b/multipath/Makefile
index c690368..015f73c 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -23,6 +23,8 @@ install:
 	$(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) -d $(DESTDIR)$(modulesloaddir)
+	$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf
 	$(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
 	$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
 	$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
@@ -31,6 +33,7 @@ install:
 uninstall:
 	$(RM) $(DESTDIR)$(bindir)/$(EXEC)
 	$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
+	$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
 	$(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
 	$(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
 	$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5
diff --git a/multipath/modules-load.conf b/multipath/modules-load.conf
new file mode 100644
index 0000000..b517d32
--- /dev/null
+++ b/multipath/modules-load.conf
@@ -0,0 +1,3 @@
+# load dm-multipath early, both multipathd and multipath depend on it
+# (note that multipath may be called from udev rules!)
+dm-multipath
-- 
2.34.1


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [dm-devel] [PATCH 4/6] multipathd.service: drop ExecStartPre for loading dm-multipath
  2022-02-01 23:40 [dm-devel] [PATCH 0/6] multipath-tools: kernel module loading improvements mwilck
                   ` (2 preceding siblings ...)
  2022-02-01 23:40 ` [dm-devel] [PATCH 3/6] multipath-tools: install modules-load.d/multipath.conf mwilck
@ 2022-02-01 23:40 ` mwilck
  2022-02-03  0:40   ` Benjamin Marzinski
  2022-02-01 23:40 ` [dm-devel] [PATCH 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers mwilck
  2022-02-01 23:40 ` [dm-devel] [PATCH 6/6] README.md: add basic information about building multipath-tools mwilck
  5 siblings, 1 reply; 16+ messages in thread
From: mwilck @ 2022-02-01 23:40 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

As we install a modules-load.d file now, no need to call modprobe
in ExecStartPre any more.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 multipathd/multipathd.service | 1 -
 1 file changed, 1 deletion(-)

diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service
index ae98034..aec62db 100644
--- a/multipathd/multipathd.service
+++ b/multipathd/multipathd.service
@@ -16,7 +16,6 @@ ConditionVirtualization=!container
 [Service]
 Type=notify
 NotifyAccess=main
-ExecStartPre=-/sbin/modprobe dm-multipath
 ExecStart=/sbin/multipathd -d -s
 ExecReload=/sbin/multipathd reconfigure
 TasksMax=infinity
-- 
2.34.1


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [dm-devel] [PATCH 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers
  2022-02-01 23:40 [dm-devel] [PATCH 0/6] multipath-tools: kernel module loading improvements mwilck
                   ` (3 preceding siblings ...)
  2022-02-01 23:40 ` [dm-devel] [PATCH 4/6] multipathd.service: drop ExecStartPre for loading dm-multipath mwilck
@ 2022-02-01 23:40 ` mwilck
  2022-02-03  0:37   ` Benjamin Marzinski
  2022-02-01 23:40 ` [dm-devel] [PATCH 6/6] README.md: add basic information about building multipath-tools mwilck
  5 siblings, 1 reply; 16+ messages in thread
From: mwilck @ 2022-02-01 23:40 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

The kernel's autoload mechanism for SCSI device handlers doesn't
work during SCSI device probing. While it's possible to load and
attach device handlers after probing, it has disadvantages: the
handlers are useful for error handling even before multipathd has
started, and at least up to kernel 5.17, the sysfs "access_state" attribute
will remain invisible for already probed devices.

Distributions will therefore want to make sure the handlers are either
built-in in the kernel, or loaded early. Add functionality to
create and install a modules-load.d file with a list of handlers
to load. By default, the list is empty, and no file will be generated.
The list can be specified at install-time like this:

   make SCSI_DH_MODULES_PRELOAD="scsi_dh_rdac scsi_dh_emc" install

dracut automatically adds modules-load.d files and the modules they
reference to the initramfs.

Note: distributions that compile scsi_mod as a module may rather want
to use a modprobe.d file with a statement like this:

softdep scsi_mod post: scsi_dh_alua scsi_dh_rdac

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 Makefile.inc       | 5 +++++
 multipath/Makefile | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/Makefile.inc b/Makefile.inc
index 5223c96..3342af6 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -9,6 +9,11 @@
 # 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),)
diff --git a/multipath/Makefile b/multipath/Makefile
index 015f73c..c930499 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -29,11 +29,17 @@ install:
 	$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
 	$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
 	$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(man5dir)
+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 \
+	    >>$(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)$(man8dir)/$(EXEC).8
 	$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5
-- 
2.34.1


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [dm-devel] [PATCH 6/6] README.md: add basic information about building multipath-tools
  2022-02-01 23:40 [dm-devel] [PATCH 0/6] multipath-tools: kernel module loading improvements mwilck
                   ` (4 preceding siblings ...)
  2022-02-01 23:40 ` [dm-devel] [PATCH 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers mwilck
@ 2022-02-01 23:40 ` mwilck
  2022-02-03  0:40   ` Benjamin Marzinski
  5 siblings, 1 reply; 16+ messages in thread
From: mwilck @ 2022-02-01 23:40 UTC (permalink / raw)
  To: Christophe Varoqui, Benjamin Marzinski; +Cc: dm-devel, Martin Wilck

From: Martin Wilck <mwilck@suse.com>

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/README.md b/README.md
index b15c265..1547862 100644
--- a/README.md
+++ b/README.md
@@ -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
 ===================
 
-- 
2.34.1


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [dm-devel] [PATCH 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers
  2022-02-01 23:40 ` [dm-devel] [PATCH 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers mwilck
@ 2022-02-03  0:37   ` Benjamin Marzinski
  2022-02-03  7:20     ` Martin Wilck
  0 siblings, 1 reply; 16+ messages in thread
From: Benjamin Marzinski @ 2022-02-03  0:37 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Wed, Feb 02, 2022 at 12:40:23AM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> The kernel's autoload mechanism for SCSI device handlers doesn't
> work during SCSI device probing. While it's possible to load and
> attach device handlers after probing, it has disadvantages: the
> handlers are useful for error handling even before multipathd has
> started, and at least up to kernel 5.17, the sysfs "access_state" attribute
> will remain invisible for already probed devices.
> 
> Distributions will therefore want to make sure the handlers are either
> built-in in the kernel, or loaded early. Add functionality to
> create and install a modules-load.d file with a list of handlers
> to load. By default, the list is empty, and no file will be generated.
> The list can be specified at install-time like this:
> 
>    make SCSI_DH_MODULES_PRELOAD="scsi_dh_rdac scsi_dh_emc" install
> 
> dracut automatically adds modules-load.d files and the modules they
> reference to the initramfs.
> 
> Note: distributions that compile scsi_mod as a module may rather want
> to use a modprobe.d file with a statement like this:
> 
> softdep scsi_mod post: scsi_dh_alua scsi_dh_rdac
> 

I think you might need a default scsi_dh.conf file with a comment header
or something. install won't install a file that doesn't exist. Or am I
missing something here?

-Ben

> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  Makefile.inc       | 5 +++++
>  multipath/Makefile | 6 ++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/Makefile.inc b/Makefile.inc
> index 5223c96..3342af6 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -9,6 +9,11 @@
>  # 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),)
> diff --git a/multipath/Makefile b/multipath/Makefile
> index 015f73c..c930499 100644
> --- a/multipath/Makefile
> +++ b/multipath/Makefile
> @@ -29,11 +29,17 @@ install:
>  	$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
>  	$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
>  	$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(man5dir)
> +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 \
> +	    >>$(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)$(man8dir)/$(EXEC).8
>  	$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5
> -- 
> 2.34.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dm-devel] [PATCH 1/6] multipath/Makefile: use $(udevrulesdir)
  2022-02-01 23:40 ` [dm-devel] [PATCH 1/6] multipath/Makefile: use $(udevrulesdir) mwilck
@ 2022-02-03  0:39   ` Benjamin Marzinski
  0 siblings, 0 replies; 16+ messages in thread
From: Benjamin Marzinski @ 2022-02-03  0:39 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Wed, Feb 02, 2022 at 12:40:19AM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  multipath/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/multipath/Makefile b/multipath/Makefile
> index 7673553..c690368 100644
> --- a/multipath/Makefile
> +++ b/multipath/Makefile
> @@ -22,7 +22,7 @@ install:
>  	$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
>  	$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
>  	$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
> -	$(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
> +	$(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(udevrulesdir)/56-multipath.rules
>  	$(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
>  	$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
>  	$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
> -- 
> 2.34.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dm-devel] [PATCH 2/6] multipath-tools: Makefile.inc: delete obsolete comment
  2022-02-01 23:40 ` [dm-devel] [PATCH 2/6] multipath-tools: Makefile.inc: delete obsolete comment mwilck
@ 2022-02-03  0:39   ` Benjamin Marzinski
  0 siblings, 0 replies; 16+ messages in thread
From: Benjamin Marzinski @ 2022-02-03  0:39 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Wed, Feb 02, 2022 at 12:40:20AM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> We haven't used the options since 0.4.5.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  Makefile.inc | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/Makefile.inc b/Makefile.inc
> index a7d16df..c5f1fa5 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -2,12 +2,6 @@
>  # 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
> -- 
> 2.34.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dm-devel] [PATCH 3/6] multipath-tools: install modules-load.d/multipath.conf
  2022-02-01 23:40 ` [dm-devel] [PATCH 3/6] multipath-tools: install modules-load.d/multipath.conf mwilck
@ 2022-02-03  0:40   ` Benjamin Marzinski
  0 siblings, 0 replies; 16+ messages in thread
From: Benjamin Marzinski @ 2022-02-03  0:40 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Wed, Feb 02, 2022 at 12:40:21AM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> If multipath-tools is installed, we want to load the dm-multipath
> module early on, because multipath -u might spit out irritating
> error messages in syslog otherwise.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  Makefile.inc                | 1 +
>  multipath/Makefile          | 3 +++
>  multipath/modules-load.conf | 3 +++
>  3 files changed, 7 insertions(+)
>  create mode 100644 multipath/modules-load.conf
> 
> diff --git a/Makefile.inc b/Makefile.inc
> index c5f1fa5..5223c96 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -73,6 +73,7 @@ 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
> diff --git a/multipath/Makefile b/multipath/Makefile
> index c690368..015f73c 100644
> --- a/multipath/Makefile
> +++ b/multipath/Makefile
> @@ -23,6 +23,8 @@ install:
>  	$(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) -d $(DESTDIR)$(modulesloaddir)
> +	$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf
>  	$(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
>  	$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
>  	$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
> @@ -31,6 +33,7 @@ install:
>  uninstall:
>  	$(RM) $(DESTDIR)$(bindir)/$(EXEC)
>  	$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
> +	$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
>  	$(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
>  	$(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
>  	$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5
> diff --git a/multipath/modules-load.conf b/multipath/modules-load.conf
> new file mode 100644
> index 0000000..b517d32
> --- /dev/null
> +++ b/multipath/modules-load.conf
> @@ -0,0 +1,3 @@
> +# load dm-multipath early, both multipathd and multipath depend on it
> +# (note that multipath may be called from udev rules!)
> +dm-multipath
> -- 
> 2.34.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dm-devel] [PATCH 4/6] multipathd.service: drop ExecStartPre for loading dm-multipath
  2022-02-01 23:40 ` [dm-devel] [PATCH 4/6] multipathd.service: drop ExecStartPre for loading dm-multipath mwilck
@ 2022-02-03  0:40   ` Benjamin Marzinski
  0 siblings, 0 replies; 16+ messages in thread
From: Benjamin Marzinski @ 2022-02-03  0:40 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Wed, Feb 02, 2022 at 12:40:22AM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> As we install a modules-load.d file now, no need to call modprobe
> in ExecStartPre any more.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  multipathd/multipathd.service | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service
> index ae98034..aec62db 100644
> --- a/multipathd/multipathd.service
> +++ b/multipathd/multipathd.service
> @@ -16,7 +16,6 @@ ConditionVirtualization=!container
>  [Service]
>  Type=notify
>  NotifyAccess=main
> -ExecStartPre=-/sbin/modprobe dm-multipath
>  ExecStart=/sbin/multipathd -d -s
>  ExecReload=/sbin/multipathd reconfigure
>  TasksMax=infinity
> -- 
> 2.34.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dm-devel] [PATCH 6/6] README.md: add basic information about building multipath-tools
  2022-02-01 23:40 ` [dm-devel] [PATCH 6/6] README.md: add basic information about building multipath-tools mwilck
@ 2022-02-03  0:40   ` Benjamin Marzinski
  0 siblings, 0 replies; 16+ messages in thread
From: Benjamin Marzinski @ 2022-02-03  0:40 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Wed, Feb 02, 2022 at 12:40:24AM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 56 insertions(+)
> 
> diff --git a/README.md b/README.md
> index b15c265..1547862 100644
> --- a/README.md
> +++ b/README.md
> @@ -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
>  ===================
>  
> -- 
> 2.34.1

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dm-devel] [PATCH 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers
  2022-02-03  0:37   ` Benjamin Marzinski
@ 2022-02-03  7:20     ` Martin Wilck
  2022-02-03 17:24       ` Benjamin Marzinski
  0 siblings, 1 reply; 16+ messages in thread
From: Martin Wilck @ 2022-02-03  7:20 UTC (permalink / raw)
  To: Benjamin Marzinski; +Cc: dm-devel

On Wed, 2022-02-02 at 18:37 -0600, Benjamin Marzinski wrote:
> On Wed, Feb 02, 2022 at 12:40:23AM +0100, mwilck@suse.com wrote:
> > From: Martin Wilck <mwilck@suse.com>
> > 
> > The kernel's autoload mechanism for SCSI device handlers doesn't
> > work during SCSI device probing. While it's possible to load and
> > attach device handlers after probing, it has disadvantages: the
> > handlers are useful for error handling even before multipathd has
> > started, and at least up to kernel 5.17, the sysfs "access_state"
> > attribute
> > will remain invisible for already probed devices.
> > 
> > Distributions will therefore want to make sure the handlers are
> > either
> > built-in in the kernel, or loaded early. Add functionality to
> > create and install a modules-load.d file with a list of handlers
> > to load. By default, the list is empty, and no file will be
> > generated.
> > The list can be specified at install-time like this:
> > 
> >    make SCSI_DH_MODULES_PRELOAD="scsi_dh_rdac scsi_dh_emc" install
> > 
> > dracut automatically adds modules-load.d files and the modules they
> > reference to the initramfs.
> > 
> > Note: distributions that compile scsi_mod as a module may rather
> > want
> > to use a modprobe.d file with a statement like this:
> > 
> > softdep scsi_mod post: scsi_dh_alua scsi_dh_rdac
> > 
> 
> I think you might need a default scsi_dh.conf file with a comment
> header
> or something. install won't install a file that doesn't exist. Or am
> I
> missing something here?

Yes, you would need a conf file. But we can't construct it in the
upstream code. It depends on how the distro compiles the SCSI modules.
softdeps don't work with built-in modules, and with current kmod, there
can be only one softdep directive per module (no stacking) [1]; thus if
the distro (or the admin) needs further softdeps for scsi_mod, the
directives would need to be merged into one, which is tricky to
automate.

The advantage of the softdep over modules-load.d is that it avoids
loading the device handlers for systems without SCSI (like NVMe
laptops, or embedded devices). The distro needs to decide whether or
not that's worth it.

On the contrary, the modules-load.d file stacks nicely with other
packages.

Regards,
Martin

[1] https://www.spinics.net/lists/linux-modules/msg01654.html


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dm-devel] [PATCH 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers
  2022-02-03  7:20     ` Martin Wilck
@ 2022-02-03 17:24       ` Benjamin Marzinski
  2022-02-04  6:45         ` Martin Wilck
  0 siblings, 1 reply; 16+ messages in thread
From: Benjamin Marzinski @ 2022-02-03 17:24 UTC (permalink / raw)
  To: Martin Wilck; +Cc: dm-devel

On Thu, Feb 03, 2022 at 08:20:10AM +0100, Martin Wilck wrote:
> On Wed, 2022-02-02 at 18:37 -0600, Benjamin Marzinski wrote:
> > On Wed, Feb 02, 2022 at 12:40:23AM +0100, mwilck@suse.com wrote:
> > > From: Martin Wilck <mwilck@suse.com>
> > > 
> > > The kernel's autoload mechanism for SCSI device handlers doesn't
> > > work during SCSI device probing. While it's possible to load and
> > > attach device handlers after probing, it has disadvantages: the
> > > handlers are useful for error handling even before multipathd has
> > > started, and at least up to kernel 5.17, the sysfs "access_state"
> > > attribute
> > > will remain invisible for already probed devices.
> > > 
> > > Distributions will therefore want to make sure the handlers are
> > > either
> > > built-in in the kernel, or loaded early. Add functionality to
> > > create and install a modules-load.d file with a list of handlers
> > > to load. By default, the list is empty, and no file will be
> > > generated.
> > > The list can be specified at install-time like this:
> > > 
> > >    make SCSI_DH_MODULES_PRELOAD="scsi_dh_rdac scsi_dh_emc" install
> > > 
> > > dracut automatically adds modules-load.d files and the modules they
> > > reference to the initramfs.
> > > 
> > > Note: distributions that compile scsi_mod as a module may rather
> > > want
> > > to use a modprobe.d file with a statement like this:
> > > 
> > > softdep scsi_mod post: scsi_dh_alua scsi_dh_rdac
> > > 
> > 
> > I think you might need a default scsi_dh.conf file with a comment
> > header
> > or something. install won't install a file that doesn't exist. Or am
> > I
> > missing something here?
> 
> Yes, you would need a conf file. But we can't construct it in the
> upstream code. It depends on how the distro compiles the SCSI modules.
> softdeps don't work with built-in modules, and with current kmod, there
> can be only one softdep directive per module (no stacking) [1]; thus if
> the distro (or the admin) needs further softdeps for scsi_mod, the
> directives would need to be merged into one, which is tricky to
> automate.
> 
> The advantage of the softdep over modules-load.d is that it avoids
> loading the device handlers for systems without SCSI (like NVMe
> laptops, or embedded devices). The distro needs to decide whether or
> not that's worth it.
> 
> On the contrary, the modules-load.d file stacks nicely with other
> packages.

Right, but having a default scsi_dh.conf file that just has a comment
header explaining what it is won't make anything get installed to
modules-load.d by default. You already made that install command
conditional. It just means that running

make SCSI_DH_MODULES_PRELOAD="scsi_dh_rdac scsi_dh_emc" install

will succeed, and give you a scsi_dh.conf in the modules-load.d
directory that loads those modules, instead of failing because there is
no scsi_dh.conf file to install. If you're against having a default
scsi_dh.conf for install to work with, I suppose another option would be
add the modules to scsi_dh.conf first, and then install it. Something
like

ifneq ($(SCSI_DH_MODULES_PRELOAD),)
	> scsi_dh.conf
        for _x in $(SCSI_DH_MODULES_PRELOAD); do echo "$$_x"; done \
            >>scsi_dh.conf
        $(INSTALL_PROGRAM) -m 644 scsi_dh.conf $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
endif

But you have to truncate or remove the local copy of scsi_dh.conf first,
otherwise you would just keep adding the same modules on to the end.
This would mean that distros can't make their own custom scsi_dh.conf.
It would just be generated.

If none of this seems o.k. to you, at the very least you should change
the commit message to metion that

make SCSI_DH_MODULES_PRELOAD="scsi_dh_rdac scsi_dh_emc" install

will only work if you've already created a file named scsi_dh.conf in
the multipath directory.

-Ben

> 
> Regards,
> Martin
> 
> [1] https://www.spinics.net/lists/linux-modules/msg01654.html

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dm-devel] [PATCH 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers
  2022-02-03 17:24       ` Benjamin Marzinski
@ 2022-02-04  6:45         ` Martin Wilck
  0 siblings, 0 replies; 16+ messages in thread
From: Martin Wilck @ 2022-02-04  6:45 UTC (permalink / raw)
  To: Benjamin Marzinski; +Cc: dm-devel

On Thu, 2022-02-03 at 11:24 -0600, Benjamin Marzinski wrote:
> 
> If none of this seems o.k. to you, at the very least you should
> change
> the commit message to metion that
> 
> make SCSI_DH_MODULES_PRELOAD="scsi_dh_rdac scsi_dh_emc" install
> 
> will only work if you've already created a file named scsi_dh.conf in
> the multipath directory.

Ups, I totally misunderstood you, I am sorry. I had an untracked
scsi_dh.conf file in my tree which masked this error. I'll resubmit.

Martin


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-02-04  6:51 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 23:40 [dm-devel] [PATCH 0/6] multipath-tools: kernel module loading improvements mwilck
2022-02-01 23:40 ` [dm-devel] [PATCH 1/6] multipath/Makefile: use $(udevrulesdir) mwilck
2022-02-03  0:39   ` Benjamin Marzinski
2022-02-01 23:40 ` [dm-devel] [PATCH 2/6] multipath-tools: Makefile.inc: delete obsolete comment mwilck
2022-02-03  0:39   ` Benjamin Marzinski
2022-02-01 23:40 ` [dm-devel] [PATCH 3/6] multipath-tools: install modules-load.d/multipath.conf mwilck
2022-02-03  0:40   ` Benjamin Marzinski
2022-02-01 23:40 ` [dm-devel] [PATCH 4/6] multipathd.service: drop ExecStartPre for loading dm-multipath mwilck
2022-02-03  0:40   ` Benjamin Marzinski
2022-02-01 23:40 ` [dm-devel] [PATCH 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers mwilck
2022-02-03  0:37   ` Benjamin Marzinski
2022-02-03  7:20     ` Martin Wilck
2022-02-03 17:24       ` Benjamin Marzinski
2022-02-04  6:45         ` Martin Wilck
2022-02-01 23:40 ` [dm-devel] [PATCH 6/6] README.md: add basic information about building multipath-tools mwilck
2022-02-03  0:40   ` Benjamin Marzinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.