From: Peter Rajnoha <prajnoha@redhat.com>
To: Martin Wilck <martin.wilck@suse.com>,
Zdenek Kabelac <zkabelac@redhat.com>,
Benjamin Marzinski <bmarzins@redhat.com>,
David Teigland <teigland@redhat.com>
Cc: linux-lvm@lists.linux.dev, dm-devel@lists.linux.dev,
Martin Wilck <mwilck@suse.com>, Hannes Reinecke <hare@suse.de>
Subject: Re: [RFC PATCH 5/7] dm udev rules: don't export and save DM_SUSPENDED
Date: Mon, 4 Mar 2024 12:00:25 +0100 [thread overview]
Message-ID: <2b6bfa53-dfcb-4fe8-859c-8d99a5eadcbf@redhat.com> (raw)
In-Reply-To: <20240301224011.11117-6-mwilck@suse.com>
On 3/1/24 23:40, Martin Wilck wrote:
> DM_SUSPENDED is a device-mapper internal flag, which is not intended to be
> used by other rules, and which is determined by 10-dm.rules from sysfs for
> every uevent. Rename it to ".DM_SUSPENDED", so that it won't be saved in the
> udev database.
>
> Known consumers of DM_SUSPENDED are 66-kpartx.rules (from multipath-tools) and
> 99-systemd.rules (from systemd). These will have to be adapted.
> 11-dm-mpath.rules will be changed to use .DM_SUSPENDED.
>
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
> udev/10-dm.rules.in | 15 +++++++++------
> udev/12-dm-permissions.rules | 2 +-
> udev/13-dm-disk.rules.in | 4 ++--
> 3 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in
> index ef36209..d30f663 100644
> --- a/udev/10-dm.rules.in
> +++ b/udev/10-dm.rules.in
> @@ -11,7 +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_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.
> @@ -114,15 +114,18 @@ 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}=="Active", ENV{.DM_SUSPENDED}="0"
> +ENV{DM_SUSPENDED}=="Suspended", ENV{.DM_SUSPENDED}="1"
> +ENV{DM_SUSPENDED}=""
> +LABEL="dm_suspended_set"
>
> # This variable provides a reliable way to check that device-mapper
> # rules were installed. It means that all needed variables are set
> @@ -140,7 +143,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 a9d4c32..6a69d2f 100644
> --- a/udev/12-dm-permissions.rules
> +++ b/udev/12-dm-permissions.rules
> @@ -14,7 +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_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 eaad972..cb2ce2d 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)
OK, makes sense. But I haven't looked at what implications this might
have for 99-systemd.rules yet, but we surely need to have that covered
somehow.
Maybe, now, I would probably even remove the mention about DM_SUSPENDED
in 12-dm-permissions.rules, it looks superfluous there. We normally set
perms based on names, not on DM_SUSPENDED state. I'm not sure why we
mentioned it there before.
Do mpath rules still need to look at DM_SUSPENDED?
--
Peter
next prev parent reply other threads:[~2024-03-04 11:00 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 22:40 [RFC PATCH 0/7] device mapper udev rules rework Martin Wilck
2024-03-01 22:40 ` [RFC PATCH 1/7] 13-dm-disk.rules: import ID_FS_TYPE Martin Wilck
2024-03-04 10:37 ` Peter Rajnoha
2024-03-04 15:17 ` Martin Wilck
2024-03-04 15:44 ` Peter Rajnoha
2024-03-01 22:40 ` [RFC PATCH 2/7] 10-dm.rules: don't deactivate devices for DISK_RO=1 Martin Wilck
2024-03-04 10:48 ` Peter Rajnoha
2024-03-04 11:19 ` Peter Rajnoha
2024-03-04 11:27 ` Peter Rajnoha
2024-03-04 15:21 ` Martin Wilck
2024-03-04 16:09 ` Martin Wilck
2024-03-05 8:09 ` Peter Rajnoha
2024-03-01 22:40 ` [RFC PATCH 3/7] 10-dm-rules: don't restore DM_UDEV_DISABLE_OTHER_RULES_FLAG from db Martin Wilck
2024-03-04 10:49 ` Peter Rajnoha
2024-03-01 22:40 ` [RFC PATCH 4/7] 11-dm-lvm.rules: " Martin Wilck
2024-03-04 10:51 ` Peter Rajnoha
2024-03-01 22:40 ` [RFC PATCH 5/7] dm udev rules: don't export and save DM_SUSPENDED Martin Wilck
2024-03-04 11:00 ` Peter Rajnoha [this message]
2024-03-04 16:21 ` Martin Wilck
2024-03-05 8:19 ` Peter Rajnoha
2024-03-05 8:47 ` Martin Wilck
2024-03-05 9:10 ` Peter Rajnoha
2024-03-05 9:28 ` Martin Wilck
2024-03-01 22:40 ` [RFC PATCH 6/7] dm udev rules: don't export and save DM_NOSCAN Martin Wilck
2024-03-04 11:03 ` Peter Rajnoha
2024-03-01 22:40 ` [RFC PATCH 7/7] 10-dm.rules: bump DM_UDEV_RULES_VSN to 3 Martin Wilck
2024-03-04 11:09 ` Peter Rajnoha
2024-03-04 16:46 ` Martin Wilck
2024-03-05 8:26 ` Peter Rajnoha
2024-03-05 9:04 ` Martin Wilck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2b6bfa53-dfcb-4fe8-859c-8d99a5eadcbf@redhat.com \
--to=prajnoha@redhat.com \
--cc=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=hare@suse.de \
--cc=linux-lvm@lists.linux.dev \
--cc=martin.wilck@suse.com \
--cc=mwilck@suse.com \
--cc=teigland@redhat.com \
--cc=zkabelac@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).