multipath.rules: handle NVME devices
Subsystems (2)
PATCH 1/3 multipath.rules: handle NVME devices
Note: ID_WWN is set in 60-persistent-storage.rules in current systemd. That won't work well together with us installing multipath.rules as 56-multipath.rules - multipath -u won't see ID_WWN.
However, we have strong reasons to run before blkid is invoked. ID_WWN determination for NVMe should be moved to an earlier udev rule. See systemd pull request #7594 on github.
--- multipath/multipath.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
multipath/multipath.rules +1 -1
@@ -1,7 +1,7 @@ # Set DM_MULTIPATH_DEVICE_PATH if the device should be handled by multipath SUBSYSTEM!="block", GOTO="end_mpath" ACTION!="add|change", GOTO="end_mpath" -KERNEL!="sd*|dasd*", GOTO="end_mpath" +KERNEL!="sd*|dasd*|nvme*", GOTO="end_mpath" IMPORT{cmdline}="nompath" ENV{nompath}=="?*", GOTO="end_mpath"
Signature · 1 line
2.15.1
PATCH 2/3 libmultipath: ignore natively multipathed NVME devices
Such devices have a parent with SUBSYSTEM="nvme-subsystem", not "nvme". Furthermore, avoid a possible segfaults NULL checks.
--- libmultipath/discovery.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
libmultipath/discovery.c +8 -4
@@ -1200,6 +1200,7 @@ nvme_sysfs_pathinfo (struct path * pp, vector hwtable) {struct udev_device *parent;const char *attr_path =NULL ; +const char *attr; attr_path =udev_device_get_sysname (pp->udev);if (!attr_path)
@@ -1209,14 +1210,17 @@ nvme_sysfs_pathinfo (struct path * pp, vector hwtable) &pp->sg_id.host_no, &pp->sg_id.scsi_id) != 2)return 1 ; - pp->sg_id.channel =0 ; - pp->sg_id.lun =atoi (udev_device_get_sysattr_value (pp->udev,"nsid" )); - parent =udev_device_get_parent (pp->udev); + parent =udev_device_get_parent_with_subsystem_devtype (pp->udev, +"nvme" ,NULL );if (!parent)return 1 ; - pp->sg_id.channel =atoi (udev_device_get_sysattr_value (parent,"cntlid" )); + attr =udev_device_get_sysattr_value (pp->udev,"nsid" ); + pp->sg_id.lun = attr ?atoi (attr) :0 ; + + attr =udev_device_get_sysattr_value (parent,"cntlid" ); + pp->sg_id.channel = attr ?atoi (attr) :0 ;snprintf (pp->vendor_id,SCSI_VENDOR_SIZE ,"NVME" ); snprintf(pp->product_id, SCSI_PRODUCT_SIZE, "%s",
Signature · 1 line
2.15.1
PATCH 3/3 multipath-tools: add dependency tracking to Makefiles
In reply to Martin Wilck--- .gitignore | 1 + Makefile.inc | 2 +- kpartx/Makefile | 7 ++++++- libdmmp/Makefile | 7 ++++++- libdmmp/test/Makefile | 9 ++++++++- libmpathcmd/Makefile | 10 ++++++++-- libmpathpersist/Makefile | 8 +++++++- libmultipath/Makefile | 7 ++++++- libmultipath/checkers/Makefile | 8 +++++++- libmultipath/prioritizers/Makefile | 8 +++++++- mpathpersist/Makefile | 7 ++++++- multipath/Makefile | 7 ++++++- multipathd/Makefile | 7 ++++++- tests/Makefile | 9 ++++++++- 14 files changed, 83 insertions(+), 14 deletions(-)
.gitignore +1 -0
@@ -5,6 +5,7 @@ *.so.0 *.a *.gz +*.d kpartx/kpartx multipath/multipath multipathd/multipathd
Makefile.inc +1 -1
@@ -91,7 +91,7 @@ OPTFLAGS = -O2 -g -pipe -Wall -Wextra -Wformat=2 -Werror=implicit-int \ --param=ssp-buffer-size=4 CFLAGS := $(OPTFLAGS) -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \ - $(CFLAGS) + -MMD -MP $(CFLAGS) BIN_CFLAGS = -fPIE -DPIE LIB_CFLAGS = -fPIC SHARED_FLAGS = -shared
kpartx/Makefile +6 -1
@@ -44,5 +44,10 @@ uninstall: $(RM) $(DESTDIR)$(libudevdir)/rules.d/67-kpartx-compat.rules $(RM) $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules -clean: +clean: dep_clean $(RM) core *.o $(EXEC) *.gz + +include $(wildcard $(OBJS:.o=.d)) + +dep_clean: + $(RM) $(OBJS:.o=.d)
libdmmp/Makefile +6 -1
@@ -56,11 +56,13 @@ uninstall: $(RM) $(DESTDIR)$(man3dir)/libdmmp.h* $(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE) -clean: +clean: dep_clean $(RM) core *.a *.o *.gz *.so *.so.* $(RM) -r docs/man $(MAKE) -C test clean +include $(wildcard $(OBJS:.o=.d)) + check: all $(MAKE) -C test check
@@ -84,3 +86,6 @@ docs/man/$(EXTRA_MAN_FILES).gz: $(HEADERS) gzip -f $$file; \ done find docs/man -type f -name \*[0-9].gz + +dep_clean: + $(RM) $(OBJS:.o=.d)
libdmmp/test/Makefile +8 -1
@@ -26,5 +26,12 @@ speed_test: $(SPD_TEST_EXEC) sudo env LD_LIBRARY_PATH=$(_libdmmpdir):$(_mpathcmddir) \ time -p ./$(SPD_TEST_EXEC) -clean: +clean: dep_clean rm -f $(TEST_EXEC) $(SPD_TEST_EXEC) + +OBJS = $(TEST_EXEC).o $(SPD_TEST_EXEC).o +include $(wildcard $(OBJS:.o=.d)) + + +dep_clean: + $(RM) $(OBJS:.o=.d)
libmpathcmd/Makefile +8 -2
@@ -26,5 +26,11 @@ uninstall: $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB) $(RM) $(DESTDIR)$(includedir)/mpath_cmd.h -clean: - $(RM) core *.a *.o *.so *.so.* *.gz +clean: dep_clean + $(RM) core *.a *.o *.so *.so.* *.gz + +include $(wildcard $(OBJS:.o=.d)) + + +dep_clean: + $(RM) $(OBJS:.o=.d)
libmpathpersist/Makefile +7 -1
@@ -37,5 +37,11 @@ uninstall: $(RM) $(DESTDIR)$(includedir)/mpath_persist.h $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB) -clean: +clean: dep_clean $(RM) core *.a *.o *.so *.so.* *.gz + +include $(wildcard $(OBJS:.o=.d)) + + +dep_clean: + $(RM) $(OBJS:.o=.d)
libmultipath/Makefile +6 -1
@@ -61,5 +61,10 @@ uninstall: $(RM) $(DESTDIR)$(syslibdir)/$(LIBS) $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB) -clean: +clean: dep_clean $(RM) core *.a *.o *.so *.so.* *.gz + +include $(wildcard $(OBJS:.o=.d)) + +dep_clean: + $(RM) $(OBJS:.o=.d)
libmultipath/checkers/Makefile +7 -1
@@ -36,5 +36,11 @@ install: uninstall: for file in $(LIBS); do $(RM) $(DESTDIR)$(libdir)/$$file; done -clean: +clean: dep_clean $(RM) core *.a *.o *.gz *.so + +OBJS := $(LIBS:libcheck%.so=%.o) libsg.o directio.o +include $(wildcard $(OBJS:.o=.d)) + +dep_clean: + $(RM) $(OBJS:.o=.d)
libmultipath/prioritizers/Makefile +7 -1
@@ -38,5 +38,11 @@ install: $(LIBS) uninstall: for file in $(LIBS); do $(RM) $(DESTDIR)$(libdir)/$$file; done -clean: +clean: dep_clean $(RM) core *.a *.o *.gz *.so + +OBJS = $(LIBS:libprio%.so=%.o) alua_rtpg.o +include $(wildcard $(OBJS:.o=.d)) + +dep_clean: + $(RM) $(OBJS:.o=.d)
mpathpersist/Makefile +6 -1
@@ -22,9 +22,14 @@ install: $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir) $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(man8dir) -clean: +clean: dep_clean $(RM) core *.o $(EXEC) *.gz +include $(wildcard $(OBJS:.o=.d)) + uninstall: $(RM) $(DESTDIR)$(bindir)/$(EXEC) $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz + +dep_clean: + $(RM) $(OBJS:.o=.d)
multipath/Makefile +6 -1
@@ -37,5 +37,10 @@ uninstall: $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz $(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz -clean: +clean: dep_clean $(RM) core *.o $(EXEC) *.gz + +include $(wildcard $(OBJS:.o=.d)) + +dep_clean: + $(RM) $(OBJS:.o=.d)
multipathd/Makefile +6 -1
@@ -49,5 +49,10 @@ uninstall: $(RM) $(DESTDIR)$(unitdir)/$(EXEC).service $(RM) $(DESTDIR)$(unitdir)/$(EXEC).socket -clean: +clean: dep_clean $(RM) core *.o $(EXEC) *.gz + +include $(wildcard $(OBJS:.o=.d)) + +dep_clean: + $(RM) $(OBJS:.o=.d)
tests/Makefile +8 -1
@@ -17,7 +17,14 @@ TESTS := uevent all: $(TESTS:%=%.out) -clean: +clean: dep_clean rm -f $(TESTS:%=%-test) $(TESTS:%=%.out) $(TESTS:%=%.o) +OBJS = $(TESTS:%=%.o) +include $(wildcard $(OBJS:.o=.d)) + + + +dep_clean: + $(RM) $(OBJS:.o=.d)
Signature · 1 line
2.15.1
Quoted 8 lines · Martin Wilck
Note:
ID_WWNis set in 60-persistent-storage.rules in current systemd. That won't work well together with us installing multipath.rules as 56-multipath.rules - multipath -u won't seeID_WWN.However, we have strong reasons to run before blkid is invoked.
ID_WWNdetermination for NVMe should be moved to an earlier udev rule. See systemd pull request #7594 on github.
ACK for all three.
Quoted 20 lines
Signed-off-by Martin Wilck <[email protected]>--- multipath/multipath.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)multipath/multipath.rules +1
-1@@ -1,7 +1,7 @@ # Set DM_MULTIPATH_DEVICE_PATH if the device should be handled by multipath SUBSYSTEM!="block", GOTO="end_mpath" ACTION!="add|change", GOTO="end_mpath" -KERNEL!="sd*|dasd*", GOTO="end_mpath" +KERNEL!="sd*|dasd*|nvme*", GOTO="end_mpath" IMPORT{cmdline}="nompath" ENV{nompath}=="?*", GOTO="end_mpath"Signature · 1 line
2.15.1