Skip to content

device mapper udev rules rework (v3)

Martin Wilck requested to merge mwilck/lvm2:dm-udev-rules into main

here is a rewrite of the device mapper udev rules, as follow up to the previous thread "About DM_UDEV_DISABLE_OTHER_RULES_FLAG and DM_NOSCAN" 1, and my previous mailing list submissions (2, 3). While I have taken care to minimize the impact on other udev rule sets, some changes to both the multipath-tools and systemd rules will be necessary. Patches for these are in preparation.

In short, the effect of this patch set is as follows:

  • As before, DM_UDEV_DISABLE_OTHER_RULES_FLAG is used as general flag to indicate to follow-up rules that they should avoid probing the device, and should import device properties from the udev db if necessary. The flag does not imply that existing device stacks must be destructed. -
  • DM_UDEV_DISABLE_OTHER_RULES_FLAG represents the combination of multiple conditions that may make it impossible to probe the device just now. As such, it isn't restored from the udev db, but determined anew for every uevent. For saving the DM_COOKIE variable of the same name in the udev db, a new variable DM_COOKIE_DISABLE_OTHER_RULES_FLAG is introduced.
  • The properties DM_SUSPENDED and DM_NOSCAN, which have always been considered internal to device-mapper and its subsystems, are renamed to .DM_SUSPENDED and .DM_NOSCAN, respectively. Thus they aren't saved in the udev db any more, and it becomes more obvious that they are not supposed to be used by non-dm udev rules.
  • ID_FS_TYPE is imported from the db for "spurious" events.
  • Properties are imported for DISK_RO="?" events, too.

Changes v2->v3:

  • Use $env instead of %E
  • Remove mention of .DM_SUSPENDED from 12-dm-permissions.rules

Changes from v1 ("RFC") patch set:

  • Instead of removing the DISK_RO clause entirely, just moved it further down (after the property import), and apply it for DISK_RO==0, too.
  • Updated comments about device properties at the top of 10-dm.rules.
  1. https://lore.kernel.org/linux-lvm/9d50edb0-baa4-4a01-a2f0-136dfdb79937@redhat.com/T/#t

  2. https://lore.kernel.org/linux-lvm/20240301224011.11117-1-mwilck@suse.com/T/#t

  3. https://lore.kernel.org/linux-lvm/b605f50c-700a-40a7-b8a0-f5c05400161c@redhat.com/T/#t

Merge request reports