lvm2/lvm2-2_02_99-exit-pvscan-cache-immediately-if-cluster-locking-used-or-lvmetad-not-used.patch

42 lines
1.5 KiB
Diff
Raw Normal View History

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