master - dmeventd: check for malloc return
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ab6d16a8a5214a...
Commit: ab6d16a8a5214ace81b9af346b9c065ec62fb04b
Parent: 09a62cca0ce259b207e85683dae47ac145590825
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 19 10:59:09 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:28:37 2015 +0200
dmeventd: check for malloc return
---
daemons/dmeventd/dmeventd.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 56c504a..80e6b14 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1394,10 +1394,13 @@ static int _client_read(struct dm_event_fifos *fifos,
bytes += ret > 0 ? ret : 0;
if (header && (bytes == 2 * sizeof(uint32_t))) {
msg->cmd = ntohl(header[0]);
- msg->size = ntohl(header[1]);
- buf = msg->data = dm_malloc(msg->size);
- size = msg->size;
+ size = msg->size = ntohl(header[1]);
bytes = 0;
+ if (!size)
+ break; /* No data -> error */
+ buf = msg->data = dm_malloc(msg->size);
+ if (!buf)
+ break; /* No mem -> error */
header = 0;
}
}
8 years, 1 month
master - libdm: add dm_hold_control_dev
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=09a62cca0ce259...
Commit: 09a62cca0ce259b207e85683dae47ac145590825
Parent: 075f85dcb518d7d9c2452af4165f44ba991a1258
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 21 20:36:15 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:27:31 2015 +0200
libdm: add dm_hold_control_dev
Support hold of control device open.
Useful for daemons so the control device is not frequently reopenned.
---
WHATS_NEW_DM | 1 +
libdm/.exported_symbols.DM_1_02_110 | 1 +
libdm/ioctl/libdm-iface.c | 12 +++++++++++-
libdm/libdevmapper.h | 3 +++
4 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 9818846..653e32d 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.110 -
======================================
+ Add dm_hold_control_dev to allow holding of control device open.
Add dm_report_compact_given_fields to remove given empty fields from report.
Use libdm status parsing and local mem raid dmeventd plugin.
Use local mem pool and lock only lvm2 execution for mirror dmeventd plugin.
diff --git a/libdm/.exported_symbols.DM_1_02_110 b/libdm/.exported_symbols.DM_1_02_110
index 71d04a9..da742ee 100644
--- a/libdm/.exported_symbols.DM_1_02_110
+++ b/libdm/.exported_symbols.DM_1_02_110
@@ -1 +1,2 @@
dm_report_compact_given_fields
+dm_hold_control_dev
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index e9566c2..58a8dfe 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -81,6 +81,7 @@ static dm_bitset_t _dm_bitset = NULL;
static uint32_t _dm_device_major = 0;
static int _control_fd = -1;
+static int _hold_control_fd_open = 0;
static int _version_checked = 0;
static int _version_ok = 1;
static unsigned _ioctl_buffer_double_factor = 0;
@@ -2079,9 +2080,18 @@ repeat_ioctl:
return 0;
}
+void dm_hold_control_dev(int hold_open)
+{
+ _hold_control_fd_open = hold_open ? 1 : 0;
+
+ log_debug("Hold of control device is now %sset.",
+ _hold_control_fd_open ? "" : "un");
+}
+
void dm_lib_release(void)
{
- _close_control_fd();
+ if (!_hold_control_fd_open)
+ _close_control_fd();
dm_timestamp_destroy(_dm_ioctl_timestamp);
_dm_ioctl_timestamp = NULL;
update_devs();
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index fcbf7cf..08b24fe 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1168,6 +1168,9 @@ void dm_lib_init(void) __attribute__((constructor));
void dm_lib_release(void);
void dm_lib_exit(void) __attribute__((destructor));
+/* An optimisation for clients making repeated calls involving dm ioctls */
+void dm_hold_control_dev(int hold_open);
+
/*
* Use NULL for all devices.
*/
8 years, 1 month
master - tools: do not change signals for memlocked daemons
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=075f85dcb518d7...
Commit: 075f85dcb518d7d9c2452af4165f44ba991a1258
Parent: d2c4ce254bac0f607676b10e38ba2f2ebee709b8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 22 10:45:58 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:26:30 2015 +0200
tools: do not change signals for memlocked daemons
---
lib/misc/lvm-signal.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/lib/misc/lvm-signal.c b/lib/misc/lvm-signal.c
index 0d61e73..9250560 100644
--- a/lib/misc/lvm-signal.c
+++ b/lib/misc/lvm-signal.c
@@ -15,6 +15,7 @@
#include "lib.h"
#include "lvm-signal.h"
+#include "memlock.h"
#include <signal.h>
@@ -60,6 +61,8 @@ void sigint_allow(void)
struct sigaction handler;
sigset_t sigs;
+ if (memlock_count_daemon())
+ return;
/*
* Do not overwrite the backed-up handler data -
* just increase nesting count.
@@ -91,6 +94,9 @@ void sigint_allow(void)
void sigint_restore(void)
{
+ if (memlock_count_daemon())
+ return;
+
if (!_handler_installed ||
--_handler_installed >= MAX_SIGINTS)
return;
@@ -112,6 +118,9 @@ void block_signals(uint32_t flags __attribute__((unused)))
{
sigset_t set;
+ if (memlock_count_daemon())
+ return;
+
if (_signals_blocked)
return;
@@ -130,6 +139,9 @@ void block_signals(uint32_t flags __attribute__((unused)))
void unblock_signals(void)
{
+ if (memlock_count_daemon())
+ return;
+
/* Don't unblock signals while any locks are held */
if (!_signals_blocked)
return;
8 years, 1 month
master - tools: preselect some setting for memlocked daemons
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d2c4ce254bac0f...
Commit: d2c4ce254bac0f607676b10e38ba2f2ebee709b8
Parent: 7b78d496bf4e80dab82824a70b1d1d852e7cc1fb
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 22 10:44:38 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:26:30 2015 +0200
tools: preselect some setting for memlocked daemons
When our daemon is locked into memory - avoid
communication with dmeventd and also skip
suspended devices.
---
lib/misc/lvm-globals.c | 6 ++++--
tools/lvmcmdlib.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c
index 60397e5..0cdcc88 100644
--- a/lib/misc/lvm-globals.c
+++ b/lib/misc/lvm-globals.c
@@ -123,7 +123,8 @@ void init_mirror_in_sync(int in_sync)
void init_dmeventd_monitor(int reg)
{
- _dmeventd_monitor = reg;
+ if (!memlock_count_daemon())
+ _dmeventd_monitor = reg;
}
void init_background_polling(int polling)
@@ -133,7 +134,8 @@ void init_background_polling(int polling)
void init_ignore_suspended_devices(int ignore)
{
- _ignore_suspended_devices = ignore;
+ if (!memlock_count_daemon())
+ _ignore_suspended_devices = ignore;
}
void init_ignore_lvm_mirrors(int scan)
diff --git a/tools/lvmcmdlib.c b/tools/lvmcmdlib.c
index 26f160f..ae8ff5c 100644
--- a/tools/lvmcmdlib.c
+++ b/tools/lvmcmdlib.c
@@ -79,9 +79,11 @@ int lvm2_run(void *handle, const char *cmdline)
/* FIXME Temporary - move to libdevmapper */
ret = ECMD_PROCESSED;
- if (!strcmp(cmdline, "_memlock_inc"))
+ if (!strcmp(cmdline, "_memlock_inc")) {
+ init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE);
+ init_ignore_suspended_devices(1);
memlock_inc_daemon(cmd);
- else if (!strcmp(cmdline, "_memlock_dec"))
+ } else if (!strcmp(cmdline, "_memlock_dec"))
memlock_dec_daemon(cmd);
else
ret = lvm_run_command(cmd, argc, argv);
8 years, 1 month
master - memlock: report memlock daemon counter
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7b78d496bf4e80...
Commit: 7b78d496bf4e80dab82824a70b1d1d852e7cc1fb
Parent: 19e272ba53a51a0f3103e1d5e04d06b6207f0acc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 22 10:43:58 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:26:27 2015 +0200
memlock: report memlock daemon counter
Add internal memlock_count_daemon().
Function can be used to recognize it's being executed
from daemon restricted execution inside /lib code.
---
WHATS_NEW | 1 +
lib/mm/memlock.c | 5 +++++
lib/mm/memlock.h | 1 +
3 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ece92e0..8ffbeca 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Support checking of memlock daemon counter.
Allow all log levels to be used with the lvmetad -l option.
Add optional shutdown when idle support for lvmetad.
Fix missing in-sync progress info while lvconvert used with lvmpolld.
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 60686ea..34a6eff 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -638,3 +638,8 @@ void memlock_unlock(struct cmd_context *cmd)
}
#endif
+
+int memlock_count_daemon()
+{
+ return _memlock_count_daemon;
+}
diff --git a/lib/mm/memlock.h b/lib/mm/memlock.h
index aab9c85..3ec5ed8 100644
--- a/lib/mm/memlock.h
+++ b/lib/mm/memlock.h
@@ -36,6 +36,7 @@ void critical_section_dec(struct cmd_context *cmd, const char *reason);
int critical_section(void);
void memlock_inc_daemon(struct cmd_context *cmd);
void memlock_dec_daemon(struct cmd_context *cmd);
+int memlock_count_daemon(void);
void memlock_init(struct cmd_context *cmd);
void memlock_reset(void);
void memlock_unlock(struct cmd_context *cmd);
8 years, 1 month
master - lib: better reporting of threshold
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=19e272ba53a51a...
Commit: 19e272ba53a51a0f3103e1d5e04d06b6207f0acc
Parent: 73e679f33f411c65c9b7c7e4e501d97245f0bf5d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 22 10:46:39 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:06:14 2015 +0200
lib: better reporting of threshold
Simplify code reporting warning about incorrect thresholds.
---
lib/metadata/lv_manip.c | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 7a3d9b9..316710b 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4433,23 +4433,34 @@ static int _adjust_policy_params(struct cmd_context *cmd,
if (lv_is_thin_pool(lv)) {
policy_threshold =
find_config_tree_int(cmd, activation_thin_pool_autoextend_threshold_CFG,
- lv_config_profile(lv)) * DM_PERCENT_1;
+ lv_config_profile(lv));
policy_amount =
find_config_tree_int(cmd, activation_thin_pool_autoextend_percent_CFG,
lv_config_profile(lv));
- if (!policy_amount && policy_threshold < DM_PERCENT_100) {
- log_error("Can't extend thin pool %s, autoextend is set to 0%%.",
- display_lvname(lv));
- return 0;
+ if (policy_threshold < 50) {
+ log_warn("WARNING: Thin pool autoextend threshold %d%% is set bellow "
+ "minimal supported value 50%%.", policy_threshold);
+ policy_threshold = 50;
}
} else {
policy_threshold =
- find_config_tree_int(cmd, activation_snapshot_autoextend_threshold_CFG, NULL) * DM_PERCENT_1;
+ find_config_tree_int(cmd, activation_snapshot_autoextend_threshold_CFG, NULL);
policy_amount =
find_config_tree_int(cmd, activation_snapshot_autoextend_percent_CFG, NULL);
+ if (policy_threshold < 50) {
+ log_warn("WARNING: Snapshot autoextend threshold %d%% is set bellow "
+ "minimal supported value 50%%.", policy_threshold);
+ policy_threshold = 50;
+ }
}
- if (policy_threshold >= DM_PERCENT_100)
+ if (!policy_amount && policy_threshold < 100) {
+ log_error("Can't extend %s with %s autoextend percent set to 0%%.",
+ display_lvname(lv), first_seg(lv)->segtype->name);
+ return 0;
+ }
+
+ if (policy_threshold >= 100)
return 1; /* nothing to do */
if (!lv_is_active_locally(lv)) {
@@ -4458,6 +4469,8 @@ static int _adjust_policy_params(struct cmd_context *cmd,
return 0;
}
+ policy_threshold *= DM_PERCENT_1;
+
if (lv_is_thin_pool(lv)) {
if (!lv_thin_pool_percent(lv, 1, &percent))
return_0;
8 years, 1 month
master - man: document possible lvmetad -l values
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=73e679f33f411c...
Commit: 73e679f33f411c65c9b7c7e4e501d97245f0bf5d
Parent: a0d819172fde16913347e5c0984dc4d67ae6befe
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Oct 21 13:36:57 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Oct 21 13:36:57 2015 -0500
man: document possible lvmetad -l values
In the man page and the lvmetad help output.
---
WHATS_NEW | 1 +
daemons/lvmetad/lvmetad-core.c | 4 ++--
man/lvmetad.8.in | 14 +++++---------
3 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 983b2b4..ece92e0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.133 -
======================================
+ Allow all log levels to be used with the lvmetad -l option.
Add optional shutdown when idle support for lvmetad.
Fix missing in-sync progress info while lvconvert used with lvmpolld.
Add report/compact_output_cols to lvm.conf to define report cols to compact.
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 7ec3a3a..64d998e 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -1637,11 +1637,11 @@ static int process_timeout_arg(const char *str, unsigned *max_timeouts)
static void usage(const char *prog, FILE *file)
{
fprintf(file, "Usage:\n"
- "%s [-V] [-h] [-f] [-l {all|wire|debug}] [-s path] [-t secs]\n\n"
+ "%s [-V] [-h] [-f] [-l level[,level ...]] [-s path] [-t secs]\n\n"
" -V Show version of lvmetad\n"
" -h Show this help information\n"
" -f Don't fork, run in the foreground\n"
- " -l Logging message level (-l {all|wire|debug})\n"
+ " -l Logging message levels (all,fatal,error,warn,info,wire,debug)\n"
" -p Set path to the pidfile\n"
" -s Set path to the socket to listen on\n"
" -t Time to wait in seconds before shutdown on idle (missing or 0 = inifinite)\n\n", prog);
diff --git a/man/lvmetad.8.in b/man/lvmetad.8.in
index 2acfd8b..3e895ce 100644
--- a/man/lvmetad.8.in
+++ b/man/lvmetad.8.in
@@ -5,7 +5,7 @@ lvmetad \(em LVM metadata cache daemon
.SH SYNOPSIS
.B lvmetad
.RB [ \-l
-.RI { all | wire | debug }]
+.IR level [,level...]]
.RB [ \-p
.IR pidfile_path ]
.RB [ \-s
@@ -77,15 +77,11 @@ Don't fork, but run in the foreground.
.BR \-h ", " \-?
Show help information.
.TP
-.IR \fB\-l " {" all | wire | debug }
-Select the type of log messages to generate.
-Messages are logged by syslog.
+.B \-l \fIlevels
+Specify the levels of log messages to generate as a comma separated list.
+Messages are logged by syslog.
Additionally, when \-f is given they are also sent to standard error.
-Since release 2.02.98, there are two classes of messages: wire and debug.
-Selecting 'all' supplies both and is equivalent to a comma-separated list
-\-l wire,debug.
-Prior to release 2.02.98, repeating \-d from 1 to 3 times, viz. \-d, \-dd, \-ddd,
-increased the detail of messages.
+Possible levels are: all, fatal, error, warn, info, wire, debug.
.TP
.B \-p \fIpidfile_path
Path to the pidfile. This overrides both the built-in default
8 years, 1 month
master - libdaemon: fix typo in last log enable commit
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a0d819172fde16...
Commit: a0d819172fde16913347e5c0984dc4d67ae6befe
Parent: 0aee04288e221de91de022d84d19424d4698a05c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Oct 21 11:22:22 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Oct 21 11:22:22 2015 -0500
libdaemon: fix typo in last log enable commit
---
libdaemon/server/daemon-log.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdaemon/server/daemon-log.c b/libdaemon/server/daemon-log.c
index abe602b..2bebf41 100644
--- a/libdaemon/server/daemon-log.c
+++ b/libdaemon/server/daemon-log.c
@@ -166,7 +166,7 @@ static int _parse_one(log_state *s, int outlet, const char *type, int enable)
daemon_log_enable(s, outlet, DAEMON_LOG_ERROR, enable);
else if (!strcmp(type, "warn"))
daemon_log_enable(s, outlet, DAEMON_LOG_WARN, enable);
- else if (!strcmp(type, "warn"))
+ else if (!strcmp(type, "info"))
daemon_log_enable(s, outlet, DAEMON_LOG_INFO, enable);
else if (!strcmp(type, "wire"))
daemon_log_enable(s, outlet, DAEMON_LOG_WIRE, enable);
8 years, 1 month
master - libdaemon: allow all debug levels for stderr
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0aee04288e221d...
Commit: 0aee04288e221de91de022d84d19424d4698a05c
Parent: ef4d69f456b22b4e58afb9fe5ff0b09603944f35
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Oct 21 11:16:59 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Oct 21 11:19:18 2015 -0500
libdaemon: allow all debug levels for stderr
The parsing code for log levels was missing
some levels. Also ignore an unrecognized
level name rather than failing.
---
libdaemon/server/daemon-log.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/libdaemon/server/daemon-log.c b/libdaemon/server/daemon-log.c
index 5ea5cdc..abe602b 100644
--- a/libdaemon/server/daemon-log.c
+++ b/libdaemon/server/daemon-log.c
@@ -160,12 +160,18 @@ static int _parse_one(log_state *s, int outlet, const char *type, int enable)
if (!strcmp(type, "all"))
for (i = 0; i < 32; ++i)
daemon_log_enable(s, outlet, i, enable);
+ else if (!strcmp(type, "fatal"))
+ daemon_log_enable(s, outlet, DAEMON_LOG_FATAL, enable);
+ else if (!strcmp(type, "error"))
+ daemon_log_enable(s, outlet, DAEMON_LOG_ERROR, enable);
+ else if (!strcmp(type, "warn"))
+ daemon_log_enable(s, outlet, DAEMON_LOG_WARN, enable);
+ else if (!strcmp(type, "warn"))
+ daemon_log_enable(s, outlet, DAEMON_LOG_INFO, enable);
else if (!strcmp(type, "wire"))
daemon_log_enable(s, outlet, DAEMON_LOG_WIRE, enable);
else if (!strcmp(type, "debug"))
daemon_log_enable(s, outlet, DAEMON_LOG_DEBUG, enable);
- else
- return 0;
return 1;
}
8 years, 1 month
master - tests: add lvmetad shutdown on idle test
by okozina
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ef4d69f456b22b...
Commit: ef4d69f456b22b4e58afb9fe5ff0b09603944f35
Parent: c15649b3af94e4af573ada0f30e35f7d1fee5321
Author: Ondrej Kozina <okozina(a)redhat.com>
AuthorDate: Tue Oct 20 15:41:42 2015 +0200
Committer: Ondrej Kozina <okozina(a)redhat.com>
CommitterDate: Tue Oct 20 15:45:28 2015 +0200
tests: add lvmetad shutdown on idle test
---
test/shell/lvmetad-autoshutdown.sh | 56 ++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvmetad-autoshutdown.sh b/test/shell/lvmetad-autoshutdown.sh
new file mode 100644
index 0000000..fdee4a6
--- /dev/null
+++ b/test/shell/lvmetad-autoshutdown.sh
@@ -0,0 +1,56 @@
+#!/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 -0 $(< LOCAL_LVMETAD) || die "lvmetad is already dead"
+
+lvmetad_timeout=3
+
+aux prepare_pvs 1
+
+vgcreate $vg1 "$dev1"
+
+kill $(< LOCAL_LVMETAD)
+aux prepare_lvmetad -t $lvmetad_timeout
+
+sleep $lvmetad_timeout
+
+# lvmetad should die after timeout, but give it some time to do so
+i=0
+while kill -0 $(< LOCAL_LVMETAD) 2>/dev/null; do
+ test $i -ge $((lvmetad_timeout*10)) && die "lvmetad didn't shutdown with optional timeout: $lvmetad_timeout seconds"
+ sleep .1
+ i=$((i+1))
+done
+
+aux prepare_lvmetad -t 0
+sleep 1
+# lvmetad must not die with -t 0 option
+kill -0 $(< LOCAL_LVMETAD) || die "lvmetad died"
+
+kill $(< LOCAL_LVMETAD)
+aux prepare_lvmetad -t $lvmetad_timeout
+
+sleep 1
+vgs
+sleep 1
+vgs
+sleep 1
+vgs
+
+# check that connection to lvmetad resets the timeout
+kill -0 $(< LOCAL_LVMETAD) || die "lvmetad died too soon"
+
+vgremove -ff $vg1
8 years, 1 month