multipath: Makefile: modules-load.d file for SCSI device handlers
Subsystems (2)
PATCH v2 5/6 multipath: Makefile: modules-load.d file for SCSI device handlers
From: Martin Wilck <[email protected]>
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
--- Makefile.inc | 5 +++++ multipath/Makefile | 6 ++++++ multipath/scsi_dh.conf | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 multipath/scsi_dh.conf
Makefile.inc +5 -0
@@ -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),)
multipath/Makefile +6 -0
@@ -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
multipath/scsi_dh.conf new file +2 -0
@@ -0,0 +1,2 @@ +# Load SCSI device handler modules for multipath early +# This file may be empty
Signature · 7 lines
2.34.1 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Quoted 17 lines · On Fri, Feb 04, 2022 at 08:30:36AM +0100, [email protected] wrote:
From: Martin Wilck <[email protected]>
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
Quoted 8 lines
dracut automatically adds modules-load.d files and the modules they reference to the initramfs.
Note: distributions that compile
scsi_modas a module may rather want to use a modprobe.d file with a statement like this:softdep
scsi_modpost:scsi_dh_aluascsi_dh_rdac
Quoted 56 lines
Signed-off-by Martin Wilck <[email protected]>--- Makefile.inc | 5 +++++ multipath/Makefile | 6 ++++++ multipath/scsi_dh.conf | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 multipath/scsi_dh.confMakefile.inc +5
-0@@ -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),)multipath/Makefile +6
-0@@ -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.5multipath/scsi_dh.conf new file +2
-0@@ -0,0 +1,2 @@ +# Load SCSI device handler modules for multipath early +# This file may be emptySignature · 1 line
2.34.1
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel