From a3474351cbdca06224c6bdbeaca302f58b0429b21ec01cdc85bffd2d37ddf7f0 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Thu, 31 Jul 2014 06:53:04 +0000 Subject: [PATCH] - udev: use device mapper target name for btrfs device ready (bnc#888215). - Add udev-use-device-mapper-target-name-for-btrfs-device-ready.patch - udev: use device mapper target name for btrfs device ready (bnc#888215). - Add udev-use-device-mapper-target-name-for-btrfs-device-ready.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=743 --- systemd-mini.changes | 6 +++ systemd-mini.spec | 3 ++ systemd.changes | 6 +++ systemd.spec | 3 ++ ...r-target-name-for-btrfs-device-ready.patch | 43 +++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 100644 udev-use-device-mapper-target-name-for-btrfs-device-ready.patch diff --git a/systemd-mini.changes b/systemd-mini.changes index 1614dde..148d331 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jul 30 21:10:32 UTC 2014 - jeffm@suse.com + +- udev: use device mapper target name for btrfs device ready (bnc#888215). +- Add udev-use-device-mapper-target-name-for-btrfs-device-ready.patch + ------------------------------------------------------------------- Wed Jul 30 12:53:07 UTC 2014 - werner@suse.de diff --git a/systemd-mini.spec b/systemd-mini.spec index e3dbc57..5ae6c6c 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -884,6 +884,8 @@ Patch1057: 1057-udev-unify-event-timeout-handling.patch Patch1058: 1058-udev-unify-event-timeout-handling.patch # PATCH-FIX-UPSTREAM 1059-udev-fixup-commit-dd5eddd28a74a49607a8fffcaf960040db.patch Patch1059: 1059-udev-fixup-commit-dd5eddd28a74a49607a8fffcaf960040db.patch +# PATCH-FIX-SUSE udev-use-device-mapper-target-name-for-btrfs-device-ready.patch +Patch1060: udev-use-device-mapper-target-name-for-btrfs-device-ready.patch %description Systemd is a system and service manager, compatible with SysV and LSB @@ -1491,6 +1493,7 @@ cp %{SOURCE7} m4/ %patch1058 -p0 %endif %patch1059 -p0 +%patch1060 -p1 # ensure generate files are removed rm -f units/emergency.service diff --git a/systemd.changes b/systemd.changes index 1614dde..6676958 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jul 30 21:10:21 UTC 2014 - jeffm@suse.com + +- udev: use device mapper target name for btrfs device ready (bnc#888215). +- Add udev-use-device-mapper-target-name-for-btrfs-device-ready.patch + ------------------------------------------------------------------- Wed Jul 30 12:53:07 UTC 2014 - werner@suse.de diff --git a/systemd.spec b/systemd.spec index e7ed292..96fa7a6 100644 --- a/systemd.spec +++ b/systemd.spec @@ -879,6 +879,8 @@ Patch1057: 1057-udev-unify-event-timeout-handling.patch Patch1058: 1058-udev-unify-event-timeout-handling.patch # PATCH-FIX-UPSTREAM 1059-udev-fixup-commit-dd5eddd28a74a49607a8fffcaf960040db.patch Patch1059: 1059-udev-fixup-commit-dd5eddd28a74a49607a8fffcaf960040db.patch +# PATCH-FIX-SUSE udev-use-device-mapper-target-name-for-btrfs-device-ready.patch +Patch1060: udev-use-device-mapper-target-name-for-btrfs-device-ready.patch %description Systemd is a system and service manager, compatible with SysV and LSB @@ -1486,6 +1488,7 @@ cp %{SOURCE7} m4/ %patch1058 -p0 %endif %patch1059 -p0 +%patch1060 -p1 # ensure generate files are removed rm -f units/emergency.service diff --git a/udev-use-device-mapper-target-name-for-btrfs-device-ready.patch b/udev-use-device-mapper-target-name-for-btrfs-device-ready.patch new file mode 100644 index 0000000..862afa4 --- /dev/null +++ b/udev-use-device-mapper-target-name-for-btrfs-device-ready.patch @@ -0,0 +1,43 @@ +From: Jeff Mahoney +Subject: udev: use device mapper target name for btrfs device ready +References: bnc#888215 + +When udev gets a change event for a block device, it calls the builtin +btrfs helper to scan it for a btrfs file system. If the file system was +mounted using a device mapper node, mount(8) will have looked up the +device mapper table and used the /dev/mapper/ node for mount. + +If something like partprobe runs, and then causes change events to be +handled, the btrfs ready event is handled using /dev/dm-N instead of +the device mapper named node. Btrfs caches the last name passed to +the scanning ioctl and uses that to report the device name for +things like /proc/mounts. + +So, after running partprobe we go from: +/dev/mapper/test-test on /mnt type btrfs (rw,relatime,space_cache) +... to ... +/dev/dm-0 on /mnt type btrfs (rw,relatime,space_cache) + +This doesn't apply only to LVM device, but multipath as well. + +If the device is a DM device, udev will have already cached the table name +from sysfs and we can use that to pass /dev/mapper/ to the builtin +so that the correct name is used. + +Signed-off-by: Jeff Mahoney +--- + rules/64-btrfs.rules | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/rules/64-btrfs.rules ++++ b/rules/64-btrfs.rules +@@ -6,7 +6,8 @@ ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_en + ENV{SYSTEMD_READY}=="0", GOTO="btrfs_end" + + # let the kernel know about this btrfs filesystem, and check if it is complete +-IMPORT{builtin}="btrfs ready $devnode" ++ENV{DM_NAME}=="", IMPORT{builtin}="btrfs ready $devnode" ++ENV{DM_NAME}=="?*", IMPORT{builtin}="btrfs ready /dev/mapper/$env{DM_NAME}" + + # mark the device as not ready to be used by the system + ENV{ID_BTRFS_READY}=="0", ENV{SYSTEMD_READY}="0"