File 0001-udev-don-t-create-by-partlabel-primary-and-.-logical.patch of Package systemd.11703

From 34f38aa61d5189a0258982efd976da7d249a11d3 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 16 Apr 2018 23:03:27 +0200
Subject: [PATCH 1/2] udev: don't create by-partlabel/primary and .../logical
 symlinks

These links are created by libstorage / parted by default.  They are ambiguous
and may be present hundred- or thousandfold on large systems. They are
meaningless for device identification and may slow down udev processing. They
aren't used anywhere.  Don't create them.

A service has been added to detect at boot cases that likely need to be fixed:
a warning is thrown at both the console and syslog to encourage sysadmin to
consult the relevant TID explaining how to permanently fix the issue.

[fbui: added the detection part]
[fbui: fixes bsc#1089761]
---
 Makefile.am                                |  2 ++
 rules/60-persistent-storage.rules          |  2 +-
 units/detect-part-label-duplicates.service | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 units/detect-part-label-duplicates.service

diff --git a/Makefile.am b/Makefile.am
index 240d193eb..84563d4a9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -489,6 +489,7 @@ dist_sysctl_DATA = \
 	sysctl.d/50-default.conf
 
 dist_systemunit_DATA = \
+	units/detect-part-label-duplicates.service \
 	units/graphical.target \
 	units/multi-user.target \
 	units/emergency.target \
@@ -6586,6 +6587,7 @@ MULTI_USER_TARGET_WANTS += \
 	systemd-ask-password-wall.path
 
 SYSINIT_TARGET_WANTS += \
+	detect-part-label-duplicates.service \
 	dev-hugepages.mount \
 	dev-mqueue.mount \
 	sys-kernel-config.mount \
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
index d2745f65f..5e803d639 100644
--- a/rules/60-persistent-storage.rules
+++ b/rules/60-persistent-storage.rules
@@ -92,6 +92,6 @@ ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-i
 
 # by-partlabel/by-partuuid links (partition metadata)
 ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}"
-ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}"
+ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", ENV{ID_PART_ENTRY_NAME}!="primary|logical", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}"
 
 LABEL="persistent_storage_end"
diff --git a/units/detect-part-label-duplicates.service b/units/detect-part-label-duplicates.service
new file mode 100644
index 000000000..1fbca2114
--- /dev/null
+++ b/units/detect-part-label-duplicates.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Detect if the system suffers from bsc#1089761
+ConditionDirectoryNotEmpty=/run/udev/data
+
+[Service]
+RemainAfterExit=true
+StandardOutput=syslog+console
+SyslogLevel=warning
+ExecStart=/bin/sh -c " \
+    if [ $(grep -r "E:ID_PART_ENTRY_NAME=primary" /run/udev/data | wc -l) -ge 100 ]; then \
+      echo 'Warning: a high number of partitions uses \"primary\" or \"logical\" as'; \
+      echo 'partition label name, which may cause slow-down in the boot process.'; \
+      echo 'To prevent it, a workaround is temporarly in place but we recommend to'; \
+      echo 'refer to TID #7023057 in order to permanently fix this issue (as the'; \
+      echo 'workaround will be dropped in the future).'; \
+    fi"
-- 
2.18.0

openSUSE Build Service is sponsored by