summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schmitt <scdbackup@gmx.net>2020-01-06 15:10:32 +0800
committerLennart Poettering <lennart@poettering.net>2020-01-09 11:20:55 +0100
commit19212f27816686a5cac2c965301cea8624ac467f (patch)
tree0ec3fe1d72b6845010489bef827c9161a5a3555c
parent125c7814fa50d1459b515180bc6a698b0e56bc61 (diff)
downloadsystemd-19212f27816686a5cac2c965301cea8624ac467f.tar.gz
udev: don't import parent ID_FS_ data on partitions
When probing partitions, we inherit important information from the parent disk device such as ID_MODEL, and usage of such properties is seen to be acceptable and well established. However, we need to exclude filesystem information from the properties that get inherited. Information about the device content should not be passed on in this way. For example, Linux distro install media commonly uses an ISO filesystem plus a partition table. The ISO filesystem is detected on the main disk device, but we should not pass down those details to the partitions, some or all of which may be pointing at storage areas completely distinct from the ISO filesystem. This is particularly problematic when adding new partitions on media set up in this way (since the new partitions are then reported to contain the parent device's ISO filesystem), or when dealing with more unusual hybrid ISO layouts. The inaccuracy of information here inversely affects users of blkid and udev's persistent storage symlinks. Exclude ID_FS_* properties from the inheritance chain to avoid these problems. Fixes: #14408
-rw-r--r--rules.d/60-persistent-storage.rules18
1 files changed, 16 insertions, 2 deletions
diff --git a/rules.d/60-persistent-storage.rules b/rules.d/60-persistent-storage.rules
index 7802b1c94f..01586690bd 100644
--- a/rules.d/60-persistent-storage.rules
+++ b/rules.d/60-persistent-storage.rules
@@ -12,8 +12,22 @@ KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcac
# ignore partitions that span the entire disk
TEST=="whole_disk", GOTO="persistent_storage_end"
-# for partitions import parent information
-ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
+# For partitions import parent disk ID_* information, except ID_FS_*.
+#
+# This is particularly important on media where a filesystem superblock and
+# partition table are found on the same level, e.g. common Linux distro ISO
+# installation media.
+#
+# In the case where a partition device points to the same filesystem that
+# was detected on the parent disk, the ID_FS_* information is already
+# present on the partition devices as well as the parent, so no need to
+# propagate it. In the case where the partition device points to a different
+# filesystem, merging the parent ID_FS_ properties would lead to
+# inconsistencies, so we avoid doing so.
+ENV{DEVTYPE}=="partition", \
+ IMPORT{parent}="ID_[!F]*", IMPORT{parent}="ID_", \
+ IMPORT{parent}="ID_F[!S]*", IMPORT{parent}="ID_F", \
+ IMPORT{parent}="ID_FS[!_]*", IMPORT{parent}="ID_FS"
# NVMe
KERNEL=="nvme*[0-9]n*[0-9]", ATTR{wwid}=="?*", SYMLINK+="disk/by-id/nvme-$attr{wwid}"