Exit pvscan --cache immediately if cluster locking used or lvmetad not used.

This commit is contained in:
Peter Rajnoha 2012-11-17 11:16:40 +01:00
parent b77fc3d53d
commit a98925230b
2 changed files with 45 additions and 1 deletions

View File

@ -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.");

View File

@ -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 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 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 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: libselinux-devel >= %{libselinux_version}, libsepol-devel
BuildRequires: ncurses-devel BuildRequires: ncurses-devel
@ -96,6 +97,7 @@ or more physical volumes and creating one or more logical volumes
%patch7 -p1 -b .cluster_lvmetad %patch7 -p1 -b .cluster_lvmetad
%patch8 -p1 -b .lvmetad_lazy_init %patch8 -p1 -b .lvmetad_lazy_init
%patch9 -p1 -b .systemd_fixes %patch9 -p1 -b .systemd_fixes
%patch10 -p1 -b .pvscan_immediate
%build %build
%define _default_pid_dir /run %define _default_pid_dir /run
@ -592,12 +594,13 @@ the device-mapper event library.
%{_libdir}/pkgconfig/devmapper-event.pc %{_libdir}/pkgconfig/devmapper-event.pc
%changelog %changelog
* Thu Nov 01 2012 Peter Rajnoha <prajnoha@redhat.com> - 2.02.98-3 * Sat Nov 17 2012 Peter Rajnoha <prajnoha@redhat.com> - 2.02.98-3
- Add lvm2-activation-generator systemd generator to automatically generate - Add lvm2-activation-generator systemd generator to automatically generate
systemd units to activate LVM2 volumes even if lvmetad is not used. systemd units to activate LVM2 volumes even if lvmetad is not used.
This replaces lvm activation part of the former fedora-storage-init This replaces lvm activation part of the former fedora-storage-init
script that was included in the initscripts package before. script that was included in the initscripts package before.
- Enable lvmetad - the LVM metadata daemon by default. - 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. - 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. - Remove dependency on fedora-storage-init.service in lvm2 systemd units.
- Depend on lvm2-lvmetad.socket in lvm2-monitor.service systemd unit. - Depend on lvm2-lvmetad.socket in lvm2-monitor.service systemd unit.