mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
764195207d
Commit 756bcabbfe
fixed autoactivation
to not trigger on each uevent for a PV that appeared in the system
most notably the events that are triggered artificially (udevadm
trigger or as the result of the WATCH udev rule being applied that
consequently generates CHANGE uevents). This fixed a situation in
which VGs/LVs were activated when they should not.
BUT we still need to care about the coldplug used at boot to
retrigger the ADD events - the "udevadm trigger --action=add"!
For non-DM-based PVs, this is already covered as for these we
run the autoactivation on ADD event only.
However, for DM-based PVs, we still need to run the
autoactivation even for the artificial ADD event, reusing
the udev DB content from previous proper CHANGE event that
came with the DM device activation.
Simply, this patch fixes a situation in which we run extra
"udevadm trigger --action=add" (or echo add > /sys/block/<dev>/uevent)
for DM-based PVs (cryptsetup devices, multipath devices, any
other DM devices...).
Without this patch, while using lvmetad + autoactivation,
any VG/LV that has a DM-based PV and for which we do not
call the activation directly, the VG/LV is not activated.
For example a VG with an LV with root FS on it which is directly
activated in initrd and then missing activation of the rest
of the LVs in the VG because of unhandled uevent retrigger on
boot after switching to root FS (the "coldplug").
(No WHATS_NEW here as this fixes the commit mentioned
above and which was not released yet.)
36 lines
1.4 KiB
Plaintext
36 lines
1.4 KiB
Plaintext
# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
|
|
#
|
|
# This file is part of LVM2.
|
|
|
|
# Udev rules for LVM.
|
|
#
|
|
# Scan all block devices having a PV label for LVM metadata.
|
|
# Store this information in LVMetaD (the LVM metadata daemon) and maintain LVM
|
|
# metadata state for improved performance by avoiding further scans while
|
|
# running subsequent LVM commands or while using lvm2app library.
|
|
# Also, notify LVMetaD about any relevant block device removal.
|
|
#
|
|
# This rule is essential for having the information in LVMetaD up-to-date.
|
|
# It also requires blkid to be called on block devices before so only devices
|
|
# used as LVM PVs are processed (ID_FS_TYPE="LVM2_member" or "LVM1_member").
|
|
|
|
SUBSYSTEM!="block", GOTO="lvm_end"
|
|
(LVM_EXEC_RULE)
|
|
|
|
# Only process devices already marked as a PV - this requires blkid to be called before.
|
|
ENV{ID_FS_TYPE}!="LVM2_member|LVM1_member", GOTO="lvm_end"
|
|
|
|
ACTION=="remove", GOTO="lvm_scan"
|
|
|
|
# If the PV is not a dm device, scan only after device addition (ADD event)
|
|
KERNEL!="dm-[0-9]*", ACTION!="add", GOTO="lvm_end"
|
|
|
|
# If the PV is a dm device, scan only after proper mapping activation (CHANGE event + DM_ACTIVATION=1)
|
|
# or after a coldplug (event retrigger) with "add" event (ADD event + DM_ACTIVATION=1)
|
|
KERNEL=="dm-[0-9]*", ENV{DM_ACTIVATION}!="1", GOTO="lvm_end"
|
|
|
|
LABEL="lvm_scan"
|
|
RUN+="(LVM_EXEC)/lvm pvscan --cache --activate ay --major $major --minor $minor"
|
|
|
|
LABEL="lvm_end"
|