From 32ab91e528798e88f600c2015466adc729d788ec Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Mon, 9 Dec 2024 13:05:03 +0100 Subject: [PATCH] udev: create /dev/disk/by-diskseq/ symlink for public DM devices All block devices have a disk sequence number assigned (an ever-increasing 64 bit sequence number) since kernel v5.15 (February 2021). The number is exported through /sys/block//diskseq property and also as DISKSEQ udev event variable. The diskseq helps with referencing a device throughout its existence in race-free way. By default, the /usr/lib/udev/rules.d/60-persistent-storage.rules set /dev/disk/by-diskseq/ symlink for each block device. However, these rules do not apply for DM devices because we manage the symlinks ourselves in 13-dm-disk.rules where it properly follows the DM_UDEV_DISABLE_DISK_RULES flag, among other things. Add a rule to 13-dm-disk.rules to create the /dev/disk/by-diskseq/. --- WHATS_NEW_DM | 1 + udev/13-dm-disk.rules.in | 2 ++ 2 files changed, 3 insertions(+) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index f4e796cac..c5fa162f1 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.204 - =================== + Create /dev/disk/by-diskseq/ symlink for public DM devices. Version 1.02.203 - 09th December 2024 ===================================== diff --git a/udev/13-dm-disk.rules.in b/udev/13-dm-disk.rules.in index 03ea203ee..9bfeebe13 100644 --- a/udev/13-dm-disk.rules.in +++ b/udev/13-dm-disk.rules.in @@ -17,6 +17,8 @@ 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{DISKSEQ}=="?*", SYMLINK+="disk/by-diskseq/$env{DISKSEQ}" + 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"