[dm-devel] [PATCH 5/6] multipath: Makefile: modules-load.d file for SCSI device handlers
mwilck at suse.com
mwilck at suse.com
Tue Feb 1 23:40:23 UTC 2022
From: Martin Wilck <mwilck at 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 at 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
More information about the dm-devel
mailing list