summaryrefslogtreecommitdiffstats
path: root/udev
diff options
context:
space:
mode:
Diffstat (limited to 'udev')
-rw-r--r--udev/69-dm-lvm-metad.rules25
-rw-r--r--udev/Makefile.in4
2 files changed, 29 insertions, 0 deletions
diff --git a/udev/69-dm-lvm-metad.rules b/udev/69-dm-lvm-metad.rules
new file mode 100644
index 00000000..a4f52c3e
--- /dev/null
+++ b/udev/69-dm-lvm-metad.rules
@@ -0,0 +1,25 @@
+# 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"
+
+# Device-mapper devices are processed only on change event or on supported synthesized event.
+KERNEL=="dm-[0-9]*", ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end"
+
+# Only process devices already marked as a PV - this requires blkid to be called before.
+ENV{ID_FS_TYPE}=="LVM2_member|LVM1_member", RUN+="$env{DM_SBIN_PATH}/pvscan --lvmetad $major:$minor"
+
+LABEL="lvm_end"
diff --git a/udev/Makefile.in b/udev/Makefile.in
index 44bdf114..4ace9108 100644
--- a/udev/Makefile.in
+++ b/udev/Makefile.in
@@ -19,6 +19,10 @@ DM_RULES=10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
LVM_RULES=11-dm-lvm.rules
DM_DIR=$(shell grep "\#define DM_DIR" $(top_srcdir)/libdm/misc/dm-ioctl.h | awk '{print $$3}')
+ifeq ("@BUILD_LVMETAD@", "yes")
+LVM_RULES+=69-dm-lvm-metad.rules
+endif
+
ifeq ("@UDEV_HAS_BUILTIN_BLKID@", "yes")
BLKID_RULE=IMPORT{builtin}=\"blkid\"
else