stable-2.02 - lvconvert: can't create cachepool with RAID1 metadata SubLV
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=699bf8609049058875d...
Commit: 699bf8609049058875d84f129d508d4ccbed3900
Parent: 03d6cfdd99fb1c2fd85721ab6faebbb1b6658873
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Apr 12 21:27:30 2019 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Apr 12 21:38:04 2019 +0200
lvconvert: can't create cachepool with RAID1 metadata SubLV
Trying to convert an exiting RAID1 LV to cache metadata SubLV
fails because of missing exclusive activation during wiping.
Solve by activating the RAID1 metadata SubLV exclusively.
Resolves: rhbz1698866
---
tools/lvconvert.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 2b3c3ea..bc666c0 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3167,8 +3167,8 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
if (zero_metadata) {
metadata_lv->status |= LV_ACTIVATION_SKIP;
- if (!activate_lv(cmd, metadata_lv)) {
- log_error("Aborting. Failed to activate metadata lv.");
+ if (!activate_lv_excl_local(cmd, metadata_lv)) {
+ log_error("Aborting. Failed to locally activate metadata lv.");
goto bad;
}
metadata_lv->status &= ~LV_ACTIVATION_SKIP;
5 years
master - hints: fix non-empty hints list when not using hints
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d0b869e46a935003c8e...
Commit: d0b869e46a935003c8ed99dbbbd2d2e745315ff6
Parent: 0cc80ccfd5215073f0f0b0aa3c2913076ae01751
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 11 11:49:18 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 11 11:58:51 2019 -0500
hints: fix non-empty hints list when not using hints
When hints are invalid and ignored, the list of hints
could be non-empty (from additions before an invalid
hint was found). This confused the calling code which
was checking for an empty list to see if hints were used.
Ensure the list is empty when hints are not used.
---
lib/label/hints.c | 15 ++++++++++-----
lib/label/label.c | 16 +++++++++-------
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/lib/label/hints.c b/lib/label/hints.c
index eb0e725..a9e9e07 100644
--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -1147,12 +1147,15 @@ check:
* Returns 1: use hints that are returned in hints list.
*/
-int get_hints(struct cmd_context *cmd, struct dm_list *hints, int *newhints,
+int get_hints(struct cmd_context *cmd, struct dm_list *hints_out, int *newhints,
struct dm_list *devs_in, struct dm_list *devs_out)
{
+ struct dm_list hints_list;
int needs_refresh = 0;
char *vgname = NULL;
+ dm_list_init(&hints_list);
+
/* Decide below if the caller should create new hints. */
*newhints = NEWHINTS_NONE;
@@ -1230,7 +1233,7 @@ int get_hints(struct cmd_context *cmd, struct dm_list *hints, int *newhints,
/*
* couln't read file for some reason, not normal, just skip using hints
*/
- if (!_read_hint_file(cmd, hints, &needs_refresh)) {
+ if (!_read_hint_file(cmd, &hints_list, &needs_refresh)) {
log_debug("get_hints: read fail");
_unlock_hints();
return 0;
@@ -1259,7 +1262,7 @@ int get_hints(struct cmd_context *cmd, struct dm_list *hints, int *newhints,
* of the hints file so it will be recreated, and we must
* be following that since we found no hints.
*/
- if (dm_list_empty(hints)) {
+ if (dm_list_empty(&hints_list)) {
log_debug("get_hints: no entries");
if (!_lock_hints(LOCK_EX, NONBLOCK))
@@ -1279,12 +1282,14 @@ int get_hints(struct cmd_context *cmd, struct dm_list *hints, int *newhints,
* us which devs are PVs. We might want to enable this optimization
* separately.)
*/
- _get_single_vgname_cmd_arg(cmd, hints, &vgname);
+ _get_single_vgname_cmd_arg(cmd, &hints_list, &vgname);
- _apply_hints(cmd, hints, vgname, devs_in, devs_out);
+ _apply_hints(cmd, &hints_list, vgname, devs_in, devs_out);
log_debug("get_hints: applied using %d other %d",
dm_list_size(devs_out), dm_list_size(devs_in));
+
+ dm_list_splice(hints_out, &hints_list);
return 1;
}
diff --git a/lib/label/label.c b/lib/label/label.c
index 6b3d16c..fc74272 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -855,7 +855,7 @@ int label_scan(struct cmd_context *cmd)
{
struct dm_list all_devs;
struct dm_list scan_devs;
- struct dm_list hints;
+ struct dm_list hints_list;
struct dev_iter *iter;
struct device_list *devl, *devl2;
struct device *dev;
@@ -866,7 +866,7 @@ int label_scan(struct cmd_context *cmd)
dm_list_init(&all_devs);
dm_list_init(&scan_devs);
- dm_list_init(&hints);
+ dm_list_init(&hints_list);
/*
* Iterate through all the devices in dev-cache (block devs that appear
@@ -930,8 +930,10 @@ int label_scan(struct cmd_context *cmd)
* able to avoid rescan in vg_read, but locking early would
* apply to more cases.)
*/
- if (!get_hints(cmd, &hints, &newhints, &all_devs, &scan_devs))
+ if (!get_hints(cmd, &hints_list, &newhints, &all_devs, &scan_devs)) {
dm_list_splice(&scan_devs, &all_devs);
+ dm_list_init(&hints_list);
+ }
log_debug("Will scan %d devices skip %d", dm_list_size(&scan_devs), dm_list_size(&all_devs));
@@ -977,8 +979,8 @@ int label_scan(struct cmd_context *cmd)
dm_list_init(&cmd->hints);
- if (!dm_list_empty(&hints)) {
- if (!validate_hints(cmd, &hints)) {
+ if (!dm_list_empty(&hints_list)) {
+ if (!validate_hints(cmd, &hints_list)) {
/*
* We scanned a subset of all devices based on hints.
* With the results from the scan we may decide that
@@ -986,11 +988,11 @@ int label_scan(struct cmd_context *cmd)
*/
log_debug("Will scan %d remaining devices", dm_list_size(&all_devs));
_scan_list(cmd, cmd->filter, &all_devs, NULL);
- _free_hints(&hints);
+ _free_hints(&hints_list);
newhints = 0;
} else {
/* The hints may be used by another device iteration. */
- dm_list_splice(&cmd->hints, &hints);
+ dm_list_splice(&cmd->hints, &hints_list);
}
}
5 years
master - hints: fix case of error getting device size
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0cc80ccfd5215073f0f...
Commit: 0cc80ccfd5215073f0f0b0aa3c2913076ae01751
Parent: 25f231cf06c3938838a64f5b88834d831f45c1c2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 11 10:32:28 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 11 10:32:28 2019 -0500
hints: fix case of error getting device size
When checking hints, if there's an error getting
the device size, that should be equivalent to
seeing zero size.
---
lib/label/hints.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/label/hints.c b/lib/label/hints.c
index a2e7646..eb0e725 100644
--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -414,7 +414,7 @@ static int _dev_in_hint_hash(struct cmd_context *cmd, struct device *dev)
if (!cmd->scan_lvs && dm_is_dm_major(MAJOR(dev->dev)) && dev_is_lv(dev))
return 0;
- if (dev_get_size(dev, &devsize) && !devsize)
+ if (!dev_get_size(dev, &devsize) || !devsize)
return 0;
return 1;
@@ -604,6 +604,8 @@ static int _read_hint_file(struct cmd_context *cmd, struct dm_list *hints, int *
if (!(fp = fopen(_hints_file, "r")))
return 0;
+ log_debug("Reading hint file");
+
for (i = 0; i < HINT_LINE_WORDS; i++)
split[i] = NULL;
5 years
stable-2.02 - systemd: put back DefaultDependencies=no for lvmpolld and lvmetad socket unit
by Peter Rajnoha
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=03d6cfdd99fb1c2fd85...
Commit: 03d6cfdd99fb1c2fd85721ab6faebbb1b6658873
Parent: 6064b9f1b283c63cc3710555a04d2df0c6357cb0
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Apr 11 12:22:27 2019 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Apr 11 12:25:45 2019 +0200
systemd: put back DefaultDependencies=no for lvmpolld and lvmetad socket unit
Previous commit 0a726a7e268b31856615491809af73bda5d4d6f9 removed this
by mistake - we have to keep the DefaultDependencies=no - the
sockets.target is after sysinit.target.
---
scripts/lvm2_lvmetad_systemd_red_hat.socket.in | 2 ++
scripts/lvm2_lvmpolld_systemd_red_hat.socket.in | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.socket.in b/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
index 3201537..2663c72 100644
--- a/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
+++ b/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
@@ -1,6 +1,8 @@
[Unit]
Description=LVM2 metadata daemon socket
Documentation=man:lvmetad(8)
+DefaultDependencies=no
+Conflicts=shutdown.target
[Socket]
ListenStream=@DEFAULT_RUN_DIR(a)/lvmetad.socket
diff --git a/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in b/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
index 743669e..0537d7f 100644
--- a/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
+++ b/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
@@ -1,6 +1,8 @@
[Unit]
Description=LVM2 poll daemon socket
Documentation=man:lvmpolld(8)
+DefaultDependencies=no
+Conflicts=shutdown.target
[Socket]
ListenStream=@DEFAULT_RUN_DIR(a)/lvmpolld.socket
5 years
master - systemd: put back DefaultDependencies=no for lvmpolld socket unit
by Peter Rajnoha
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=25f231cf06c3938838a...
Commit: 25f231cf06c3938838a64f5b88834d831f45c1c2
Parent: 0cab341e1d0e8f9089d3c62d3adbec24dfd5e124
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Apr 11 12:18:02 2019 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Apr 11 12:18:02 2019 +0200
systemd: put back DefaultDependencies=no for lvmpolld socket unit
Previous commit 0cab341e1d0e8f9089d3c62d3adbec24dfd5e124 removed this
by mistake - we have to keep the DefaultDependencies=no - the
sockets.target is after sysinit.target.
---
scripts/lvm2_lvmpolld_systemd_red_hat.socket.in | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in b/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
index 743669e..0537d7f 100644
--- a/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
+++ b/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
@@ -1,6 +1,8 @@
[Unit]
Description=LVM2 poll daemon socket
Documentation=man:lvmpolld(8)
+DefaultDependencies=no
+Conflicts=shutdown.target
[Socket]
ListenStream=@DEFAULT_RUN_DIR(a)/lvmpolld.socket
5 years
stable-2.02 - gcc: cleanup const warning
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6064b9f1b283c63cc37...
Commit: 6064b9f1b283c63cc3710555a04d2df0c6357cb0
Parent: 6d4f36c2c7f782af31eca7eca63310791a4f8e93
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 10 12:56:23 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 10 13:30:34 2019 +0200
gcc: cleanup const warning
---
lib/filters/filter-persistent.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/filters/filter-persistent.c b/lib/filters/filter-persistent.c
index 1d24af8..0586942 100644
--- a/lib/filters/filter-persistent.c
+++ b/lib/filters/filter-persistent.c
@@ -50,8 +50,8 @@ struct pfilter {
* by default. The old code for it should be removed.
*/
-static char* _good_device = "good";
-static char* _bad_device = "bad";
+static const char* _good_device = "good";
+static const char* _bad_device = "bad";
/*
* The hash table holds one of these two states
5 years
stable-2.02 - libdaemon: use pselect to avoid condition checking race
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6d4f36c2c7f782af31e...
Commit: 6d4f36c2c7f782af31eca7eca63310791a4f8e93
Parent: 63289b54c787fbc4f254b1d1144e147a12402d4f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 10 12:50:53 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 10 13:28:45 2019 +0200
libdaemon: use pselect to avoid condition checking race
To avoid tiny race on checking arrival of signal and entering select
(that can latter remain stuck as signal was already delivered) switch
to use pselect().
If it would needed, we can eventually add extra code for older systems
without pselect(), but there are probably no such ancient systems in
use.
---
WHATS_NEW | 1 +
daemons/lvmetad/lvmetad-core.c | 2 +-
daemons/lvmpolld/lvmpolld-core.c | 2 +-
libdaemon/server/daemon-server.c | 38 ++++++++++++++++++++++++++++----------
libdaemon/server/daemon-server.h | 2 +-
5 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 814873e..b15ffa3 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.185 -
==================================
+ Fix signal delivery checking race in libdaemon (lvmetad).
Add missing Before=shutdown.target to LVM2 services to fix shutdown ordering.
Version 2.02.184 - 22nd March 2019
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 72473d7..9ae359b 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -2953,7 +2953,7 @@ static void usage(const char *prog, FILE *file)
int main(int argc, char *argv[])
{
signed char opt;
- struct timeval timeout;
+ struct timespec timeout;
daemon_idle di = { .ptimeout = &timeout };
lvmetad_state ls = { .log_config = "" };
daemon_state s = {
diff --git a/daemons/lvmpolld/lvmpolld-core.c b/daemons/lvmpolld/lvmpolld-core.c
index fd73272..f1056c3 100644
--- a/daemons/lvmpolld/lvmpolld-core.c
+++ b/daemons/lvmpolld/lvmpolld-core.c
@@ -915,7 +915,7 @@ int main(int argc, char *argv[])
int option_index = 0;
int client = 0, server = 0;
unsigned action = ACTION_MAX;
- struct timeval timeout;
+ struct timespec timeout;
daemon_idle di = { .ptimeout = &timeout };
struct lvmpolld_state ls = { .log_config = "" };
daemon_state s = {
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index 3b19883..c61683a 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -87,7 +87,7 @@ static int _is_idle(daemon_state s)
return s.idle && s.idle->is_idle && !s.threads->next;
}
-static struct timeval *_get_timeout(daemon_state s)
+static struct timespec *_get_timeout(daemon_state s)
{
return s.idle ? s.idle->ptimeout : NULL;
}
@@ -96,7 +96,7 @@ static void _reset_timeout(daemon_state s)
{
if (s.idle) {
s.idle->ptimeout->tv_sec = 1;
- s.idle->ptimeout->tv_usec = 0;
+ s.idle->ptimeout->tv_nsec = 0;
}
}
@@ -561,6 +561,8 @@ void daemon_start(daemon_state s)
thread_state _threads = { .next = NULL };
unsigned timeout_count = 0;
fd_set in;
+ sigset_t new_set, old_set;
+ int ret;
/*
* Switch to C locale to avoid reading large locale-archive file used by
@@ -628,8 +630,7 @@ void daemon_start(daemon_state s)
if (!s.foreground)
kill(getppid(), SIGTERM);
- /*
- * Use daemon_main for daemon-specific init and polling, or
+ /* * Use daemon_main for daemon-specific init and polling, or
* use daemon_init for daemon-specific init and generic lib polling.
*/
@@ -643,22 +644,39 @@ void daemon_start(daemon_state s)
if (!s.daemon_init(&s))
failed = 1;
+ if (s.socket_fd >= FD_SETSIZE)
+ failed = 1; /* FD out of available selectable set */
+
+ sigfillset(&new_set);
+ sigprocmask(SIG_SETMASK, NULL, &old_set);
+
while (!failed) {
_reset_timeout(s);
FD_ZERO(&in);
FD_SET(s.socket_fd, &in);
- if (select(FD_SETSIZE, &in, NULL, NULL, _get_timeout(s)) < 0 && errno != EINTR)
- perror("select error");
+
+ sigprocmask(SIG_SETMASK, &new_set, NULL);
+ if (_shutdown_requested && !s.threads->next) {
+ sigprocmask(SIG_SETMASK, &old_set, NULL);
+ INFO(&s, "shutdown requested", s.name);
+ break;
+ }
+ ret = pselect(s.socket_fd + 1, &in, NULL, NULL, _get_timeout(s), &old_set);
+ sigprocmask(SIG_SETMASK, &old_set, NULL);
+
+ if (ret < 0) {
+ if (errno != EINTR && errno != EAGAIN &&
+ (EWOULDBLOCK == EAGAIN || errno != EWOULDBLOCK))
+ perror("select error");
+ continue;
+ }
+
if (FD_ISSET(s.socket_fd, &in)) {
timeout_count = 0;
_handle_connect(s);
}
-
_reap(s, 0);
- if (_shutdown_requested && !s.threads->next)
- break;
-
/* s.idle == NULL equals no shutdown on timeout */
if (_is_idle(s)) {
DEBUGLOG(&s, "timeout occured");
diff --git a/libdaemon/server/daemon-server.h b/libdaemon/server/daemon-server.h
index 2b9ceac..e77ac20 100644
--- a/libdaemon/server/daemon-server.h
+++ b/libdaemon/server/daemon-server.h
@@ -47,7 +47,7 @@ struct timeval;
typedef struct {
volatile unsigned is_idle;
unsigned max_timeouts;
- struct timeval *ptimeout;
+ struct timespec *ptimeout;
} daemon_idle;
struct daemon_state;
5 years
stable-2.02 - configure: check for pselect
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=63289b54c787fbc4f25...
Commit: 63289b54c787fbc4f254b1d1144e147a12402d4f
Parent: 0a726a7e268b31856615491809af73bda5d4d6f9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 10 13:22:43 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Apr 10 13:24:41 2019 +0200
configure: check for pselect
---
configure | 2 +-
configure.ac | 2 +-
include/configure.h.in | 3 +++
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 908dc7c..4d2fb2f 100755
--- a/configure
+++ b/configure
@@ -6672,7 +6672,7 @@ fi
################################################################################
for ac_func in ftruncate gethostname getpagesize gettimeofday localtime_r \
- memchr memset mkdir mkfifo munmap nl_langinfo realpath rmdir setenv \
+ memchr memset mkdir mkfifo munmap nl_langinfo pselect realpath rmdir setenv \
setlocale strcasecmp strchr strcspn strdup strerror strncasecmp strndup \
strrchr strspn strstr strtol strtoul uname
do :
diff --git a/configure.ac b/configure.ac
index b9691ea..379d37f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,7 +146,7 @@ AX_GCC_BUILTIN([__builtin_clz])
################################################################################
dnl -- Check for functions
AC_CHECK_FUNCS([ftruncate gethostname getpagesize gettimeofday localtime_r \
- memchr memset mkdir mkfifo munmap nl_langinfo realpath rmdir setenv \
+ memchr memset mkdir mkfifo munmap nl_langinfo pselect realpath rmdir setenv \
setlocale strcasecmp strchr strcspn strdup strerror strncasecmp strndup \
strrchr strspn strstr strtol strtoul uname], , [AC_MSG_ERROR(bailing out)])
AC_FUNC_ALLOCA
diff --git a/include/configure.h.in b/include/configure.h.in
index 15fd150..812cacc 100644
--- a/include/configure.h.in
+++ b/include/configure.h.in
@@ -340,6 +340,9 @@
/* Define to 1 if you have the <paths.h> header file. */
#undef HAVE_PATHS_H
+/* Define to 1 if you have the `pselect' function. */
+#undef HAVE_PSELECT
+
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
5 years
stable-2.02 - systemd: add missing Before=shutdown.target to LVM2 services to fix shutdown ordering
by Peter Rajnoha
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0a726a7e268b3185661...
Commit: 0a726a7e268b31856615491809af73bda5d4d6f9
Parent: b79f1e176f013167ca9798efb55eaf048d64e042
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Apr 9 12:40:55 2019 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Apr 9 12:40:55 2019 +0200
systemd: add missing Before=shutdown.target to LVM2 services to fix shutdown ordering
We already used Conflicts=shutdown target to stop LVM2 services on shutdown.
But we still missed the ordering - the shutdown.target should be reached
only after all the services are really stopped.
Reported here: https://github.com/lvmteam/lvm2/issues/17
---
WHATS_NEW | 1 +
.../blk_availability_systemd_red_hat.service.in | 1 +
.../lvm2_activation_generator_systemd_red_hat.c | 2 ++
...2_cluster_activation_systemd_red_hat.service.in | 1 +
scripts/lvm2_clvmd_systemd_red_hat.service.in | 2 +-
scripts/lvm2_cmirrord_systemd_red_hat.service.in | 2 +-
scripts/lvm2_lvmetad_systemd_red_hat.service.in | 1 +
scripts/lvm2_lvmetad_systemd_red_hat.socket.in | 2 --
scripts/lvm2_lvmpolld_systemd_red_hat.service.in | 1 +
scripts/lvm2_lvmpolld_systemd_red_hat.socket.in | 2 --
scripts/lvm2_monitoring_systemd_red_hat.service.in | 2 +-
11 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 1d9032d..814873e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.185 -
==================================
+ Add missing Before=shutdown.target to LVM2 services to fix shutdown ordering.
Version 2.02.184 - 22nd March 2019
==================================
diff --git a/scripts/blk_availability_systemd_red_hat.service.in b/scripts/blk_availability_systemd_red_hat.service.in
index 9462072..05fe2ee 100644
--- a/scripts/blk_availability_systemd_red_hat.service.in
+++ b/scripts/blk_availability_systemd_red_hat.service.in
@@ -1,5 +1,6 @@
[Unit]
Description=Availability of block devices
+Before=shutdown.target
After=lvm2-activation.service lvm2-lvmetad.service iscsi-shutdown.service iscsi.service iscsid.service fcoe.service rbdmap.service
DefaultDependencies=no
Conflicts=shutdown.target
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
index 487582f..f85a28f 100644
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -127,6 +127,8 @@ static int generate_unit(const char *dir, int unit, int sysinit_needed)
"SourcePath=/etc/lvm/lvm.conf\n"
"DefaultDependencies=no\n", f);
+ fputs("Conflicts=shutdown.target\n", f);
+
if (unit == UNIT_NET) {
fprintf(f, "After=%s iscsi.service fcoe.service rbdmap.service\n"
"Before=remote-fs-pre.target shutdown.target\n\n"
diff --git a/scripts/lvm2_cluster_activation_systemd_red_hat.service.in b/scripts/lvm2_cluster_activation_systemd_red_hat.service.in
index bf4aa1e..6a966b3 100644
--- a/scripts/lvm2_cluster_activation_systemd_red_hat.service.in
+++ b/scripts/lvm2_cluster_activation_systemd_red_hat.service.in
@@ -1,6 +1,7 @@
[Unit]
Description=Clustered LVM volumes activation service
Requires=lvm2-clvmd.service
+Before=shutdown.target
After=lvm2-clvmd.service lvm2-cmirrord.service
OnFailure=lvm2-clvmd.service
DefaultDependencies=no
diff --git a/scripts/lvm2_clvmd_systemd_red_hat.service.in b/scripts/lvm2_clvmd_systemd_red_hat.service.in
index ced2774..2af365f 100644
--- a/scripts/lvm2_clvmd_systemd_red_hat.service.in
+++ b/scripts/lvm2_clvmd_systemd_red_hat.service.in
@@ -2,7 +2,7 @@
Description=Clustered LVM daemon
Documentation=man:clvmd(8)
After=dlm.service corosync.service
-Before=remote-fs-pre.target
+Before=remote-fs-pre.target shutdown.target
Requires=network.target dlm.service corosync.service
RefuseManualStart=true
RefuseManualStop=true
diff --git a/scripts/lvm2_cmirrord_systemd_red_hat.service.in b/scripts/lvm2_cmirrord_systemd_red_hat.service.in
index e482b9a..fc73aea 100644
--- a/scripts/lvm2_cmirrord_systemd_red_hat.service.in
+++ b/scripts/lvm2_cmirrord_systemd_red_hat.service.in
@@ -3,7 +3,7 @@ Description=Clustered LVM mirror log daemon
Documentation=man:cmirrord(8)
Requires=corosync.service
After=corosync.service
-Before=remote-fs-pre.target
+Before=remote-fs-pre.target shutdown.target
DefaultDependencies=no
Conflicts=shutdown.target
diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.service.in b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
index 92e6d69..960f32d 100644
--- a/scripts/lvm2_lvmetad_systemd_red_hat.service.in
+++ b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
@@ -2,6 +2,7 @@
Description=LVM2 metadata daemon
Documentation=man:lvmetad(8)
Requires=lvm2-lvmetad.socket
+Before=shutdown.target
After=lvm2-lvmetad.socket
DefaultDependencies=no
Conflicts=shutdown.target
diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.socket.in b/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
index 2663c72..3201537 100644
--- a/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
+++ b/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
@@ -1,8 +1,6 @@
[Unit]
Description=LVM2 metadata daemon socket
Documentation=man:lvmetad(8)
-DefaultDependencies=no
-Conflicts=shutdown.target
[Socket]
ListenStream=@DEFAULT_RUN_DIR(a)/lvmetad.socket
diff --git a/scripts/lvm2_lvmpolld_systemd_red_hat.service.in b/scripts/lvm2_lvmpolld_systemd_red_hat.service.in
index 4ad4e61..a06cbe9 100644
--- a/scripts/lvm2_lvmpolld_systemd_red_hat.service.in
+++ b/scripts/lvm2_lvmpolld_systemd_red_hat.service.in
@@ -2,6 +2,7 @@
Description=LVM2 poll daemon
Documentation=man:lvmpolld(8)
Requires=lvm2-lvmpolld.socket
+Before=shutdown.target
After=lvm2-lvmpolld.socket
DefaultDependencies=no
Conflicts=shutdown.target
diff --git a/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in b/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
index 0537d7f..743669e 100644
--- a/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
+++ b/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
@@ -1,8 +1,6 @@
[Unit]
Description=LVM2 poll daemon socket
Documentation=man:lvmpolld(8)
-DefaultDependencies=no
-Conflicts=shutdown.target
[Socket]
ListenStream=@DEFAULT_RUN_DIR(a)/lvmpolld.socket
diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in b/scripts/lvm2_monitoring_systemd_red_hat.service.in
index ebc069e..4bf87a0 100644
--- a/scripts/lvm2_monitoring_systemd_red_hat.service.in
+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in
@@ -3,7 +3,7 @@ Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progres
Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8)
Requires=dm-event.socket lvm2-lvmetad.socket
After=dm-event.socket dm-event.service lvm2-lvmetad.socket lvm2-activation.service lvm2-lvmetad.service
-Before=local-fs-pre.target
+Before=local-fs-pre.target shutdown.target
DefaultDependencies=no
Conflicts=shutdown.target
5 years
master - systemd: add missing Before=shutdown.target to LVM2 services to fix shutdown ordering
by Peter Rajnoha
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0cab341e1d0e8f9089d...
Commit: 0cab341e1d0e8f9089d3c62d3adbec24dfd5e124
Parent: 344a9e9afd9f9038f53887e55e721033d1dc3b65
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Apr 9 12:10:17 2019 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Apr 9 12:24:37 2019 +0200
systemd: add missing Before=shutdown.target to LVM2 services to fix shutdown ordering
We already used Conflicts=shutdown target to stop LVM2 services on shutdown.
But we still missed the ordering - the shutdown.target should be reached
only after all the services are really stopped.
Reported here: https://github.com/lvmteam/lvm2/issues/17
---
WHATS_NEW | 1 +
.../blk_availability_systemd_red_hat.service.in | 1 +
.../lvm2_activation_generator_systemd_red_hat.c | 2 ++
scripts/lvm2_cmirrord_systemd_red_hat.service.in | 2 +-
scripts/lvm2_lvmpolld_systemd_red_hat.service.in | 1 +
scripts/lvm2_lvmpolld_systemd_red_hat.socket.in | 2 --
scripts/lvm2_monitoring_systemd_red_hat.service.in | 2 +-
7 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 728019e..0f0c6ae 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.02 -
===================================
+ Add missing Before=shutdown.target to LVM2 services to fix shutdown ordering.
Skip autoactivation for a PV when PV size does not match device size.
Remove first-pvscan-initialization which should no longer be needed.
Add remote refresh through lvmlockd/dlm for shared LVs after lvextend.
diff --git a/scripts/blk_availability_systemd_red_hat.service.in b/scripts/blk_availability_systemd_red_hat.service.in
index da332c2..82d3b82 100644
--- a/scripts/blk_availability_systemd_red_hat.service.in
+++ b/scripts/blk_availability_systemd_red_hat.service.in
@@ -1,5 +1,6 @@
[Unit]
Description=Availability of block devices
+Before=shutdown.target
After=lvm2-activation.service iscsi-shutdown.service iscsi.service iscsid.service fcoe.service rbdmap.service
DefaultDependencies=no
Conflicts=shutdown.target
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
index f906f08..0f4ac8d 100644
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -139,6 +139,8 @@ static int generate_unit(struct generator *gen, int unit)
"Documentation=man:lvm2-activation-generator(8)\n"
"SourcePath=/etc/lvm/lvm.conf\n" "DefaultDependencies=no\n", f);
+ fputs("Conflicts=shutdown.target\n", f);
+
if (unit == UNIT_NET) {
fprintf(f, "After=%s iscsi.service fcoe.service rbdmap.service\n"
"Before=remote-fs-pre.target shutdown.target\n\n"
diff --git a/scripts/lvm2_cmirrord_systemd_red_hat.service.in b/scripts/lvm2_cmirrord_systemd_red_hat.service.in
index e482b9a..fc73aea 100644
--- a/scripts/lvm2_cmirrord_systemd_red_hat.service.in
+++ b/scripts/lvm2_cmirrord_systemd_red_hat.service.in
@@ -3,7 +3,7 @@ Description=Clustered LVM mirror log daemon
Documentation=man:cmirrord(8)
Requires=corosync.service
After=corosync.service
-Before=remote-fs-pre.target
+Before=remote-fs-pre.target shutdown.target
DefaultDependencies=no
Conflicts=shutdown.target
diff --git a/scripts/lvm2_lvmpolld_systemd_red_hat.service.in b/scripts/lvm2_lvmpolld_systemd_red_hat.service.in
index 4ad4e61..a06cbe9 100644
--- a/scripts/lvm2_lvmpolld_systemd_red_hat.service.in
+++ b/scripts/lvm2_lvmpolld_systemd_red_hat.service.in
@@ -2,6 +2,7 @@
Description=LVM2 poll daemon
Documentation=man:lvmpolld(8)
Requires=lvm2-lvmpolld.socket
+Before=shutdown.target
After=lvm2-lvmpolld.socket
DefaultDependencies=no
Conflicts=shutdown.target
diff --git a/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in b/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
index 0537d7f..743669e 100644
--- a/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
+++ b/scripts/lvm2_lvmpolld_systemd_red_hat.socket.in
@@ -1,8 +1,6 @@
[Unit]
Description=LVM2 poll daemon socket
Documentation=man:lvmpolld(8)
-DefaultDependencies=no
-Conflicts=shutdown.target
[Socket]
ListenStream=@DEFAULT_RUN_DIR(a)/lvmpolld.socket
diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in b/scripts/lvm2_monitoring_systemd_red_hat.service.in
index 7ec4e4e..4bf744a 100644
--- a/scripts/lvm2_monitoring_systemd_red_hat.service.in
+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in
@@ -3,7 +3,7 @@ Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progres
Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8)
Requires=dm-event.socket
After=dm-event.socket dm-event.service lvm2-activation.service
-Before=local-fs-pre.target
+Before=local-fs-pre.target shutdown.target
DefaultDependencies=no
Conflicts=shutdown.target
5 years