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

From 8f423bfbc8df7d8b4f3eea7df7c405225cf3bd54 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 bdf29b99c..c2d7545eb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -465,6 +465,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 \
@@ -6042,6 +6043,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 06ff27147..babb3d784 100644
--- a/rules/60-persistent-storage.rules
+++ b/rules/60-persistent-storage.rules
@@ -86,7 +86,7 @@ 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}"
 
 # add symlink to GPT root disk
 ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_GPT_AUTO_ROOT}=="1", SYMLINK+="gpt-auto-root"
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