systemd/udev-use-device-mapper-target-name-for-btrfs-device-ready.patch
Dr. Werner Fink a3474351cb - 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
2014-07-31 06:53:04 +00:00

44 lines
1.7 KiB
Diff

From: Jeff Mahoney <jeffm@suse.com>
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/<name> 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/<name> to the builtin
so that the correct name is used.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
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"