From 40c9afff51fa2811ffba152e55bd5cd734ed32dc Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Apr 09 2013 08:50:41 +0000 Subject: Additional fixes for autoactivation feature. Synchronize with udev in pvscan --cache and fix dangling udev_sync cookies. Fix autoactivation to not autoactivate VG/LV on each change of the PVs used. --- diff --git a/lvm2-2_02_99-fix-autoactivation-to-not-autoactivate-vg-lv-on-each-pv-change.patch b/lvm2-2_02_99-fix-autoactivation-to-not-autoactivate-vg-lv-on-each-pv-change.patch new file mode 100644 index 0000000..ddcf3d7 --- /dev/null +++ b/lvm2-2_02_99-fix-autoactivation-to-not-autoactivate-vg-lv-on-each-pv-change.patch @@ -0,0 +1,62 @@ +commit 0bf7bdf5216eae93cff7abb47a76b39270d71413 +Author: Peter Rajnoha +Date: Tue Apr 9 10:07:15 2013 +0200 + + 0 +--- + WHATS_NEW | 1 + + udev/10-dm.rules.in | 2 +- + udev/69-dm-lvm-metad.rules.in | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 67a24c7..c481e68 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.02.99 - + =================================== ++ Fix autoactivation to not autoactivate VG/LV on each change of the PVs used. + Skip mlocking [vectors] on arm architecture. + Exit pvscan --cache immediately if cluster locking used or lvmetad not used. + Don't use lvmetad in lvm2-monitor.service ExecStop to avoid a systemd issue. +diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in +index 29af467..cfee145 100644 +--- a/udev/10-dm.rules.in ++++ b/udev/10-dm.rules.in +@@ -45,7 +45,7 @@ ENV{DISK_RO}=="1", GOTO="dm_disable" + # in libdevmapper so we need to detect this and try to behave correctly. + # For such spurious events, regenerate all flags from current udev database content + # (this information would normally be inaccessible for spurious ADD and CHANGE events). +-ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", GOTO="dm_flags_done" ++ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", ENV{DM_ACTIVATION}="1", GOTO="dm_flags_done" + IMPORT{db}="DM_UDEV_DISABLE_DM_RULES_FLAG" + IMPORT{db}="DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG" + IMPORT{db}="DM_UDEV_DISABLE_DISK_RULES_FLAG" +diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in +index 706c03b..b16a27a 100644 +--- a/udev/69-dm-lvm-metad.rules.in ++++ b/udev/69-dm-lvm-metad.rules.in +@@ -17,10 +17,18 @@ + SUBSYSTEM!="block", GOTO="lvm_end" + (LVM_EXEC_RULE) + +-# 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+="(LVM_EXEC)/lvm pvscan --cache --activate ay --major $major --minor $minor" ++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) ++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" diff --git a/lvm2-2_02_99-synchronize-with-udev-in-pvscan-cache-and-fix-dangling-udev_sync-cookies.patch b/lvm2-2_02_99-synchronize-with-udev-in-pvscan-cache-and-fix-dangling-udev_sync-cookies.patch new file mode 100644 index 0000000..bbdd76e --- /dev/null +++ b/lvm2-2_02_99-synchronize-with-udev-in-pvscan-cache-and-fix-dangling-udev_sync-cookies.patch @@ -0,0 +1,33 @@ +commit 0bcd33ecffb97f09e1ffb75868844cea40f3cd77 +Author: Peter Rajnoha +Date: Tue Apr 9 10:07:49 2013 +0200 + + 1 +--- + WHATS_NEW | 1 + + tools/pvscan.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/WHATS_NEW b/WHATS_NEW +index c481e68..03345d8 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.02.99 - + =================================== ++ Synchronize with udev in pvscan --cache and fix dangling udev_sync cookies. + Fix autoactivation to not autoactivate VG/LV on each change of the PVs used. + Skip mlocking [vectors] on arm architecture. + Exit pvscan --cache immediately if cluster locking used or lvmetad not used. +diff --git a/tools/pvscan.c b/tools/pvscan.c +index 34ab792..fbd524b 100644 +--- a/tools/pvscan.c ++++ b/tools/pvscan.c +@@ -223,6 +223,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv) + } + + out: ++ sync_local_dev_names(cmd); + unlock_vg(cmd, VG_GLOBAL); + + return ret; diff --git a/lvm2.spec b/lvm2.spec index 599ac72..be7ca70 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -37,7 +37,7 @@ Summary: Userland logical volume management tools Name: lvm2 Version: 2.02.98 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2 Group: System Environment/Base URL: http://sources.redhat.com/lvm2 @@ -54,6 +54,8 @@ Patch8: lvm2-2_02_99-init-lvmetad-lazily-to-avoid-early-socket-access-on-config- Patch9: lvm2-2_02_99-various-updates-and-fixes-for-systemd-units.patch Patch10: lvm2-2_02_99-exit-pvscan-cache-immediately-if-cluster-locking-used-or-lvmetad-not-used.patch Patch11: lvm2-2_02_99-skip-mlocking-verctors-on-arm-arch.patch +Patch12: lvm2-2_02_99-fix-autoactivation-to-not-autoactivate-vg-lv-on-each-pv-change.patch +Patch13: lvm2-2_02_99-synchronize-with-udev-in-pvscan-cache-and-fix-dangling-udev_sync-cookies.patch BuildRequires: libselinux-devel >= %{libselinux_version}, libsepol-devel BuildRequires: ncurses-devel @@ -100,6 +102,8 @@ or more physical volumes and creating one or more logical volumes %patch9 -p1 -b .systemd_fixes %patch10 -p1 -b .pvscan_immediate %patch11 -p1 -b .arm_vectors +%patch12 -p1 -b .autoactivation +%patch13 -p1 -b .dangling_cookies %build %define _default_pid_dir /run @@ -596,6 +600,10 @@ the device-mapper event library. %{_libdir}/pkgconfig/devmapper-event.pc %changelog +* Tue Apr 09 2013 Peter Rajnoha - 2.02.98-6 +- Synchronize with udev in pvscan --cache and fix dangling udev_sync cookies. +- Fix autoactivation to not autoactivate VG/LV on each change of the PVs used. + * Thu Feb 14 2013 Fedora Release Engineering - 2.02.98-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild