master - lvmetad: move initialization in the inner loop
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=88c547d1ca8342...
Commit: 88c547d1ca83426f4de5371baac885f5500b5487
Parent: 7c7ab99843837bd9099ea502c8a34c05fad495c3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Oct 13 19:15:15 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 13 19:15:15 2012 +0200
lvmetad: move initialization in the inner loop
Set append to NULL in the front of cycle, so the INTERNAL error path
is not leading to double-free of append pointer.
---
libdaemon/client/config-util.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libdaemon/client/config-util.c b/libdaemon/client/config-util.c
index 9b893c6..1f4b55b 100644
--- a/libdaemon/client/config-util.c
+++ b/libdaemon/client/config-util.c
@@ -23,7 +23,7 @@
int buffer_append_vf(struct buffer *buf, va_list ap)
{
- char *append = NULL;
+ char *append;
char *next;
int keylen;
int64_t value;
@@ -31,6 +31,7 @@ int buffer_append_vf(struct buffer *buf, va_list ap)
char *block;
while ((next = va_arg(ap, char *))) {
+ append = NULL;
if (!strchr(next, '=')) {
log_error(INTERNAL_ERROR "Bad format string at '%s'", next);
goto fail;
11 years, 6 months
master - cleanup: add gcc printf __attribute__
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7c7ab99843837b...
Commit: 7c7ab99843837bd9099ea502c8a34c05fad495c3
Parent: feea5003cc0af2647f45a46d7b1d449a2f75e99b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Oct 13 19:14:41 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 13 19:14:41 2012 +0200
cleanup: add gcc printf __attribute__
---
.../lvm2_activation_generator_systemd_red_hat.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
index b8d1cfc..dfd6fc4 100644
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -34,6 +34,7 @@ static char target_path[PATH_MAX];
static char message[PATH_MAX];
static int kmsg_fd = -1;
+__attribute__ ((format(printf, 1, 2)))
static void kmsg(const char *format, ...)
{
va_list ap;
11 years, 6 months
master - cleanup: remove unneeded headers
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=feea5003cc0af2...
Commit: feea5003cc0af2647f45a46d7b1d449a2f75e99b
Parent: 98124361ae19b049842d9c8263be6216ee5a6ed8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Oct 13 19:13:25 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Oct 13 19:13:25 2012 +0200
cleanup: remove unneeded headers
Header do not provide any needed symbols.
---
lib/cache/lvmetad.c | 1 -
lib/device/dev-cache.c | 1 -
libdaemon/client/daemon-io.c | 1 -
3 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 9c11329..64820d8 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -20,7 +20,6 @@
#include "lvmcache.h"
#include "lvmetad-client.h"
#include "format-text.h" // TODO for disk_locn, used as a DA representation
-#include "filter.h"
#include "assert.h"
#include "crc.h"
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 44a9e27..d08b07f 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -18,7 +18,6 @@
#include "lvm-types.h"
#include "btree.h"
#include "filter.h"
-#include "filter-persistent.h"
#include "toolcontext.h"
#include <unistd.h>
diff --git a/libdaemon/client/daemon-io.c b/libdaemon/client/daemon-io.c
index 50ef9b2..37f2744 100644
--- a/libdaemon/client/daemon-io.c
+++ b/libdaemon/client/daemon-io.c
@@ -18,7 +18,6 @@
#include <unistd.h>
#include "daemon-io.h"
-#include "dm-logging.h"
#include "libdevmapper.h"
/*
11 years, 6 months
master - test: update global_filter
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=98124361ae19b0...
Commit: 98124361ae19b049842d9c8263be6216ee5a6ed8
Parent: bb867abe11c61db70769570548fd410040aee513
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 12 17:59:11 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 12 17:59:11 2012 +0200
test: update global_filter
use simplier filter for test suite
---
test/shell/mdata-strings.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/mdata-strings.sh b/test/shell/mdata-strings.sh
index 85d0b79..16e9360 100644
--- a/test/shell/mdata-strings.sh
+++ b/test/shell/mdata-strings.sh
@@ -14,7 +14,7 @@
. lib/test
aux prepare_devs 2
-aux lvmconf 'devices/global_filter = [ "a|$DM_DEV_DIR/mirror|", "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]'
+aux lvmconf 'devices/global_filter = [ "a|.*LVMTEST.*dev/mapper/.*pv[0-9_]*$|", "r|.*|" ]'
# for udev impossible to create
pv_ugly="__\"!@#\$%^&*,()|@||'\\\"__pv1"
11 years, 6 months
master - test: typo fix from last commit
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bb867abe11c61d...
Commit: bb867abe11c61db70769570548fd410040aee513
Parent: 45b1fcdb4e65ff55ba40df03df56c65d6c06aa76
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 12 17:35:44 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 12 17:35:44 2012 +0200
test: typo fix from last commit
---
test/shell/mdata-strings.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/mdata-strings.sh b/test/shell/mdata-strings.sh
index c98b364..85d0b79 100644
--- a/test/shell/mdata-strings.sh
+++ b/test/shell/mdata-strings.sh
@@ -14,7 +14,7 @@
. lib/test
aux prepare_devs 2
-axu lvmconf 'devices/global_filter = [ "a|$DM_DEV_DIR/mirror|", "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]'
+aux lvmconf 'devices/global_filter = [ "a|$DM_DEV_DIR/mirror|", "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]'
# for udev impossible to create
pv_ugly="__\"!@#\$%^&*,()|@||'\\\"__pv1"
11 years, 6 months
master - test: move global_filter only to mdata_string test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=45b1fcdb4e65ff...
Commit: 45b1fcdb4e65ff55ba40df03df56c65d6c06aa76
Parent: 0f155e699c67b98cdf6613dcb9fad8d175af7077
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 12 17:27:29 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 12 17:27:29 2012 +0200
test: move global_filter only to mdata_string test
Tries to help with lvmetad test and pvdisplay and unknown device.
---
test/lib/aux.sh | 1 -
test/shell/mdata-strings.sh | 1 +
2 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 07326ec..103318a 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -410,7 +410,6 @@ lvmconf() {
cat > CONFIG_VALUES <<-EOF
devices/dir = "$DM_DEV_DIR"
devices/scan = "$DM_DEV_DIR"
-devices/global_filter = [ "a|$DM_DEV_DIR/mirror|", "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]
devices/filter = [ "a|$DM_DEV_DIR/mirror|", "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]
devices/cache_dir = "$TESTDIR/etc"
devices/sysfs_scan = 0
diff --git a/test/shell/mdata-strings.sh b/test/shell/mdata-strings.sh
index 574334c..c98b364 100644
--- a/test/shell/mdata-strings.sh
+++ b/test/shell/mdata-strings.sh
@@ -14,6 +14,7 @@
. lib/test
aux prepare_devs 2
+axu lvmconf 'devices/global_filter = [ "a|$DM_DEV_DIR/mirror|", "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]'
# for udev impossible to create
pv_ugly="__\"!@#\$%^&*,()|@||'\\\"__pv1"
11 years, 6 months
master - lvmetad: release_token without lvmetad
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0f155e699c67b9...
Commit: 0f155e699c67b98cdf6613dcb9fad8d175af7077
Parent: d9cc3f3acb47b698bb85dc24d3bfe890426c6d7b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 12 17:16:28 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 12 17:16:28 2012 +0200
lvmetad: release_token without lvmetad
Missing wrapper when not building with lvmetad support
---
lib/cache/lvmetad.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/cache/lvmetad.h b/lib/cache/lvmetad.h
index 98d9034..724922d 100644
--- a/lib/cache/lvmetad.h
+++ b/lib/cache/lvmetad.h
@@ -147,6 +147,7 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler)
# define lvmetad_active() (0)
# define lvmetad_warning() do { } while (0)
# define lvmetad_set_token(a) do { } while (0)
+# define lvmetad_release_token() do { } while (0)
# define lvmetad_vg_update(vg) (1)
# define lvmetad_vg_remove(vg) (1)
# define lvmetad_pv_found(pvid, device, fmt, label_sector, vg, handler) (1)
11 years, 6 months
master - test: use global_filter with initial content
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d9cc3f3acb47b6...
Commit: d9cc3f3acb47b698bb85dc24d3bfe890426c6d7b
Parent: 31d8c3ee856b3021f531bfcb92d71811d7e3d575
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 12 16:54:34 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 12 17:02:30 2012 +0200
test: use global_filter with initial content
---
test/lib/aux.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 4b56fb6..07326ec 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -410,7 +410,8 @@ lvmconf() {
cat > CONFIG_VALUES <<-EOF
devices/dir = "$DM_DEV_DIR"
devices/scan = "$DM_DEV_DIR"
-devices/filter = [ "a/dev\\\\/mirror/", "a/dev\\\\/mapper\\\\/.*pv[0-9_]*$/", "r/.*/" ]
+devices/global_filter = [ "a|$DM_DEV_DIR/mirror|", "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]
+devices/filter = [ "a|$DM_DEV_DIR/mirror|", "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]
devices/cache_dir = "$TESTDIR/etc"
devices/sysfs_scan = 0
devices/default_data_alignment = 1
11 years, 6 months
master - debug: do not play with fds with valgring
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=31d8c3ee856b30...
Commit: 31d8c3ee856b3021f531bfcb92d71811d7e3d575
Parent: ee7143cd02d4b26c80b7accbb80d570058cbe9a9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 12 16:52:38 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 12 17:02:30 2012 +0200
debug: do not play with fds with valgring
When valgrind usage is desired by user (--enable-valgrind-pool)
skip playing/closing/reopenning with descriptors - it makes
valgridng useless.
Make sleep delay for clvmd start longer.
---
lib/commands/toolcontext.c | 4 ++++
test/lib/aux.sh | 2 +-
tools/lvmcmdline.c | 2 ++
3 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index d89d2b4..d72b0c0 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1349,6 +1349,7 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
/* FIXME Make this configurable? */
reset_lvm_errno(1);
+#ifndef VALGRIND_POOL
/* Set in/out stream buffering before glibc */
if (set_buffering) {
/* Allocate 2 buffers */
@@ -1381,6 +1382,7 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
} else
/* Without buffering, must not use stdin/stdout */
init_silent(1);
+#endif
/*
* Environment variable LVM_SYSTEM_DIR overrides this below.
@@ -1649,6 +1651,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
if (cmd->libmem)
dm_pool_destroy(cmd->libmem);
+#ifndef VALGRIND_POOL
if (cmd->linebuffer) {
/* Reset stream buffering to defaults */
if (is_valid_fd(STDIN_FILENO)) {
@@ -1669,6 +1672,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
dm_free(cmd->linebuffer);
}
+#endif
dm_free(cmd);
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index f179e31..4b56fb6 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -42,7 +42,7 @@ prepare_clvmd() {
local local_clvmd=$!
sleep .3
# extra sleep for slow valgrind
- test -z "$LVM_VALGRIND_CLVMD" || sleep 5
+ test -z "$LVM_VALGRIND_CLVMD" || sleep 7
# check that it is really running now
ps $local_clvmd || die
echo $local_clvmd > LOCAL_CLVMD
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index efcefe3..39a8c58 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1292,6 +1292,7 @@ static void _close_descriptor(int fd, unsigned suppress_warnings,
static int _close_stray_fds(const char *command)
{
+#ifndef VALGRIND_POOL
struct rlimit rlim;
int fd;
unsigned suppress_warnings = 0;
@@ -1331,6 +1332,7 @@ static int _close_stray_fds(const char *command)
if (closedir(d))
log_sys_error("closedir", _fd_dir);
+#endif
return 1;
}
11 years, 6 months
master - lvmetead: release token
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ee7143cd02d4b2...
Commit: ee7143cd02d4b26c80b7accbb80d570058cbe9a9
Parent: 4d7a4554f40f990b9cb43a5a6039251eec3b94c3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 12 16:50:38 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 12 17:01:22 2012 +0200
lvmetead: release token
Release allocated memory when destroing toolcontext
---
lib/cache/lvmetad.c | 6 ++++++
lib/cache/lvmetad.h | 5 +++++
lib/commands/toolcontext.c | 3 +++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 47a6d75..9c11329 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -86,6 +86,12 @@ void lvmetad_set_token(const struct dm_config_value *filter)
log_warn("WARNING: Failed to set lvmetad token. Out of memory?");
}
+void lvmetad_release_token(void)
+{
+ dm_free(_lvmetad_token);
+ _lvmetad_token = NULL;
+}
+
void lvmetad_set_socket(const char *sock)
{
_lvmetad_socket = sock;
diff --git a/lib/cache/lvmetad.h b/lib/cache/lvmetad.h
index f6e7b67..98d9034 100644
--- a/lib/cache/lvmetad.h
+++ b/lib/cache/lvmetad.h
@@ -64,6 +64,11 @@ void lvmetad_disconnect(void);
void lvmetad_set_token(const struct dm_config_value *filter);
/*
+ * Release allocated token.
+ */
+void lvmetad_release_token(void);
+
+/*
* Send a new version of VG metadata to lvmetad. This is normally called after
* vg_write but before vg_commit. After vg_commit, lvmetad_vg_commit is called
* to seal the transaction. The result of lvmetad_vg_update is that the new
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 5177f41..d89d2b4 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -1672,6 +1672,9 @@ void destroy_toolcontext(struct cmd_context *cmd)
dm_free(cmd);
+ lvmetad_release_token();
+ lvmetad_disconnect();
+
release_log_memory();
activation_exit();
reset_log_duplicated();
11 years, 6 months