mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-09 16:07:03 +00:00
62c0666378
Systemd's btrfs rule runs btrfs dev ready on each device as it's discovered. The btrfs command is executed as a builtin command via an IMPORT{builtin} rule, which means it gets executed at rule evaluation time, not rule execution time. That means that the device mapper links haven't been setup yet and the only nodes that can be depended upon are /dev/dm-#. That we see /dev/mapper/name names in /proc/mounts is only because we replace the device name we have cached with the one passed in via mount. If we have a multi-device file system and the primary device is removed, the remaining devices will show /dev/dm-#. In addition, if the udev rule is executed again by someone generating a change event (e.g. partprobe), the names are also replaced by the /dev/dm-# names. This patch adds a new rule that adds a run rule that calls btrfs dev ready again using the device mapper links once they're created. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
11 lines
387 B
Plaintext
11 lines
387 B
Plaintext
SUBSYSTEM!="block", GOTO="btrfs_end"
|
|
KERNEL!="dm-[0-9]*", GOTO="btrfs_end"
|
|
ACTION!="add|change", GOTO="btrfs_end"
|
|
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
|
|
|
|
# Once the device mapper symlink is created, tell btrfs about it
|
|
# so we get the friendly name in /proc/mounts (and tools that read it)
|
|
ENV{DM_NAME}=="?*", RUN{builtin}+="btrfs ready /dev/mapper/$env{DM_NAME}"
|
|
|
|
LABEL="btrfs_end"
|