lvm2/0004-Revert-dm-udev-rules-don-t-export-and-save-DM_SUSPEN.patch

89 lines
4.1 KiB
Diff
Raw Permalink Normal View History

From 885113b30d7873ac671490715312431f706d26e8 Mon Sep 17 00:00:00 2001
From: Marian Csontos <mcsontos@redhat.com>
Date: Thu, 16 May 2024 15:30:24 +0200
Subject: [PATCH 04/13] Revert "dm udev rules: don't export and save
DM_SUSPENDED"
This reverts commit 21ca92c4325b6b161fb1e1f10942ad9f8d23c144.
---
udev/10-dm.rules.in | 14 ++++++--------
udev/12-dm-permissions.rules | 1 +
udev/13-dm-disk.rules.in | 4 ++--
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in
index ca255c793..29fe71527 100644
--- a/udev/10-dm.rules.in
+++ b/udev/10-dm.rules.in
@@ -11,6 +11,7 @@
# for use in later rules:
# DM_NAME - actual DM device's name
# DM_UUID - UUID set for DM device (blank if not specified)
+# DM_SUSPENDED - suspended state of DM device (0 or 1)
# DM_UDEV_RULES_VSN - DM udev rules version
#
# These rules cover only basic device-mapper functionality in udev.
@@ -122,18 +123,15 @@ LABEL="dm_no_coldplug"
# The "suspended" item was added even later (kernels >= 2.6.31),
# so we also have to call dmsetup if the kernel version used
# is in between these releases.
-TEST=="dm", ENV{DM_NAME}="$attr{dm/name}", ENV{DM_UUID}="$attr{dm/uuid}", ENV{.DM_SUSPENDED}="$attr{dm/suspended}"
+TEST=="dm", ENV{DM_NAME}="$attr{dm/name}", ENV{DM_UUID}="$attr{dm/uuid}", ENV{DM_SUSPENDED}="$attr{dm/suspended}"
TEST!="dm", IMPORT{program}="(DM_EXEC)/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o name,uuid,suspended"
+ENV{DM_SUSPENDED}!="?*", IMPORT{program}="(DM_EXEC)/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o suspended"
-ENV{.DM_SUSPENDED}=="?*", GOTO="dm_suspended_set"
-TEST=="dm", IMPORT{program}="(DM_EXEC)/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o suspended"
# dmsetup tool provides suspended state information in textual
# form with values "Suspended"/"Active". We translate it to
# 0/1 respectively to be consistent with sysfs values.
-ENV{DM_SUSPENDED}=="Active", ENV{.DM_SUSPENDED}="0"
-ENV{DM_SUSPENDED}=="Suspended", ENV{.DM_SUSPENDED}="1"
-ENV{DM_SUSPENDED}=""
-LABEL="dm_suspended_set"
+ENV{DM_SUSPENDED}=="Active", ENV{DM_SUSPENDED}="0"
+ENV{DM_SUSPENDED}=="Suspended", ENV{DM_SUSPENDED}="1"
# This variable provides a reliable way to check that device-mapper
# rules were installed. It means that all needed variables are set
@@ -151,7 +149,7 @@ ENV{DM_UDEV_DISABLE_DM_RULES_FLAG}!="1", ENV{DM_NAME}=="?*", SYMLINK+="(DM_DIR)/
# Avoid processing and scanning a DM device in the other (foreign)
# rules if it is in suspended state. However, we still keep 'disk'
# and 'DM subsystem' related rules enabled in this case.
-ENV{.DM_SUSPENDED}=="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
+ENV{DM_SUSPENDED}=="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
GOTO="dm_end"
diff --git a/udev/12-dm-permissions.rules b/udev/12-dm-permissions.rules
index 9624ddc5e..8d3bc224a 100644
--- a/udev/12-dm-permissions.rules
+++ b/udev/12-dm-permissions.rules
@@ -14,6 +14,7 @@
# DM_UDEV_RULES_VSN - DM udev rules version
# DM_NAME - actual DM device's name
# DM_UUID - UUID set for DM device (blank if not specified)
+# DM_SUSPENDED - suspended state of DM device (0 or 1)
# DM_LV_NAME - logical volume name (not set if LVM device not present)
# DM_VG_NAME - volume group name (not set if LVM device not present)
# DM_LV_LAYER - logical volume layer (not set if LVM device not present)
diff --git a/udev/13-dm-disk.rules.in b/udev/13-dm-disk.rules.in
index 96f1efc00..3e1eaa6ee 100644
--- a/udev/13-dm-disk.rules.in
+++ b/udev/13-dm-disk.rules.in
@@ -17,9 +17,9 @@ ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_end"
SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}"
ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"
-ENV{.DM_SUSPENDED}=="1", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", GOTO="dm_import"
+ENV{DM_SUSPENDED}=="1", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", GOTO="dm_import"
ENV{DM_NOSCAN}=="1", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", GOTO="dm_import"
-ENV{.DM_SUSPENDED}=="1", GOTO="dm_end"
+ENV{DM_SUSPENDED}=="1", GOTO="dm_end"
ENV{DM_NOSCAN}=="1", GOTO="dm_watch"
(BLKID_RULE)
--
2.47.0