[PATCH v2 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Martin Wilck <mwilck@xxxxxxxx>

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@xxxxxxxx>
---
 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@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux