1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

udev: decrease devlink priority for iso disks

Previously, if the priority is same, devlinks are always replaced by
newer events. The commit 331aa7aa15 changes
that to keep the existing devlink. That should not change any behavior
when the devices that request the same symlink do not have any
dependency, e.g. when /dev/sda1 and /dev/adb1 request the same
/dev/disk/by-label symlink, as there are no guarantee that which device
is processed first.

However, when devices has dependency, e.g. /dev/sda and /dev/sda1
request the same /dev/disk/by-label symlink, previously the symlink
always pointed to the partition, as the partition is always processed
later. But, 331aa7aa15 makes the symlink
point to the whole disk.

The change by 331aa7aa15 is crucial to
improve performance of devlink handling, especially when a system has
large number of disks with same label or so. Hence, cannot and should
not be reverted.

So, let's workaround the case, as such situation should happen only when
the disk is a hybrind ISO image, I guess.

Fixes #28468.
This commit is contained in:
Yu Watanabe 2023-07-21 11:39:45 +09:00 committed by Luca Boccassi
parent dc3b5e0432
commit df1dccd255

View File

@ -132,6 +132,12 @@ KERNEL!="sr*|mmcblk[0-9]boot[0-9]", IMPORT{builtin}="blkid"
LABEL="persistent_storage_blkid_probe_end"
{% endif %}
# Decrease devlink priority for whole disk of ISO hybrid images, and make the
# priority for partitions in the image relatively higher. This is for the case
# that a disk and one of its partition have the same label or so.
# See issue #28468.
ENV{ID_FS_TYPE}=="iso9660", ENV{DEVTYPE}=="disk", OPTIONS+="link_priority=-10"
# by-label/by-uuid links (filesystem metadata)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"