Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c069aff21b145092…
Commit: c069aff21b1450923b59e98ab709a5e667cdcda9
Parent: a72a80589689961285ec6aacff99087ddd8c378d
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Tue May 26 15:55:16 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Tue May 26 16:27:03 2015 +0200
lvmpolld: zero errno in before strtoul call
Testing errno value without explicitly setting to
zero in before the strtoul call may lead to
unexpected failures.
---
daemons/lvmpolld/lvmpolld-core.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/daemons/lvmpolld/lvmpolld-core.c b/daemons/lvmpolld/lvmpolld-core.c
index 1a33625..c1d583e 100644
--- a/daemons/lvmpolld/lvmpolld-core.c
+++ b/daemons/lvmpolld/lvmpolld-core.c
@@ -749,6 +749,7 @@ static int process_timeout_arg(const char *str, unsigned *max_timeouts)
char *endptr;
unsigned long l;
+ errno = 0;
l = strtoul(str, &endptr, 10);
if (errno || *endptr || l >= UINT_MAX)
return 0;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b244fffc182ef15f…
Commit: b244fffc182ef15ff23d4fc11658997347f66d79
Parent: da20e0c5079eab7d76e3bae96ed3f4dd473efde6
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Mon May 25 10:46:38 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Mon May 25 10:48:53 2015 +0200
WHATS_NEW: update
update for commit: f8bf6410954fcf82bf28852e0dba015c6b7f19dc
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e5864eb..29eb501 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.121 -
================================
+ Fix a segfault in pvscan --cache --background command.
Fix test for AREA_PV when checking for failed mirrors.
Do not use --sysinit in lvm2-activation{-early,-net}.service if lvmpolld used.
Do not fail polling when poll LV not found (already finished or removed).
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=da20e0c5079eab7d…
Commit: da20e0c5079eab7d76e3bae96ed3f4dd473efde6
Parent: f8bf6410954fcf82bf28852e0dba015c6b7f19dc
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Mon May 25 10:41:14 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Mon May 25 10:48:45 2015 +0200
tests: add test for pvscan --cache --background
regression test for a segfault in pvscan --cache --background
bug fixed by commit:
f8bf6410954fcf82bf28852e0dba015c6b7f19dc
---
test/shell/lvmetad-pvscan-nomda-bg.sh | 57 +++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvmetad-pvscan-nomda-bg.sh b/test/shell/lvmetad-pvscan-nomda-bg.sh
new file mode 100644
index 0000000..e17dfd2
--- /dev/null
+++ b/test/shell/lvmetad-pvscan-nomda-bg.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/inittest
+
+test -e LOCAL_LVMETAD || skip
+test -e LOCAL_LVMPOLLD && skip
+
+kill $(< LOCAL_LVMETAD)
+rm LOCAL_LVMETAD
+
+aux prepare_devs 2
+
+pvcreate --metadatacopies 0 "$dev1"
+pvcreate --metadatacopies 1 "$dev2"
+vgcreate $vg1 "$dev1" "$dev2"
+lvcreate -n foo -l 1 -an --zero n $vg1
+
+# start lvmetad but make sure it doesn't know about $dev1 or $dev2
+aux disable_dev "$dev1" "$dev2"
+aux prepare_lvmetad
+lvs
+mv LOCAL_LVMETAD XXX
+aux enable_dev "$dev2" "$dev1"
+mv XXX LOCAL_LVMETAD
+
+aux lvmconf 'global/use_lvmetad = 0'
+check inactive $vg1 foo
+aux lvmconf 'global/use_lvmetad = 1'
+
+pvscan --cache --background "$dev2" -aay
+
+aux lvmconf 'global/use_lvmetad = 0'
+# FIXME: inconclusive. may be a timing issue
+check inactive $vg1 foo
+aux lvmconf 'global/use_lvmetad = 1'
+
+pvscan --cache --background "$dev1" -aay
+
+aux lvmconf 'global/use_lvmetad = 0'
+i=100
+while ! check active $vg1 foo; do
+ test $i -lt 0 && fail "Failed to autoactivate"
+ sleep .1
+ i=$((i-1))
+done
+aux lvmconf 'global/use_lvmetad = 1'
+
+vgremove -ff $vg1
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ba68aed8366c201a…
Commit: ba68aed8366c201ab0a263a9935243a9e6f08875
Parent: 6d998aa13df81e5cec339c86a63dac934de3da35
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu May 21 11:07:07 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu May 21 12:20:30 2015 +0200
scripts: activation generator: do not use --sysinit if lvmpolld used
If lvmetad is not used, we generate lvm2-activation{-early,-net}.service
systemd services to activate any VGs found on the system. So far we used
--sysinit during this activation as polling was still forked off of the
lvm activation command.
This has changed with lvmpolld - we have proper lvmpolld systemd
service now (activated via its socket unit). As such, we don't need
to use --sysinit anymore during activation in systemd environment
as polling was the only barrier to remove the need for --sysinit.
---
WHATS_NEW | 1 +
.../lvm2_activation_generator_systemd_red_hat.c | 37 ++++++++++++--------
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e14c858..eecdca9 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.121 -
================================
+ Do not use --sysinit in lvm2-activation{-early,-net}.service if lvmpolld used.
Do not fail polling when poll LV not found (already finished or removed).
Replace poll_get_copy_vg/lv fns with vg_read() and find_lv() in polldaemon.
Close all device fds only in before sleep call in polldaemon.
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
index 6a003f5..92c08d3 100644
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -24,8 +24,9 @@
#include "lvm2app.h"
#include "configure.h" /* for LVM_PATH */
-#define KMSG_DEV_PATH "/dev/kmsg"
-#define LVM_CONF_USE_LVMETAD "global/use_lvmetad"
+#define KMSG_DEV_PATH "/dev/kmsg"
+#define LVM_CONF_USE_LVMETAD "global/use_lvmetad"
+#define LVM_CONF_USE_LVMPOLLD "global/use_lvmpolld"
#define UNIT_TARGET_LOCAL_FS "local-fs.target"
#define UNIT_TARGET_REMOTE_FS "remote-fs.target"
@@ -66,19 +67,18 @@ static void kmsg(int log_level, const char *format, ...)
(void) write(kmsg_fd, message, n + 4);
}
-static int lvm_uses_lvmetad(void)
+static void lvm_get_use_lvmetad_and_lvmpolld(int *use_lvmetad, int *use_lvmpolld)
{
lvm_t lvm;
- int r;
+ *use_lvmetad = *use_lvmpolld = 0;
if (!(lvm = lvm_init(NULL))) {
kmsg(LOG_ERR, "LVM: Failed to initialize library context for activation generator.\n");
- return 0;
+ return;
}
- r = lvm_config_find_bool(lvm, LVM_CONF_USE_LVMETAD, 0);
+ *use_lvmetad = lvm_config_find_bool(lvm, LVM_CONF_USE_LVMETAD, 0);
+ *use_lvmpolld = lvm_config_find_bool(lvm, LVM_CONF_USE_LVMPOLLD, 0);
lvm_quit(lvm);
-
- return r;
}
static int register_unit_with_target(const char *dir, const char *unit, const char *target)
@@ -107,7 +107,7 @@ out:
return r;
}
-static int generate_unit(const char *dir, int unit)
+static int generate_unit(const char *dir, int unit, int sysinit_needed)
{
FILE *f;
const char *unit_name = unit_names[unit];
@@ -150,8 +150,10 @@ static int generate_unit(const char *dir, int unit)
"[Service]\n", f);
}
- fputs("ExecStart=" LVM_PATH " vgchange -aay --sysinit --ignoreskippedcluster\n"
- "Type=oneshot\n", f);
+ fputs("ExecStart=" LVM_PATH " vgchange -aay --ignoreskippedcluster", f);
+ if (sysinit_needed)
+ fputs (" --sysinit", f);
+ fputs("\nType=oneshot\n", f);
if (fclose(f) < 0) {
kmsg(LOG_ERR, "LVM: Failed to write unit file %s: %m.\n", unit_name);
@@ -168,6 +170,7 @@ static int generate_unit(const char *dir, int unit)
int main(int argc, char *argv[])
{
+ int use_lvmetad, use_lvmpolld, sysinit_needed;
const char *dir;
int r = EXIT_SUCCESS;
mode_t old_mask;
@@ -180,16 +183,20 @@ int main(int argc, char *argv[])
}
/* If lvmetad used, rely on autoactivation instead of direct activation. */
- if (lvm_uses_lvmetad())
+ lvm_get_use_lvmetad_and_lvmpolld(&use_lvmetad, &use_lvmpolld);
+ if (use_lvmetad)
goto out;
dir = argv[1];
/* mark lvm2-activation.*.service as world-accessible */
old_mask = umask(0022);
- if (!generate_unit(dir, UNIT_EARLY) ||
- !generate_unit(dir, UNIT_MAIN) ||
- !generate_unit(dir, UNIT_NET))
+
+ sysinit_needed = !use_lvmpolld;
+
+ if (!generate_unit(dir, UNIT_EARLY, sysinit_needed) ||
+ !generate_unit(dir, UNIT_MAIN, sysinit_needed) ||
+ !generate_unit(dir, UNIT_NET, sysinit_needed))
r = EXIT_FAILURE;
umask(old_mask);
out: