device-mapper-multipath/0002-multipath-attempt-at-common-multipath.rules.patch
Benjamin Marzinski a4bb435b33 device-mapper-multipath-0.7.1-1.gitf21166a
- Update Source to the latest upstream commit
- Add 0001-libmultipath-add-comment-about-resuming.patch
  * posted upstream
- Add 0002-multipath-attempt-at-common-multipath.rules.patch
  * under discussion upstream
- Add 0003-RH-fixup-udev-rules-for-redhat.patch
  * Redhat uses different udev rules that some other distros, so multipath
    has run at a different time. Not all upstream distros link /sbin and
    /usr/sbin either.
- Add 0004-RH-Remove-the-property-blacklist-exception-builtin.patch
  * Allow multipath to be used on devices without multiple paths. NAK'ed
    upstream, but requested by Red Hat
- Add 0005-RH-don-t-start-without-a-config-file.patch
  * Don't start multipath unless a config file exists. NAK'ed upstream,
    but requested by Red Hat
- Add 0006-RH-use-rpm-optflags-if-present.patch
  * Make the build system fedora friendly
- Add 0007-RH-add-mpathconf.patch
  * Add tool to help configure multipath with Red Hat defaults.
- Add 0008-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
  * Make multipath able to claim devices based on the kernel command line
    NAK'ed upstream but requested by Red Hat
- Add 0009-RH-trigger-change-uevent-on-new-device-creation.patch
  * under discussion upstream
2017-05-25 17:12:56 -05:00

108 lines
4.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 12 Apr 2017 09:07:51 -0500
Subject: [PATCH] multipath: attempt at common multipath.rules
This is a proposal to try and bring the Redhat and SuSE multipath.rules
closer. There are a couple of changes that I'd like some input on.
The big change is moving the kpartx call into the multipath rules. Half
of the current kpartx.rules file is about creating symlinks for multiple
types of dm devices. The other half auto-creates kpartx devices on top
of multipath devices. Since it is only creating kpartx devices on top of
multipath devices, I've moved the these rules into multipath.rules, or
rather, I've replaced them with the redhat rules in multipath.rules. The
biggest difference is the kpartx isn't run on every reload. It works
with the 11-dm-mpath.rules code to not run kpartx on multipathd
generated reloads or when there aren't any working paths. It does
remember if it didn't get to run kpartx when it was supposed to (because
there were no valid paths or the device was suspended) and will make
sure to run it on the next possible uevent.
The other change is the redhat multipath rules remove the partition
device nodes for devices claimed by multipath. The udev rule will only
do this one time (both to keep from running partx on every event, and so
that if users manually reread the partition table, we don't keep
removing them when clearly they are wanted). Redhat does this because we
had multiple customer issues where they were using the scsi partitions
instead of the kpartx devices. Obviously, with setting the partition
devices to not ready and clearing their fs_type, this isn't essential,
but it has helped make customers do the right thing.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
kpartx/kpartx.rules | 8 --------
multipath/multipath.rules | 27 ++++++++++++++++++++++++---
2 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index a958791..906e320 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -34,12 +34,4 @@ ENV{ID_FS_LABEL_ENC}=="?*", IMPORT{db}="ID_FS_LABEL_ENC"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", \
SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
-# Create dm tables for partitions
-ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", GOTO="kpartx_end"
-ENV{DM_NR_VALID_PATHS}=="0", GOTO="kpartx_end"
-ENV{ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
-ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="kpartx_end"
-ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \
- RUN+="/sbin/kpartx -un -p -part /dev/$name"
-
LABEL="kpartx_end"
diff --git a/multipath/multipath.rules b/multipath/multipath.rules
index 86defc0..616a04c 100644
--- a/multipath/multipath.rules
+++ b/multipath/multipath.rules
@@ -1,13 +1,13 @@
# 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*|rbd*|dm-*", GOTO="end_mpath"
IMPORT{cmdline}="nompath"
ENV{nompath}=="?*", GOTO="end_mpath"
IMPORT{cmdline}="multipath"
ENV{multipath}=="off", GOTO="end_mpath"
+KERNEL=="dm-*", GOTO="check_kpartx"
ENV{DEVTYPE}!="partition", GOTO="test_dev"
IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH"
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{ID_FS_TYPE}="none", \
@@ -21,7 +21,28 @@ TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \
PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -u %k", \
- ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="none", \
+ ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="mpath_member", \
ENV{SYSTEMD_READY}="0"
+ENV{DM_MULTIPATH_DEVICE_PATH}!="1", GOTO="end_mpath"
+
+IMPORT{db}="DM_MULTIPATH_WIPE_PARTS"
+ENV{DM_MULTIPATH_WIPE_PARTS}!="1", ENV{DM_MULTIPATH_WIPE_PARTS}="1", \
+ RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
+GOTO="end_mpath"
+
+LABEL="check_kpartx"
+
+IMPORT{db}="DM_MULTIPATH_NEED_KPARTX"
+ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
+ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="end_mpath"
+ACTION!="change", GOTO="end_mpath"
+ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath"
+ENV{DM_ACTIVATION}=="1", ENV{DM_MULTIPATH_NEED_KPARTX}="1"
+ENV{DM_SUSPENDED}=="1", GOTO="end_mpath"
+ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath"
+ENV{DM_ACTIVATION}!="1", ENV{DM_MULTIPATH_NEED_KPARTX}!="1", GOTO="end_mpath"
+RUN+="/sbin/kpartx -un -p -part /dev/$name"
+ENV{DM_MULTIPATH_NEED_KPARTX}=""
+
LABEL="end_mpath"
--
2.7.4