Skip to contentSkip to conversation

dm-disk.rules: check DM_NAME before create symlink

PATCH New Wu Guanghao 1 participant 1 message Jun 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm-disk.rules: check DM_NAME before create symlink

Hi,

We found that after deleting the dm device, there are still soft links left.

Before creating a symlink, need to determine whether DM_NAME exists. Otherwise there will be a soft link left when you remove the dm device

udevd log:
localhost.localdomain systemd-udevd[3177745]: dm-68: /usr/lib/udev/rules.d/13-dm-disk.rules:17 LINK 'disk/by-id/dm-name-' localhost.localdomain systemd-udevd[3177745]: dm-68: /usr/lib/udev/rules.d/13-dm-disk.rules:23 Importing properties from results of builtin command 'blkid'

---
 udev/13-dm-disk.rules.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
udev/13-dm-disk.rules.in +1 -1
index 535581070..fcb2f375c 100644
@@ -14,7 +14,7 @@ ACTION!="add|change", GOTO="dm_end"
 ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end"
 ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_end"
 
-SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}"
+ENV{DM_NAME}=="?*", 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", GOTO="dm_end"
Signature · 1 line
Wu Guanghao