1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-02 22:42:30 +03:00

udev: ignore LVs containing PVs

If LVM LVs happen to contain PVs, they are passed to the lvm udev
rule for processing, where they should be ignored.  PVs on LVs
most likely belong to VM images, and don't belong to the host
which sees the LV.  It's unsafe for the host to use these PVs.
Without this change, the LV would be processed by pvscan which
would generally ignore it, either because of the devices file,
or because of the default lvm policy to not consider LVs as
potential PVs.  This change makes the udev rule consistent
with that policy and avoids the unnecessary system messages
produced when pvscan ignores the LV.
This commit is contained in:
David Teigland 2024-02-08 14:51:46 -06:00
parent fe822f7043
commit ee73875ff0

View File

@ -10,6 +10,15 @@ SUBSYSTEM!="block", GOTO="lvm_end"
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="lvm_end"
# Ignore PVs on LVs.
# This is usually a case of an LV being used for a guest VM
# image, where the guest is using lvm. The host should
# ignore lvm data from the guest and not attempt to scan or
# activate guest PVs/LVs. (To enable functions in this file
# for PVs layered on LVs, set LVM_PVSCAN_ON_LVS="1" from a
# custom udev rule.)
ENV{ID_FS_TYPE}=="LVM2_member", ENV{DM_UUID}=="LVM-?*", ENV{LVM_PVSCAN_ON_LVS}!="1", GOTO="lvm_end"
# Only process devices already marked as a PV - this requires blkid to be called before.
ENV{ID_FS_TYPE}!="LVM2_member", GOTO="lvm_end"
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"