From a98925230bf94514995720d8811c6293382feb3f Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Sat, 17 Nov 2012 11:16:40 +0100 Subject: [PATCH] Exit pvscan --cache immediately if cluster locking used or lvmetad not used. --- ...ter-locking-used-or-lvmetad-not-used.patch | 41 +++++++++++++++++++ lvm2.spec | 5 ++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 lvm2-2_02_99-exit-pvscan-cache-immediately-if-cluster-locking-used-or-lvmetad-not-used.patch diff --git a/lvm2-2_02_99-exit-pvscan-cache-immediately-if-cluster-locking-used-or-lvmetad-not-used.patch b/lvm2-2_02_99-exit-pvscan-cache-immediately-if-cluster-locking-used-or-lvmetad-not-used.patch new file mode 100644 index 0000000..8883b37 --- /dev/null +++ b/lvm2-2_02_99-exit-pvscan-cache-immediately-if-cluster-locking-used-or-lvmetad-not-used.patch @@ -0,0 +1,41 @@ + WHATS_NEW | 1 + + tools/pvscan.c | 15 +++++++++++++++ + 2 files changed, 16 insertions(+) + +diff --git a/WHATS_NEW b/WHATS_NEW +index 12307ed..e247391 100644 +--- a/WHATS_NEW ++++ b/WHATS_NEW +@@ -1,5 +1,6 @@ + Version 2.02.99 - + =================================== ++ 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. + Remove dependency on fedora-storage-init.service in lvm2 systemd units. + Depend on lvm2-lvmetad.socket in lvm2-monitor.service systemd unit. +diff --git a/tools/pvscan.c b/tools/pvscan.c +index 3d5ddef..34ab792 100644 +--- a/tools/pvscan.c ++++ b/tools/pvscan.c +@@ -119,6 +119,21 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv) + char *buf; + activation_handler handler = NULL; + ++ /* ++ * Return here immediately if lvmetad is not used. ++ * Also return if locking_type=3 (clustered) as we ++ * dont't support cluster + lvmetad yet. ++ * ++ * This is to avoid taking the global lock uselessly ++ * and to prevent hangs in clustered environment. ++ */ ++ /* TODO: Remove this once lvmetad + cluster supported! */ ++ if (find_config_tree_int(cmd, "global/locking_type", 1) == 3 || ++ !find_config_tree_int(cmd, "global/use_lvmetad", 0)) { ++ log_debug("_pvscan_lvmetad: immediate return"); ++ return ret; ++ } ++ + if (arg_count(cmd, activate_ARG)) { + if (arg_uint_value(cmd, activate_ARG, CHANGE_AAY) != CHANGE_AAY) { + log_error("Only --activate ay allowed with pvscan."); diff --git a/lvm2.spec b/lvm2.spec index ee149ce..3af0b1f 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -52,6 +52,7 @@ Patch6: lvm2-2_02_99-properly-set-cookie_set-var-on-dm_task_set_cookie-call.patc Patch7: lvm2-2_02_99-hardcode-use_lvmetad0-if-cluster-locking-used-and-issue-warning-msg.patch Patch8: lvm2-2_02_99-init-lvmetad-lazily-to-avoid-early-socket-access-on-config-overrides.patch 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 BuildRequires: libselinux-devel >= %{libselinux_version}, libsepol-devel BuildRequires: ncurses-devel @@ -96,6 +97,7 @@ or more physical volumes and creating one or more logical volumes %patch7 -p1 -b .cluster_lvmetad %patch8 -p1 -b .lvmetad_lazy_init %patch9 -p1 -b .systemd_fixes +%patch10 -p1 -b .pvscan_immediate %build %define _default_pid_dir /run @@ -592,12 +594,13 @@ the device-mapper event library. %{_libdir}/pkgconfig/devmapper-event.pc %changelog -* Thu Nov 01 2012 Peter Rajnoha - 2.02.98-3 +* Sat Nov 17 2012 Peter Rajnoha - 2.02.98-3 - Add lvm2-activation-generator systemd generator to automatically generate systemd units to activate LVM2 volumes even if lvmetad is not used. This replaces lvm activation part of the former fedora-storage-init script that was included in the initscripts package before. - Enable lvmetad - the LVM metadata daemon by default. +- 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. - Remove dependency on fedora-storage-init.service in lvm2 systemd units. - Depend on lvm2-lvmetad.socket in lvm2-monitor.service systemd unit.