44 lines
1.7 KiB
Diff
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"
|