All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-devel] [PATCH v2 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers
@ 2022-02-04  7:30 mwilck
  2022-02-07 20:21 ` Benjamin Marzinski
  0 siblings, 1 reply; 2+ messages in thread
From: mwilck @ 2022-02-04  7:30 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 ++++++
 multipath/scsi_dh.conf | 2 ++
 3 files changed, 13 insertions(+)
 create mode 100644 multipath/scsi_dh.conf

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
diff --git a/multipath/scsi_dh.conf b/multipath/scsi_dh.conf
new file mode 100644
index 0000000..a13dd82
--- /dev/null
+++ b/multipath/scsi_dh.conf
@@ -0,0 +1,2 @@
+# Load SCSI device handler modules for multipath early
+# This file may be empty
-- 
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] 2+ messages in thread

* Re: [dm-devel] [PATCH v2 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers
  2022-02-04  7:30 [dm-devel] [PATCH v2 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers mwilck
@ 2022-02-07 20:21 ` Benjamin Marzinski
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Marzinski @ 2022-02-07 20:21 UTC (permalink / raw)
  To: mwilck; +Cc: dm-devel

On Fri, Feb 04, 2022 at 08:30:36AM +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
> 
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  Makefile.inc           | 5 +++++
>  multipath/Makefile     | 6 ++++++
>  multipath/scsi_dh.conf | 2 ++
>  3 files changed, 13 insertions(+)
>  create mode 100644 multipath/scsi_dh.conf
> 
> 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
> diff --git a/multipath/scsi_dh.conf b/multipath/scsi_dh.conf
> new file mode 100644
> index 0000000..a13dd82
> --- /dev/null
> +++ b/multipath/scsi_dh.conf
> @@ -0,0 +1,2 @@
> +# Load SCSI device handler modules for multipath early
> +# This file may be empty
> -- 
> 2.34.1

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


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

end of thread, other threads:[~2022-02-08 22:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04  7:30 [dm-devel] [PATCH v2 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers mwilck
2022-02-07 20:21 ` 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.