master - lvmpolld: zero errno in before strtoul call
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c069aff21b1450...
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;
8 years, 11 months
master - lvconvert.c: fix whitespace mess
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a72a8058968996...
Commit: a72a80589689961285ec6aacff99087ddd8c378d
Parent: eeb498627c46626c782cb6a2f0e54eb011da8b8e
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Mon May 25 13:16:57 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Tue May 26 16:26:57 2015 +0200
lvconvert.c: fix whitespace mess
---
tools/lvconvert.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 4c0cb10..fe8b761 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -840,7 +840,7 @@ static int _failed_mirrors_count(struct logical_volume *lv)
else if (seg_lv(lvseg, s)->status & PARTIAL_LV)
++ ret;
}
- else if (seg_type(lvseg, s) == AREA_PV &&
+ else if (seg_type(lvseg, s) == AREA_PV &&
is_missing_pv(seg_pv(lvseg, s)))
++ret;
}
8 years, 11 months
master - libdm: Add dm_task_get_errno to return ioctl errno.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eeb498627c4662...
Commit: eeb498627c46626c782cb6a2f0e54eb011da8b8e
Parent: b244fffc182ef15ff23d4fc11658997347f66d79
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue May 26 15:13:49 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue May 26 15:13:49 2015 +0100
libdm: Add dm_task_get_errno to return ioctl errno.
There are reports of unexplained ioctl failures when using dmeventd.
An explanation might be that the wrong value of errno is being used.
Change libdevmapper to store an errno set by from dm ioctl() directly
and provide it to the caller through a new dm_task_get_errno() function.
[Replaced f9510548667754d9209b232348ccd2d806c0f1d8]
---
WHATS_NEW_DM | 2 ++
daemons/dmeventd/dmeventd.c | 25 ++++++++++++++-----------
libdm/.exported_symbols.DM_1_02_98 | 1 +
libdm/ioctl/libdm-iface.c | 22 +++++++++++++++-------
libdm/ioctl/libdm-targets.h | 1 +
libdm/libdevmapper.h | 5 +++++
6 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 00c11e8..4dabdea 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,7 @@
Version 1.02.98 -
===============================
+ Add dm_task_get_errno() to return any unexpected errno from a dm ioctl call.
+ Use copy of errno made after each dm ioctl call in case errno changes later.
Version 1.02.97 - 15th May 2015
===============================
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index e8d1e3b..ad27060 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -710,6 +710,7 @@ static int _event_wait(struct thread_status *thread, struct dm_task **task)
int ret = DM_WAIT_RETRY;
struct dm_task *dmt;
struct dm_info info;
+ int ioctl_errno;
*task = 0;
@@ -739,25 +740,27 @@ static int _event_wait(struct thread_status *thread, struct dm_task **task)
* either for a timeout event, or to cancel the thread.
*/
set = _unblock_sigalrm();
- errno = 0;
if (dm_task_run(dmt)) {
thread->current_events |= DM_EVENT_DEVICE_ERROR;
ret = DM_WAIT_INTR;
if ((ret = dm_task_get_info(dmt, &info)))
thread->event_nr = info.event_nr;
- } else if (thread->events & DM_EVENT_TIMEOUT && errno == EINTR) {
- thread->current_events |= DM_EVENT_TIMEOUT;
- ret = DM_WAIT_INTR;
- } else if (thread->status == DM_THREAD_SHUTDOWN && errno == EINTR) {
- ret = DM_WAIT_FATAL;
} else {
- syslog(LOG_NOTICE, "dm_task_run failed, errno = %d, %s",
- errno, strerror(errno));
- if (errno == ENXIO) {
- syslog(LOG_ERR, "%s disappeared, detaching",
- thread->device.name);
+ ioctl_errno = dm_task_get_errno(dmt);
+ if (thread->events & DM_EVENT_TIMEOUT && ioctl_errno == EINTR) {
+ thread->current_events |= DM_EVENT_TIMEOUT;
+ ret = DM_WAIT_INTR;
+ } else if (thread->status == DM_THREAD_SHUTDOWN && ioctl_errno == EINTR)
ret = DM_WAIT_FATAL;
+ else {
+ syslog(LOG_NOTICE, "dm_task_run failed, errno = %d, %s",
+ ioctl_errno, strerror(ioctl_errno));
+ if (ioctl_errno == ENXIO) {
+ syslog(LOG_ERR, "%s disappeared, detaching",
+ thread->device.name);
+ ret = DM_WAIT_FATAL;
+ }
}
}
DEBUGLOG("Completed waitevent task for %s", thread->device.uuid);
diff --git a/libdm/.exported_symbols.DM_1_02_98 b/libdm/.exported_symbols.DM_1_02_98
new file mode 100644
index 0000000..f90bcef
--- /dev/null
+++ b/libdm/.exported_symbols.DM_1_02_98
@@ -0,0 +1 @@
+dm_task_get_errno
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index face593..e3b33b8 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -1717,6 +1717,8 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
struct dm_ioctl *dmi;
int ioctl_with_uevent;
+ dmt->ioctl_errno = 0;
+
dmi = _flatten(dmt, buffer_repeat_count);
if (!dmi) {
log_error("Couldn't create ioctl argument.");
@@ -1803,12 +1805,13 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
#ifdef DM_IOCTLS
if (ioctl(_control_fd, command, dmi) < 0 &&
dmt->expected_errno != errno) {
- if (errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) ||
- (dmt->type == DM_DEVICE_MKNODES) ||
- (dmt->type == DM_DEVICE_STATUS)))
+ dmt->ioctl_errno = errno;
+ if (dmt->ioctl_errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) ||
+ (dmt->type == DM_DEVICE_MKNODES) ||
+ (dmt->type == DM_DEVICE_STATUS)))
dmi->flags &= ~DM_EXISTS_FLAG; /* FIXME */
else {
- if (_log_suppress || errno == EINTR)
+ if (_log_suppress || dmt->ioctl_errno == EINTR)
log_verbose("device-mapper: %s ioctl on %s%s%s%.0d%s%.0d%s%s "
"failed: %s",
_cmd_data_v4[dmt->type].name,
@@ -1819,7 +1822,7 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
dmt->minor > 0 ? dmt->minor : 0,
dmt->major > 0 && dmt->minor == 0 ? "0" : "",
dmt->major > 0 ? ")" : "",
- strerror(errno));
+ strerror(dmt->ioctl_errno));
else
log_error("device-mapper: %s ioctl on %s%s%s%.0d%s%.0d%s%s "
"failed: %s",
@@ -1831,14 +1834,14 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
dmt->minor > 0 ? dmt->minor : 0,
dmt->major > 0 && dmt->minor == 0 ? "0" : "",
dmt->major > 0 ? ")" : "",
- strerror(errno));
+ strerror(dmt->ioctl_errno));
/*
* It's sometimes worth retrying after EBUSY in case
* it's a transient failure caused by an asynchronous
* process quickly scanning the device.
*/
- *retryable = errno == EBUSY;
+ *retryable = dmt->ioctl_errno == EBUSY;
goto error;
}
@@ -1876,6 +1879,11 @@ void dm_task_update_nodes(void)
#define DM_IOCTL_RETRIES 25
#define DM_RETRY_USLEEP_DELAY 200000
+int dm_task_get_errno(struct dm_task *dmt)
+{
+ return dmt->ioctl_errno;
+}
+
int dm_task_run(struct dm_task *dmt)
{
struct dm_ioctl *dmi;
diff --git a/libdm/ioctl/libdm-targets.h b/libdm/ioctl/libdm-targets.h
index 100681f..5545459 100644
--- a/libdm/ioctl/libdm-targets.h
+++ b/libdm/ioctl/libdm-targets.h
@@ -68,6 +68,7 @@ struct dm_task {
int deferred_remove;
int enable_checks;
int expected_errno;
+ int ioctl_errno;
char *uuid;
char *mangled_uuid;
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 8295e3c..c811641 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -393,6 +393,11 @@ int dm_get_status_thin(struct dm_pool *mem, const char *params,
int dm_task_run(struct dm_task *dmt);
/*
+ * The errno from the last device-mapper ioctl performed by dm_task_run.
+ */
+int dm_task_get_errno(struct dm_task *dmt);
+
+/*
* Call this to make or remove the device nodes associated with previously
* issued commands.
*/
8 years, 11 months
master - libdm: Add dm_task_get_errno to return ioctl errno.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f9510548667754...
Commit: f9510548667754d9209b232348ccd2d806c0f1d8
Parent: b244fffc182ef15ff23d4fc11658997347f66d79
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue May 26 14:52:13 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue May 26 14:52:13 2015 +0100
libdm: Add dm_task_get_errno to return ioctl errno.
There are reports of unexplained ioctl failures when using dmeventd.
An explanation might be that the wrong value of errno is being used.
Change libdevmapper to store an errno set by from dm ioctl() directly
and provide it to the caller through a new dm_task_get_errno() function.
---
WHATS_NEW_DM | 2 ++
daemons/dmeventd/dmeventd.c | 25 ++++++++++++++-----------
libdm/ioctl/libdm-iface.c | 22 +++++++++++++++-------
libdm/ioctl/libdm-targets.h | 1 +
libdm/libdevmapper.h | 5 +++++
5 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 00c11e8..4dabdea 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,7 @@
Version 1.02.98 -
===============================
+ Add dm_task_get_errno() to return any unexpected errno from a dm ioctl call.
+ Use copy of errno made after each dm ioctl call in case errno changes later.
Version 1.02.97 - 15th May 2015
===============================
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index e8d1e3b..ad27060 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -710,6 +710,7 @@ static int _event_wait(struct thread_status *thread, struct dm_task **task)
int ret = DM_WAIT_RETRY;
struct dm_task *dmt;
struct dm_info info;
+ int ioctl_errno;
*task = 0;
@@ -739,25 +740,27 @@ static int _event_wait(struct thread_status *thread, struct dm_task **task)
* either for a timeout event, or to cancel the thread.
*/
set = _unblock_sigalrm();
- errno = 0;
if (dm_task_run(dmt)) {
thread->current_events |= DM_EVENT_DEVICE_ERROR;
ret = DM_WAIT_INTR;
if ((ret = dm_task_get_info(dmt, &info)))
thread->event_nr = info.event_nr;
- } else if (thread->events & DM_EVENT_TIMEOUT && errno == EINTR) {
- thread->current_events |= DM_EVENT_TIMEOUT;
- ret = DM_WAIT_INTR;
- } else if (thread->status == DM_THREAD_SHUTDOWN && errno == EINTR) {
- ret = DM_WAIT_FATAL;
} else {
- syslog(LOG_NOTICE, "dm_task_run failed, errno = %d, %s",
- errno, strerror(errno));
- if (errno == ENXIO) {
- syslog(LOG_ERR, "%s disappeared, detaching",
- thread->device.name);
+ ioctl_errno = dm_task_get_errno(dmt);
+ if (thread->events & DM_EVENT_TIMEOUT && ioctl_errno == EINTR) {
+ thread->current_events |= DM_EVENT_TIMEOUT;
+ ret = DM_WAIT_INTR;
+ } else if (thread->status == DM_THREAD_SHUTDOWN && ioctl_errno == EINTR)
ret = DM_WAIT_FATAL;
+ else {
+ syslog(LOG_NOTICE, "dm_task_run failed, errno = %d, %s",
+ ioctl_errno, strerror(ioctl_errno));
+ if (ioctl_errno == ENXIO) {
+ syslog(LOG_ERR, "%s disappeared, detaching",
+ thread->device.name);
+ ret = DM_WAIT_FATAL;
+ }
}
}
DEBUGLOG("Completed waitevent task for %s", thread->device.uuid);
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index face593..e3b33b8 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -1717,6 +1717,8 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
struct dm_ioctl *dmi;
int ioctl_with_uevent;
+ dmt->ioctl_errno = 0;
+
dmi = _flatten(dmt, buffer_repeat_count);
if (!dmi) {
log_error("Couldn't create ioctl argument.");
@@ -1803,12 +1805,13 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
#ifdef DM_IOCTLS
if (ioctl(_control_fd, command, dmi) < 0 &&
dmt->expected_errno != errno) {
- if (errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) ||
- (dmt->type == DM_DEVICE_MKNODES) ||
- (dmt->type == DM_DEVICE_STATUS)))
+ dmt->ioctl_errno = errno;
+ if (dmt->ioctl_errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) ||
+ (dmt->type == DM_DEVICE_MKNODES) ||
+ (dmt->type == DM_DEVICE_STATUS)))
dmi->flags &= ~DM_EXISTS_FLAG; /* FIXME */
else {
- if (_log_suppress || errno == EINTR)
+ if (_log_suppress || dmt->ioctl_errno == EINTR)
log_verbose("device-mapper: %s ioctl on %s%s%s%.0d%s%.0d%s%s "
"failed: %s",
_cmd_data_v4[dmt->type].name,
@@ -1819,7 +1822,7 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
dmt->minor > 0 ? dmt->minor : 0,
dmt->major > 0 && dmt->minor == 0 ? "0" : "",
dmt->major > 0 ? ")" : "",
- strerror(errno));
+ strerror(dmt->ioctl_errno));
else
log_error("device-mapper: %s ioctl on %s%s%s%.0d%s%.0d%s%s "
"failed: %s",
@@ -1831,14 +1834,14 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
dmt->minor > 0 ? dmt->minor : 0,
dmt->major > 0 && dmt->minor == 0 ? "0" : "",
dmt->major > 0 ? ")" : "",
- strerror(errno));
+ strerror(dmt->ioctl_errno));
/*
* It's sometimes worth retrying after EBUSY in case
* it's a transient failure caused by an asynchronous
* process quickly scanning the device.
*/
- *retryable = errno == EBUSY;
+ *retryable = dmt->ioctl_errno == EBUSY;
goto error;
}
@@ -1876,6 +1879,11 @@ void dm_task_update_nodes(void)
#define DM_IOCTL_RETRIES 25
#define DM_RETRY_USLEEP_DELAY 200000
+int dm_task_get_errno(struct dm_task *dmt)
+{
+ return dmt->ioctl_errno;
+}
+
int dm_task_run(struct dm_task *dmt)
{
struct dm_ioctl *dmi;
diff --git a/libdm/ioctl/libdm-targets.h b/libdm/ioctl/libdm-targets.h
index 100681f..5545459 100644
--- a/libdm/ioctl/libdm-targets.h
+++ b/libdm/ioctl/libdm-targets.h
@@ -68,6 +68,7 @@ struct dm_task {
int deferred_remove;
int enable_checks;
int expected_errno;
+ int ioctl_errno;
char *uuid;
char *mangled_uuid;
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 8295e3c..c811641 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -393,6 +393,11 @@ int dm_get_status_thin(struct dm_pool *mem, const char *params,
int dm_task_run(struct dm_task *dmt);
/*
+ * The errno from the last device-mapper ioctl performed by dm_task_run.
+ */
+int dm_task_get_errno(struct dm_task *dmt);
+
+/*
* Call this to make or remove the device nodes associated with previously
* issued commands.
*/
8 years, 11 months
master - WHATS_NEW: update
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b244fffc182ef1...
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).
8 years, 11 months
master - tests: add test for pvscan --cache --background
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=da20e0c5079eab...
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
8 years, 11 months
master - lvmetad.c: ignore lvmetad global handle on disconnect
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f8bf6410954fcf...
Commit: f8bf6410954fcf82bf28852e0dba015c6b7f19dc
Parent: 9d558fbcc232314dc93a405b4da3079f5d8e9cb7
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Fri May 22 14:48:28 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Mon May 25 09:11:04 2015 +0200
lvmetad.c: ignore lvmetad global handle on disconnect
do not unset lvmetad global handle on disconnect. This is
hotfix for issue described in:
https://www.redhat.com/archives/linux-lvm/2015-May/msg00008.html
Reported-by: Christian Hesse <list(a)eworm.de>
---
lib/cache/lvmetad.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 68162b6..73a382c 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -39,7 +39,6 @@ void lvmetad_disconnect(void)
if (_lvmetad_connected)
daemon_close(_lvmetad);
_lvmetad_connected = 0;
- _lvmetad_cmd = NULL;
}
void lvmetad_init(struct cmd_context *cmd)
8 years, 11 months
master - lvconvert: change how to get failed mirrors number
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9d558fbcc23231...
Commit: 9d558fbcc232314dc93a405b4da3079f5d8e9cb7
Parent: ba68aed8366c201ab0a263a9935243a9e6f08875
Author: Lidong Zhong <lzhong(a)suse.com>
AuthorDate: Fri May 22 15:50:42 2015 +0800
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 22 15:35:36 2015 +0200
lvconvert: change how to get failed mirrors number
Commit b00711e3128c9cb38da90f303a3b64cf3a30fc9b improperly
convert _area_missing() replacment and moved check for
AREA_PV seg_type() into same if() section.
Signed-off-by: Lidong Zhong <lzhong(a)suse.com>
---
WHATS_NEW | 1 +
tools/lvconvert.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index eecdca9..e5864eb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.121 -
================================
+ 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).
Replace poll_get_copy_vg/lv fns with vg_read() and find_lv() in polldaemon.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 6e47f81..4c0cb10 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -839,10 +839,10 @@ static int _failed_mirrors_count(struct logical_volume *lv)
ret += _failed_mirrors_count(seg_lv(lvseg, s));
else if (seg_lv(lvseg, s)->status & PARTIAL_LV)
++ ret;
- else if (seg_type(lvseg, s) == AREA_PV &&
- is_missing_pv(seg_pv(lvseg, s)))
- ++ret;
}
+ else if (seg_type(lvseg, s) == AREA_PV &&
+ is_missing_pv(seg_pv(lvseg, s)))
+ ++ret;
}
}
8 years, 11 months
master - scripts: activation generator: do not use --sysinit if lvmpolld used
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ba68aed8366c20...
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:
8 years, 11 months
master - lvmpolld-client.c: debug print when querying progress
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6d998aa13df81e...
Commit: 6d998aa13df81e5cec339c86a63dac934de3da35
Parent: 01b06cb71b25111c9d0ddaccca97e788f2dedf9d
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Thu May 21 11:10:09 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Thu May 21 11:20:21 2015 +0200
lvmpolld-client.c: debug print when querying progress
---
lib/lvmpolld/lvmpolld-client.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/lvmpolld/lvmpolld-client.c b/lib/lvmpolld/lvmpolld-client.c
index 58bc86f..d770e74 100644
--- a/lib/lvmpolld/lvmpolld-client.c
+++ b/lib/lvmpolld/lvmpolld-client.c
@@ -330,6 +330,8 @@ int lvmpolld_request_info(const struct poll_operation_id *id, const struct daemo
return 0;
}
+ log_debug_lvmpolld("Asking lvmpolld for progress status of an operation on %s/%s.",
+ id->vg_name, id->lv_name);
info = _request_progress_info(id->uuid, parms->aborting);
*finished = info.finished;
8 years, 11 months