master - clvmd: fix memleak on exit
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=460c19df621d35...
Commit: 460c19df621d35260caceec7f598da1566263cd4
Parent: 38ce06e448d54b21c214c174b08b45a18de2ac88
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Mar 8 23:16:31 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 10 12:21:32 2014 +0100
clvmd: fix memleak on exit
This patch will releases allocated private resources from
startup. Needs previous dm_zalloc patch to ensure unset
private pointer is NULL.
TODO: check on real cluster.
---
WHATS_NEW | 1 +
daemons/clvmd/clvmd.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 379117c..7d6f4d6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Cleanup all client resources on clvmd exit.
Use dm_zalloc to clear members of clvmd client struct.
Use BLKID_CFLAGS when compiling with blkid support.
Use correct rl_completion_func_t typedef for new readline.
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index 3d9bce7..e8375a8 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -633,6 +633,7 @@ int main(int argc, char *argv[])
* break of 'clvmd' may access already free memory here.
*/
safe_close(&(delfd->fd));
+ cmd_client_cleanup(delfd);
dm_free(delfd);
}
10 years, 1 month
master - clvmd: use dm_zalloc for socket allocation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=38ce06e448d54b...
Commit: 38ce06e448d54b21c214c174b08b45a18de2ac88
Parent: bfffccca948a526ad907c9d7d1b7de7850a48628
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Mar 8 22:55:47 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 10 12:20:49 2014 +0100
clvmd: use dm_zalloc for socket allocation
Instead of doing individual settings for struct members,
ensure whole struct is in defined state.
---
WHATS_NEW | 1 +
daemons/clvmd/clvmd.c | 21 +++------------------
2 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f72587a..379117c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Use dm_zalloc to clear members of clvmd client struct.
Use BLKID_CFLAGS when compiling with blkid support.
Use correct rl_completion_func_t typedef for new readline.
Make lvm 'dumpconfig --type default' complete for it to be consumed by lvm.
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index fc8cf6e..3d9bce7 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -578,14 +578,12 @@ int main(int argc, char *argv[])
local_client_head.callback = clops->cluster_fd_callback;
/* Add the local socket to the list */
- newfd = malloc(sizeof(struct local_client));
- if (!newfd) {
+ if (!(newfd = dm_zalloc(sizeof(struct local_client)))) {
child_init_signal_and_exit(DFAIL_MALLOC);
/* NOTREACHED */
}
newfd->fd = local_sock;
- newfd->removeme = 0;
newfd->type = LOCAL_RENDEZVOUS;
newfd->callback = local_rendezvous_callback;
newfd->next = local_client_head.next;
@@ -635,7 +633,7 @@ int main(int argc, char *argv[])
* break of 'clvmd' may access already free memory here.
*/
safe_close(&(delfd->fd));
- free(delfd);
+ dm_free(delfd);
}
ret = 0;
@@ -677,8 +675,7 @@ static int local_rendezvous_callback(struct local_client *thisfd, char *buf,
return 1;
if (client_fd >= 0) {
- newfd = malloc(sizeof(struct local_client));
- if (!newfd) {
+ if (!(newfd = dm_zalloc(sizeof(struct local_client)))) {
if (close(client_fd))
log_sys_error("close", "socket");
return 1;
@@ -689,19 +686,7 @@ static int local_rendezvous_callback(struct local_client *thisfd, char *buf,
newfd->fd = client_fd;
newfd->type = LOCAL_SOCK;
- newfd->xid = 0;
- newfd->removeme = 0;
newfd->callback = local_sock_callback;
- newfd->bits.localsock.replies = NULL;
- newfd->bits.localsock.expected_replies = 0;
- newfd->bits.localsock.cmd = NULL;
- newfd->bits.localsock.in_progress = FALSE;
- newfd->bits.localsock.sent_out = FALSE;
- newfd->bits.localsock.threadid = 0;
- newfd->bits.localsock.finished = 0;
- newfd->bits.localsock.cleanup_needed = 0;
- newfd->bits.localsock.pipe_client = NULL;
- newfd->bits.localsock.private = NULL;
newfd->bits.localsock.all_success = 1;
DEBUGLOG("Got new connection on fd %d\n", newfd->fd);
*new_client = newfd;
10 years, 1 month
master - config: keep config paths with variable names properly marked on output
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bfffccca948a52...
Commit: bfffccca948a526ad907c9d7d1b7de7850a48628
Parent: eeff7729d9a48b07bc650c552ec7a03b064c3bc9
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 7 18:04:02 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 7 18:04:02 2014 +0100
config: keep config paths with variable names properly marked on output
---
lib/config/config.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 3c28321..38d3f0b 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1118,7 +1118,7 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
cfg_def = cfg_def_get_item_p(cn->id);
if (out->tree_spec->withcomments) {
- _cfg_def_make_path(path, sizeof(path), cfg_def->id, cfg_def, 0);
+ _cfg_def_make_path(path, sizeof(path), cfg_def->id, cfg_def, 1);
fprintf(out->fp, "%s# Configuration %s %s.\n", line, node_type_name, path);
if (cfg_def->comment)
10 years, 1 month
master - config: use small local static buffer instead of mempool for temporary config path
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eeff7729d9a48b...
Commit: eeff7729d9a48b07bc650c552ec7a03b064c3bc9
Parent: 7409009a20d7c24ddb02f8f792fe4bbd6f2b3e97
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 7 17:44:36 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 7 17:50:01 2014 +0100
config: use small local static buffer instead of mempool for temporary config path
We can't use mempool for temporary variable for configuration path inside
find_config_tree_* functions since these functions can use the mempool
themselves deeper in the code and we can free mempool chunks only from
top to bottom which is not the case here (some default string
configuration values can be allocated from the mempool).
---
lib/config/config.c | 58 +++++++++++++++-----------------------------------
1 files changed, 18 insertions(+), 40 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index b6158bc..3c28321 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -505,21 +505,6 @@ static int _cfg_def_make_path(char *buf, size_t buf_size, int id, cfg_def_item_t
return count + n;
}
-static char *_cfg_def_get_path(struct dm_pool *mem, cfg_def_item_t *item, int xlate)
-{
- char *path;
-
- if (!(path = dm_pool_alloc(mem, CFG_PATH_MAX_LEN))) {
- log_error("Failed to allocate buffer for configuration path.");
- return NULL;
- }
-
- if (!_cfg_def_make_path(path, CFG_PATH_MAX_LEN, item->id, item, xlate))
- return_0;
-
- return path;
-}
-
int config_def_get_path(char *buf, size_t buf_size, int id)
{
return _cfg_def_make_path(buf, buf_size, id, cfg_def_get_item_p(id), 0);
@@ -816,35 +801,34 @@ out:
const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id, struct profile *profile)
{
- char *path;
+ cfg_def_item_t *item = cfg_def_get_item_p(id);
+ char path[CFG_PATH_MAX_LEN];
int profile_applied = 0;
const struct dm_config_node *cn;
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
- path = _cfg_def_get_path(cmd->mem, cfg_def_get_item_p(id), 0);
-
+ _cfg_def_make_path(path, sizeof(path), item->id, item, 0);
cn = dm_config_tree_find_node(cmd->cft, path);
if (profile_applied)
remove_config_tree_by_source(cmd, CONFIG_PROFILE);
- dm_pool_free(cmd->mem, path);
return cn;
}
const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- char *path;
+ char path[CFG_PATH_MAX_LEN];
int profile_applied = 0;
const char *str;
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
- path = _cfg_def_get_path(cmd->mem, item, 0);
+ _cfg_def_make_path(path, sizeof(path), item->id, item, 0);
if (item->type != CFG_TYPE_STRING)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as string.", path);
@@ -854,21 +838,20 @@ const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile
if (profile_applied)
remove_config_tree_by_source(cmd, CONFIG_PROFILE);
- dm_pool_free(cmd->mem, path);
return str;
}
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- char *path;
+ char path[CFG_PATH_MAX_LEN];
int profile_applied = 0;
const char *str;
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
- path = _cfg_def_get_path(cmd->mem, item, 0);
+ _cfg_def_make_path(path, sizeof(path), item->id, item, 0);
if (item->type != CFG_TYPE_STRING)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as string.", path);
@@ -880,21 +863,20 @@ const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, st
if (profile_applied)
remove_config_tree_by_source(cmd, CONFIG_PROFILE);
- dm_pool_free(cmd->mem, path);
return str;
}
int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- char *path;
+ char path[CFG_PATH_MAX_LEN];
int profile_applied = 0;
int i;
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
- path = _cfg_def_get_path(cmd->mem, item, 0);
+ _cfg_def_make_path(path, sizeof(path), item->id, item, 0);
if (item->type != CFG_TYPE_INT)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
@@ -904,21 +886,20 @@ int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profil
if (profile_applied)
remove_config_tree_by_source(cmd, CONFIG_PROFILE);
- dm_pool_free(cmd->mem, path);
return i;
}
int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- char *path;
+ char path[CFG_PATH_MAX_LEN];
int profile_applied = 0;
int i64;
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
- path = _cfg_def_get_path(cmd->mem, item, 0);
+ _cfg_def_make_path(path, sizeof(path), item->id, item, 0);
if (item->type != CFG_TYPE_INT)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
@@ -928,21 +909,20 @@ int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *
if (profile_applied)
remove_config_tree_by_source(cmd, CONFIG_PROFILE);
- dm_pool_free(cmd->mem, path);
return i64;
}
float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- char *path;
+ char path[CFG_PATH_MAX_LEN];
int profile_applied = 0;
float f;
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
- path = _cfg_def_get_path(cmd->mem, item, 0);
+ _cfg_def_make_path(path, sizeof(path), item->id, item, 0);
if (item->type != CFG_TYPE_FLOAT)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as float.", path);
@@ -952,21 +932,20 @@ float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *pr
if (profile_applied)
remove_config_tree_by_source(cmd, CONFIG_PROFILE);
- dm_pool_free(cmd->mem, path);
return f;
}
int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- char *path;
+ char path[CFG_PATH_MAX_LEN];
int profile_applied = 0;
int b;
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
- path = _cfg_def_get_path(cmd->mem, item, 0);
+ _cfg_def_make_path(path, sizeof(path), item->id, item, 0);
if (item->type != CFG_TYPE_BOOL)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as boolean.", path);
@@ -976,7 +955,6 @@ int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profi
if (profile_applied)
remove_config_tree_by_source(cmd, CONFIG_PROFILE);
- dm_pool_free(cmd->mem, path);
return b;
}
@@ -1126,7 +1104,8 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
struct cfg_def_item *cfg_def;
char version[9]; /* 8+1 chars for max version of 7.15.511 */
const char *node_type_name = cn->v ? "option" : "section";
- char *path;
+ char path[CFG_PATH_MAX_LEN];
+
if (cn->id < 0)
return 1;
@@ -1139,9 +1118,8 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
cfg_def = cfg_def_get_item_p(cn->id);
if (out->tree_spec->withcomments) {
- path = _cfg_def_get_path(out->mem, cfg_def, 1);
+ _cfg_def_make_path(path, sizeof(path), cfg_def->id, cfg_def, 0);
fprintf(out->fp, "%s# Configuration %s %s.\n", line, node_type_name, path);
- dm_pool_free(out->mem, path);
if (cfg_def->comment)
fprintf(out->fp, "%s# %s\n", line, cfg_def->comment);
10 years, 1 month
master - cleanup: remove superfluous slash in default cache dir path
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7409009a20d7c2...
Commit: 7409009a20d7c24ddb02f8f792fe4bbd6f2b3e97
Parent: ef1d910dee1157d157402c28680dfe34e06194af
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 7 13:03:09 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 7 13:03:09 2014 +0100
cleanup: remove superfluous slash in default cache dir path
---
lib/config/config.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 1717343..b6158bc 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1607,7 +1607,7 @@ const char *get_default_devices_cache_dir_CFG(struct cmd_context *cmd, struct pr
{
static char buf[PATH_MAX];
- if (dm_snprintf(buf, sizeof(buf), "%s/%s/", cmd->system_dir, DEFAULT_CACHE_SUBDIR) < 0) {
+ if (dm_snprintf(buf, sizeof(buf), "%s/%s", cmd->system_dir, DEFAULT_CACHE_SUBDIR) < 0) {
log_error("Persistent cache directory name too long.");
return NULL;
}
10 years, 1 month
master - tests: updates for new test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ef1d910dee1157...
Commit: ef1d910dee1157d157402c28680dfe34e06194af
Parent: 6b561a7a3b0a9dde9bba139154ebc881e89542e5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 6 17:55:58 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 6 18:01:21 2014 +0100
tests: updates for new test
snaphost needs exclusive origin for cluster
older md5 needs 2 space char
---
test/shell/snapshot-maxsize.sh | 2 +-
test/shell/snapshot-reactivate.sh | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/shell/snapshot-maxsize.sh b/test/shell/snapshot-maxsize.sh
index 3d49a61..a20e306 100644
--- a/test/shell/snapshot-maxsize.sh
+++ b/test/shell/snapshot-maxsize.sh
@@ -18,7 +18,7 @@ aux prepare_pvs 1
vgcreate -s 1K $vg $(cat DEVICES)
-lvcreate -L1 -n $lv1 $vg
+lvcreate -aey -L1 -n $lv1 $vg
# Snapshot should be large enough to handle any writes
lvcreate -L2 -s $vg/$lv1 -n $lv2
diff --git a/test/shell/snapshot-reactivate.sh b/test/shell/snapshot-reactivate.sh
index 289d81d..a4478b7 100644
--- a/test/shell/snapshot-reactivate.sh
+++ b/test/shell/snapshot-reactivate.sh
@@ -19,6 +19,7 @@
# Snapshot should remain unmodified
check_s_() {
+ rm -f debug.log
md5sum -c md5
#diff data "$DM_DEV_DIR/$vg/s"
}
@@ -30,9 +31,9 @@ aux prepare_vg
# 8M file with some random data
dd if=/dev/urandom of=data bs=1M count=1
dd if=data of=data bs=1M count=7 seek=1
-echo "$(md5sum data | cut -d' ' -f1) $DM_DEV_DIR/$vg/s" >md5
+echo "$(md5sum data | cut -d' ' -f1) $DM_DEV_DIR/$vg/s" >md5
-lvcreate -L 8M -n o $vg
+lvcreate -aey -L 8M -n o $vg
dd if=data of="$DM_DEV_DIR/$vg/o" bs=1M
lvcreate -L 8M -s -n s $vg/o
10 years, 1 month
master - tests: check created snapshot has good max size
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6b561a7a3b0a9d...
Commit: 6b561a7a3b0a9dde9bba139154ebc881e89542e5
Parent: d0673b0ddc14c175a496770a77a90d08d035d71b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 6 17:19:35 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 6 17:30:10 2014 +0100
tests: check created snapshot has good max size
Testing if we are creating large enough old-snapshot
(so the COW max size is correct)
https://bugzilla.redhat.com/show_bug.cgi?id=1035871
---
test/shell/snapshot-maxsize.sh | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/test/shell/snapshot-maxsize.sh b/test/shell/snapshot-maxsize.sh
new file mode 100644
index 0000000..3d49a61
--- /dev/null
+++ b/test/shell/snapshot-maxsize.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Copyright (C) 2014 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
+
+# Testing calculation of snapshot space
+# https://bugzilla.redhat.com/show_bug.cgi?id=1035871
+
+. lib/test
+
+aux prepare_pvs 1
+
+vgcreate -s 1K $vg $(cat DEVICES)
+
+lvcreate -L1 -n $lv1 $vg
+# Snapshot should be large enough to handle any writes
+lvcreate -L2 -s $vg/$lv1 -n $lv2
+
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv2" bs=1M count=1
+
+get lv_field $vg/$lv2 lv_attr | tee attrs
+# Snapshot must not be invalid here
+grep -v "....I" attrs
+
+vgremove -f $vg
10 years, 1 month
master - tests: detect old-snap metadata consitency
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d0673b0ddc14c1...
Commit: d0673b0ddc14c175a496770a77a90d08d035d71b
Parent: d5a00c459734e6db0f739764e853424379e8c767
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 4 23:47:22 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 6 17:30:10 2014 +0100
tests: detect old-snap metadata consitency
Add some test for correctness of snapshot metadata.
Based upon original test from Mikulas.
Needs correctly working kernel snapshot target.
---
test/shell/snapshot-reactivate.sh | 55 +++++++++++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/test/shell/snapshot-reactivate.sh b/test/shell/snapshot-reactivate.sh
new file mode 100644
index 0000000..289d81d
--- /dev/null
+++ b/test/shell/snapshot-reactivate.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Copyright (C) 2014 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
+
+#
+# Checking consistency of old-snapshot metadata after de/activation
+# Validates recent snapshot target kernel updates and error
+# is triggered by kernel 3.14-rc[1..5]
+# http://www.redhat.com/archives/dm-devel/2014-March/msg00005.html
+#
+. lib/test
+
+# Snapshot should remain unmodified
+check_s_() {
+ md5sum -c md5
+ #diff data "$DM_DEV_DIR/$vg/s"
+}
+
+which md5sum || skip
+
+aux prepare_vg
+
+# 8M file with some random data
+dd if=/dev/urandom of=data bs=1M count=1
+dd if=data of=data bs=1M count=7 seek=1
+echo "$(md5sum data | cut -d' ' -f1) $DM_DEV_DIR/$vg/s" >md5
+
+lvcreate -L 8M -n o $vg
+dd if=data of="$DM_DEV_DIR/$vg/o" bs=1M
+
+lvcreate -L 8M -s -n s $vg/o
+check_s_
+
+dd if=data of="$DM_DEV_DIR/$vg/o" bs=1234567 count=1 skip=1
+check_s_
+lvchange -an $vg
+
+lvchange -ay $vg
+check_s_
+
+dd if=data of="$DM_DEV_DIR/$vg/o" bs=1234567 count=2 skip=1
+check_s_
+
+lvchange -an $vg
+lvchange -ay $vg
+check_s_
+
+vgremove -f $vg
10 years, 1 month
master - makefiles: link blkid library only to lvm
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d5a00c459734e6...
Commit: d5a00c459734e6db0f739764e853424379e8c767
Parent: 7a595d7388d2dfdb4253ef9425c812491c8e7af5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 6 16:26:18 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 6 17:30:10 2014 +0100
makefiles: link blkid library only to lvm
Don't add blkid to every linkage.
Link udev library just with lvm tools.
Drop extra linkage of udev library, since deps from libdevmapper
are already resolved in linked -ldevmapper.
---
tools/Makefile.in | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 253c404..1a8db36 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -118,11 +118,9 @@ CFLOW_TARGET = lvm
include $(top_builddir)/make.tmpl
-LIBS += $(UDEV_LIBS) $(BLKID_LIBS)
-
device-mapper: $(TARGETS_DM)
-CFLAGS_dmsetup.o += $(EXTRA_EXEC_CFLAGS)
+CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)
dmsetup: dmsetup.o $(top_builddir)/libdm/libdevmapper.$(LIB_SUFFIX)
$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) -L$(top_builddir)/libdm \
10 years, 1 month
master - makefiles: use BLKID/UDEV_CFLAGS properly
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7a595d7388d2df...
Commit: 7a595d7388d2dfdb4253ef9425c812491c8e7af5
Parent: 216c57eed72fee52e99bb5d014c9de535e631f58
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 6 16:03:08 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 6 17:30:06 2014 +0100
makefiles: use BLKID/UDEV_CFLAGS properly
blkid.h needs BLKID_CFLAGS
Do not add UDEV_CFLAGS everywhere and use it only when needed.
---
WHATS_NEW | 1 +
lib/Makefile.in | 2 ++
lib/device/dev-type.c | 2 +-
make.tmpl.in | 6 ++++--
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6e04327..f72587a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Use BLKID_CFLAGS when compiling with blkid support.
Use correct rl_completion_func_t typedef for new readline.
Make lvm 'dumpconfig --type default' complete for it to be consumed by lvm.
Run pvscan --cache via systemd-run in udev if the PV label is detected lost.
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 968ad00..c3d4598 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -217,6 +217,8 @@ CFLOW_LIST_TARGET = $(LIB_NAME).cflow
include $(top_builddir)/make.tmpl
+CFLAGS += $(BLKID_CFLAGS) $(UDEV_CFLAGS)
+
$(SUBDIRS): $(LIB_STATIC)
DISTCLEAN_TARGETS += misc/configure.h misc/lvm-version.h
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index 81100ad..193e9bd 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -22,7 +22,7 @@
#include <ctype.h>
#ifdef BLKID_WIPING_SUPPORT
-#include <blkid/blkid.h>
+#include <blkid.h>
#endif
#include "device-types.h"
diff --git a/make.tmpl.in b/make.tmpl.in
index 7d7d701..b1a6b8f 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -46,7 +46,7 @@ LIBS = @LIBS@
STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
DEFS += @DEFS@
# FIXME set this only where it's needed, not globally?
-CFLAGS += @CFLAGS@ @UDEV_CFLAGS@
+CFLAGS += @CFLAGS@
CLDFLAGS += @CLDFLAGS@
ELDFLAGS += @ELDFLAGS@
LDDEPS += @LDDEPS@
@@ -57,8 +57,10 @@ DL_LIBS = @DL_LIBS@
PTHREAD_LIBS = @PTHREAD_LIBS@
READLINE_LIBS = @READLINE_LIBS@
SELINUX_LIBS = @SELINUX_LIBS@
+UDEV_CFLAGS = @UDEV_CFLAGS@
UDEV_LIBS = @UDEV_LIBS@
-BLKID_LIBS=@BLKID_LIBS@
+BLKID_CFLAGS = @BLKID_CFLAGS@
+BLKID_LIBS = @BLKID_LIBS@
TESTING = @TESTING@
# Setup directory variables
10 years, 1 month