Message ID | 20231024164937.14684-6-mwilck@suse.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Delegated to: | christophe varoqui |
Headers | show |
Series | multipath: aio and systemd service improvements | expand |
On Tue, Oct 24, 2023 at 06:49:36PM +0200, mwilck@suse.com wrote: > From: Martin Wilck <mwilck@suse.com> > > Since 92f0893 ("multipath-tools: install modules-load.d/multipath.conf"), we > use modules-load.d to load the dm-multipath module early on. That isn't > optimal, because the module will always be loaded, even if multipathd is > not running. > > Use systemd's "modprobe@.service" instead to make sure the module is loaded > before multipathd starts. If "multipath -u" is invoked from udev rules > before multipathd.service has been started, it will access the socket, > which will autostart multipathd via socket activation and cause the > dm-multipath module to be loaded. > > Signed-off-by: Martin Wilck <mwilck@suse.com> Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com> > --- > multipath/Makefile | 2 -- > multipath/modules-load.conf | 3 --- > multipathd/multipathd.service | 2 ++ > 3 files changed, 2 insertions(+), 5 deletions(-) > delete mode 100644 multipath/modules-load.conf > > diff --git a/multipath/Makefile b/multipath/Makefile > index 68cb5ce..a69262b 100644 > --- a/multipath/Makefile > +++ b/multipath/Makefile > @@ -28,7 +28,6 @@ install: > $(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) > $(Q)$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/56-multipath.rules > $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(modulesloaddir) > - $(Q)$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf > $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir) > $(Q)$(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf > $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8 > @@ -44,7 +43,6 @@ endif > uninstall: > $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC) > $(Q)$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules > - $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf > $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf > $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules > $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8 > diff --git a/multipath/modules-load.conf b/multipath/modules-load.conf > deleted file mode 100644 > index b517d32..0000000 > --- a/multipath/modules-load.conf > +++ /dev/null > @@ -1,3 +0,0 @@ > -# load dm-multipath early, both multipathd and multipath depend on it > -# (note that multipath may be called from udev rules!) > -dm-multipath > diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service > index 5a9cde1..40cf32c 100644 > --- a/multipathd/multipathd.service > +++ b/multipathd/multipathd.service > @@ -3,6 +3,8 @@ Description=Device-Mapper Multipath Device Controller > Before=lvm2-activation-early.service > Before=local-fs-pre.target blk-availability.service shutdown.target > Wants=systemd-udevd-kernel.socket > +Requires=modprobe@dm_multipath.service > +After=modprobe@dm_multipath.service > After=systemd-udevd-kernel.socket > After=multipathd.socket systemd-remount-fs.service > Before=initrd-cleanup.service > -- > 2.42.0
On Wed, 2023-10-25 at 19:43 -0400, Benjamin Marzinski wrote: > On Tue, Oct 24, 2023 at 06:49:36PM +0200, mwilck@suse.com wrote: > > From: Martin Wilck <mwilck@suse.com> > > > > Since 92f0893 ("multipath-tools: install modules- > > load.d/multipath.conf"), we > > use modules-load.d to load the dm-multipath module early on. That > > isn't > > optimal, because the module will always be loaded, even if > > multipathd is > > not running. > > > > Use systemd's "modprobe@.service" instead to make sure the module > > is loaded > > before multipathd starts. If "multipath -u" is invoked from udev > > rules > > before multipathd.service has been started, it will access the > > socket, > > which will autostart multipathd via socket activation and cause the > > dm-multipath module to be loaded. > > > > Signed-off-by: Martin Wilck <mwilck@suse.com> > Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com> I just realized that modprobe@.service has only be available since systemd v245 (2020). I should make this change conditional on the systemd version. Martin
diff --git a/multipath/Makefile b/multipath/Makefile index 68cb5ce..a69262b 100644 --- a/multipath/Makefile +++ b/multipath/Makefile @@ -28,7 +28,6 @@ install: $(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir) $(Q)$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/56-multipath.rules $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(modulesloaddir) - $(Q)$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir) $(Q)$(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8 @@ -44,7 +43,6 @@ endif uninstall: $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC) $(Q)$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules - $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8 diff --git a/multipath/modules-load.conf b/multipath/modules-load.conf deleted file mode 100644 index b517d32..0000000 --- a/multipath/modules-load.conf +++ /dev/null @@ -1,3 +0,0 @@ -# load dm-multipath early, both multipathd and multipath depend on it -# (note that multipath may be called from udev rules!) -dm-multipath diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service index 5a9cde1..40cf32c 100644 --- a/multipathd/multipathd.service +++ b/multipathd/multipathd.service @@ -3,6 +3,8 @@ Description=Device-Mapper Multipath Device Controller Before=lvm2-activation-early.service Before=local-fs-pre.target blk-availability.service shutdown.target Wants=systemd-udevd-kernel.socket +Requires=modprobe@dm_multipath.service +After=modprobe@dm_multipath.service After=systemd-udevd-kernel.socket After=multipathd.socket systemd-remount-fs.service Before=initrd-cleanup.service