master - cleanup: add missing error path check
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a6a7a3a074692a...
Commit: a6a7a3a074692a66d065d19e58e6e170233ab9e9
Parent: ccdea661fa2aab07fbd73bfd7f8fe5273acd71c0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 22 22:39:56 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Nov 23 00:49:04 2014 +0100
cleanup: add missing error path check
New code misses error path check.
---
tools/toollib.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 00512a3..ddf2dcf 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1149,7 +1149,8 @@ struct dm_config_tree *get_cachepolicy_params(struct cmd_context *cmd)
goto_out;
}
- result = dm_config_flatten(current);
+ if (!(result = dm_config_flatten(current)))
+ goto_out;
if (!(cn = dm_config_create_node(result, "policy_settings")))
goto_out;
9 years, 5 months
master - cleanup: warning: declaration of 'remove' shadows a global declaration
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ccdea661fa2aab...
Commit: ccdea661fa2aab07fbd73bfd7f8fe5273acd71c0
Parent: 678cc4e3752ec74c7647a23eb3131439c37b3328
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 22 20:14:42 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Nov 23 00:49:04 2014 +0100
cleanup: warning: declaration of 'remove' shadows a global declaration
Don't shadow stdio.h declaration.
---
libdm/libdm-config.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c
index 91aa970..1ec604f 100644
--- a/libdm/libdm-config.c
+++ b/libdm/libdm-config.c
@@ -1386,11 +1386,11 @@ struct dm_config_tree *dm_config_flatten(struct dm_config_tree *cft)
return res;
}
-int dm_config_remove_node(struct dm_config_node *parent, struct dm_config_node *remove)
+int dm_config_remove_node(struct dm_config_node *parent, struct dm_config_node *rem_node)
{
struct dm_config_node *cn = parent->child, *last = NULL;
while (cn) {
- if (cn == remove) {
+ if (cn == rem_node) {
if (last)
last->sib = cn->sib;
else
9 years, 5 months
master - libdm: report fix memleak on error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=678cc4e3752ec7...
Commit: 678cc4e3752ec74c7647a23eb3131439c37b3328
Parent: 8eb111dfb81c4615826747653d88259e311b2982
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 22 22:40:40 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Nov 23 00:49:04 2014 +0100
libdm: report fix memleak on error path
When _alloc_selection_node() fails, rh should be destroyed.
Use 'bad:' label since we have goto_bad with stack embeded.
---
libdm/libdm-report.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index f768750..0dfbc30 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -2849,24 +2849,24 @@ struct dm_report *dm_report_init_with_selection(uint32_t *report_types,
}
if (!(root = _alloc_selection_node(rh->mem, SEL_OR)))
- return_0;
+ goto_bad;
if (!_parse_or_ex(rh, selection, &fin, root))
- goto error;
+ goto_bad;
next = _skip_space(fin);
if (*next) {
log_error("Expecting logical operator");
log_error(_sel_syntax_error_at_msg, next);
log_error(_sel_help_ref_msg);
- goto error;
+ goto bad;
}
_dm_report_init_update_types(rh, report_types);
rh->selection_root = root;
return rh;
-error:
+bad:
dm_report_free(rh);
return NULL;
}
9 years, 5 months
master - pool: prevent pool conversion with same name
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8eb111dfb81c46...
Commit: 8eb111dfb81c4615826747653d88259e311b2982
Parent: 078230971358c38b124fabb59b0dd3d92521b6f6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 22 23:37:31 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Nov 23 00:49:04 2014 +0100
pool: prevent pool conversion with same name
When same name is given for converted volume and pool volume,
stop further command processing.
---
WHATS_NEW | 1 +
test/shell/lvconvert-thin.sh | 3 +++
tools/lvconvert.c | 15 +++++++++++----
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3b3e414..19f1d2a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.113 -
=====================================
+ Validate converted volume and specified pool volume differ.
Fix regression in vgscan --mknodes usage (2.02.112).
Respect --prefix when setting CLMVD_PATH configure (2.02.89).
Default to configure --enable-udev-systemd-background-jobs for systemd>=205.
diff --git a/test/shell/lvconvert-thin.sh b/test/shell/lvconvert-thin.sh
index e61e470..74484b1 100644
--- a/test/shell/lvconvert-thin.sh
+++ b/test/shell/lvconvert-thin.sh
@@ -103,6 +103,9 @@ invalid lvconvert -c -256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
# non multiple of 64KiB fails
invalid lvconvert -c 88 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2
+# cannot use same LV for pool and convertion
+fail lvconvert --yes --thinpool $vg/$lv3 -T $vg/$lv3
+
# Warning about smaller then suggested
lvconvert --yes -c 256 --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 |& tee err
grep "WARNING: Chunk size is smaller" err
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index d4f3db1..8436c24 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2784,10 +2784,17 @@ static int _lvconvert_pool(struct cmd_context *cmd,
char metadata_name[NAME_LEN], data_name[NAME_LEN];
int activate_pool;
- if (lp->pool_data_name &&
- !(pool_lv = find_lv(vg, lp->pool_data_name))) {
- log_error("Unknown pool data LV %s.", lp->pool_data_name);
- return 0;
+ if (lp->pool_data_name) {
+ if ((lp->thin || lp->cache) &&
+ !strcmp(lp->pool_data_name, pool_lv->name)) {
+ log_error("Converted volume %s and pool volume must differ.",
+ display_lvname(pool_lv));
+ return 0;
+ }
+ if (!(pool_lv = find_lv(vg, lp->pool_data_name))) {
+ log_error("Unknown pool data LV %s.", lp->pool_data_name);
+ return 0;
+ }
}
if (!lv_is_visible(pool_lv)) {
9 years, 5 months
master - tests: reduce thin test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=078230971358c3...
Commit: 078230971358c38b124fabb59b0dd3d92521b6f6
Parent: 4607cbcb0d785a8b112c32ee2487c5f9ee59cdc4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 22 18:15:52 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Nov 22 18:51:02 2014 +0100
tests: reduce thin test
---
test/shell/lvconvert-repair-thin.sh | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/test/shell/lvconvert-repair-thin.sh b/test/shell/lvconvert-repair-thin.sh
index 8e35ad1..0e9534b 100644
--- a/test/shell/lvconvert-repair-thin.sh
+++ b/test/shell/lvconvert-repair-thin.sh
@@ -36,16 +36,14 @@ lvcreate -L2 -n fixed $vg
lvs -a -o+seg_pe_ranges $vg
#aux error_dev "$dev2" 2050:1
-vgchange -an $vg
-
-lvconvert --repair $vg/pool
-
-lvs -a $vg
+lvchange -an $vg/$lv2 $vg/$lv1 $vg/pool $vg/repair
# Manual repair steps:
# Test swapping - swap out thin-pool's metadata with our repair volume
lvconvert -y -f --poolmetadata $vg/repair --thinpool $vg/pool
+lvchange -ay $vg/repair
+
#
# To continue this test - we need real tools available
# When they are not present mark test as skipped, but still
@@ -55,8 +53,6 @@ aux have_tool_at_least "$LVM_TEST_THIN_CHECK_CMD" 0 3 1 || skip
aux have_tool_at_least "$LVM_TEST_THIN_DUMP_CMD" 0 3 1 || skip
aux have_tool_at_least "$LVM_TEST_THIN_REPAIR_CMD" 0 3 1 || skip
-lvchange -aey $vg/repair $vg/fixed
-
# Make some 'repairable' damage??
dd if=/dev/zero of="$DM_DEV_DIR/$vg/repair" bs=1 seek=40960 count=1
@@ -89,10 +85,10 @@ lvconvert -v --repair $vg/pool
# Check repaired pool could be activated
lvchange -ay $vg/pool
-lvchange -an $vg
+vgchange -an $vg
# Restore damaged metadata
-lvconvert -y -f --poolmetadata $vg/pool_meta1 --thinpool $vg/pool
+lvconvert -y -f --poolmetadata $vg/pool_meta0 --thinpool $vg/pool
# Check lvremove -ff works even with damaged pool
lvremove -ff $vg
9 years, 5 months
master - tests: use old virt snaps in the test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4607cbcb0d785a...
Commit: 4607cbcb0d785a8b112c32ee2487c5f9ee59cdc4
Parent: fc935495c813b7577ac8237459a2cc65ea291ac2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 22 18:14:45 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Nov 22 18:51:02 2014 +0100
tests: use old virt snaps in the test
Don't use thin with its thin requirements for the test.
---
test/shell/lvcreate-large-raid.sh | 10 +++++-----
test/shell/lvcreate-large-raid10.sh | 10 +++++-----
test/shell/lvcreate-large.sh | 2 +-
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/test/shell/lvcreate-large-raid.sh b/test/shell/lvcreate-large-raid.sh
index 286b068..182b267 100644
--- a/test/shell/lvcreate-large-raid.sh
+++ b/test/shell/lvcreate-large-raid.sh
@@ -20,11 +20,11 @@ aux have_raid 1 3 0 || skip
aux prepare_vg 5
-lvcreate -s -l 20%FREE -n $lv1 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv2 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv3 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv4 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv5 $vg --virtualsize 256T
+lvcreate --type snapshot -s -l 20%FREE -n $lv1 $vg --virtualsize 256T
+lvcreate --type snapshot -s -l 20%FREE -n $lv2 $vg --virtualsize 256T
+lvcreate --type snapshot -s -l 20%FREE -n $lv3 $vg --virtualsize 256T
+lvcreate --type snapshot -s -l 20%FREE -n $lv4 $vg --virtualsize 256T
+lvcreate --type snapshot -s -l 20%FREE -n $lv5 $vg --virtualsize 256T
#FIXME this should be 1024T
#check lv_field $vg/$lv size "128.00m"
diff --git a/test/shell/lvcreate-large-raid10.sh b/test/shell/lvcreate-large-raid10.sh
index 3c6ddcf..de1cc02 100644
--- a/test/shell/lvcreate-large-raid10.sh
+++ b/test/shell/lvcreate-large-raid10.sh
@@ -20,11 +20,11 @@ aux have_raid 1 3 0 || skip
aux prepare_vg 5
-lvcreate -s -l 20%FREE -n $lv1 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv2 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv3 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv4 $vg --virtualsize 256T
-lvcreate -s -l 20%FREE -n $lv5 $vg --virtualsize 256T
+lvcreate --type snapshot -s -l 20%FREE -n $lv1 $vg --virtualsize 256T
+lvcreate --type snapshot -s -l 20%FREE -n $lv2 $vg --virtualsize 256T
+lvcreate --type snapshot -s -l 20%FREE -n $lv3 $vg --virtualsize 256T
+lvcreate --type snapshot -s -l 20%FREE -n $lv4 $vg --virtualsize 256T
+lvcreate --type snapshot -s -l 20%FREE -n $lv5 $vg --virtualsize 256T
aux extend_filter_LVMTEST
diff --git a/test/shell/lvcreate-large.sh b/test/shell/lvcreate-large.sh
index 24fccb1..29bdd33 100644
--- a/test/shell/lvcreate-large.sh
+++ b/test/shell/lvcreate-large.sh
@@ -18,7 +18,7 @@ aux can_use_16T || skip
aux prepare_vg 4
-lvcreate -s -l 100%FREE -n $lv $vg --virtualsize 1024T
+lvcreate --type snapshot -s -l 100%FREE -n $lv $vg --virtualsize 1024T
#FIXME this should be 1024T
#check lv_field $vg/$lv size "128.00m"
9 years, 5 months
master - libdm: fix reporting of empty string list
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fc935495c813b7...
Commit: fc935495c813b7577ac8237459a2cc65ea291ac2
Parent: 75d79f3dad99106c2ecb68c67507f9c367893ec1
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Nov 22 18:13:21 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Nov 22 18:50:53 2014 +0100
libdm: fix reporting of empty string list
Don't write behind the allocated array when list is empty.
Use index 0 for the allocated element.
Error triggered by i.e.: lvs -a -o all,lv_modules
---
WHATS_NEW_DM | 1 +
libdm/libdm-report.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index a89696f..0de5b89 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.92 -
====================================
+ Fix memory corruption with sorting empty string lists (1.02.86).
Fix man dmsetup.8 syntax warning of Groff
Version 1.02.91 - 11th November 2014
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index bf64cc3..f768750 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -378,8 +378,8 @@ static int _report_field_string_list(struct dm_report *rh,
/* zero items */
if (!list_size) {
sort_value->value = field->report_string = "";
- sort_value->items[1].pos = 0;
- sort_value->items[1].len = 0;
+ sort_value->items[0].pos = 0;
+ sort_value->items[0].len = 0;
field->sort_value = sort_value;
return 1;
}
9 years, 5 months
master - makefiles: standard usage of make.tmpl
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=75d79f3dad9910...
Commit: 75d79f3dad99106c2ecb68c67507f9c367893ec1
Parent: 4dc602f79bd6579eef15a9227aee99fe832a7610
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 21 16:34:01 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Nov 22 09:58:31 2014 +0100
makefiles: standard usage of make.tmpl
Use lvm2 standard TARGETS.
Make liblvm_python.c as intermediate target (gets deleted after use)
Properly delete build dir on make distclean.
Mark install_python_bindings as .PHONY.
---
python/Makefile.in | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/python/Makefile.in b/python/Makefile.in
index 1aaec7e..843560e 100644
--- a/python/Makefile.in
+++ b/python/Makefile.in
@@ -15,7 +15,9 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-python_bindings: .liblvm_built
+TARGETS = .liblvm_built
+
+include $(top_builddir)/make.tmpl
.liblvm_built: liblvm_python.c
$(PYTHON) setup.py build
@@ -24,18 +26,21 @@ python_bindings: .liblvm_built
liblvm_python.c:
$(LN_S) $(srcdir)/liblvm.c $@
-include $(top_builddir)/make.tmpl
-
-install_python_bindings: python_bindings
+install_python_bindings: $(TARGETS)
$(PYTHON) setup.py install --skip-build --prefix $(pyexecdir)
install_lvm2: install_python_bindings
install: install_lvm2
+.PHONY: install_python_bindings
+.INTERMEDIATE: liblvm_python.c
+
clean:
$(RM) -r build
-CLEAN_TARGETS += .liblvm_built liblvm_python.c
+distclean: clean
+
+CLEAN_TARGETS += liblvm_python.c
DISTCLEAN_TARGETS += setup.py
9 years, 5 months
master - dev_manager: fix mknodes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4dc602f79bd657...
Commit: 4dc602f79bd6579eef15a9227aee99fe832a7610
Parent: 6ce8e579897929fceb9da7865160f2e7921ddc6a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 21 19:36:51 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Nov 22 09:57:31 2014 +0100
dev_manager: fix mknodes
Fix regression introduced with a2c1024f6ac7e22ac5c010a267d0c1df331ee416
_setup_task(mknodes ? name : NULL...
has been replaced with:
_setup_task(type != MKNODES ? name : NULL....
Use '=='
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 31a1f3e..3b3e414 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.113 -
=====================================
+ Fix regression in vgscan --mknodes usage (2.02.112).
Respect --prefix when setting CLMVD_PATH configure (2.02.89).
Default to configure --enable-udev-systemd-background-jobs for systemd>=205.
Fix ignore_vg() to properly react on various vg_read errors (2.02.112).
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 44b273d..e336933 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -206,7 +206,7 @@ static int _info_run(info_type_t type, const char *name, const char *dlid,
return 0;
}
- if (!(dmt = _setup_task(type != MKNODES ? name : NULL, dlid, 0, dmtask,
+ if (!(dmt = _setup_task((type == MKNODES) ? name : NULL, dlid, 0, dmtask,
major, minor, with_open_count)))
return_0;
9 years, 5 months
master - configure: fix CLVMD_PATH location
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6ce8e579897929...
Commit: 6ce8e579897929fceb9da7865160f2e7921ddc6a
Parent: 089bdc0be479dce8a886a50606b4bbb108614fb2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 21 16:33:48 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Nov 22 09:55:46 2014 +0100
configure: fix CLVMD_PATH location
Commit d2c116058e72d365802eb5641be60a615daacb96 introduced regression
with CLVMD_PATH.
+ CLVMD_PATH="$clvmd_prefix/sbin/clvmd"
test "$prefix" != NONE && clvmd_prefix=$prefix
It has set CLVMD_PATH before clvmd_prefix got its final value.
Move it one line below.
---
WHATS_NEW | 1 +
configure | 2 +-
configure.in | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3ccb8dc..31a1f3e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.113 -
=====================================
+ Respect --prefix when setting CLMVD_PATH configure (2.02.89).
Default to configure --enable-udev-systemd-background-jobs for systemd>=205.
Fix ignore_vg() to properly react on various vg_read errors (2.02.112).
Failed recovery returns FAILED_RECOVERY status flag for vg_read().
diff --git a/configure b/configure
index a2a094c..df902c3 100755
--- a/configure
+++ b/configure
@@ -12433,8 +12433,8 @@ _ACEOF
if test "$CLVMD" != none; then
clvmd_prefix=$ac_default_prefix
- CLVMD_PATH="$clvmd_prefix/sbin/clvmd"
test "$prefix" != NONE && clvmd_prefix=$prefix
+ CLVMD_PATH="$clvmd_prefix/sbin/clvmd"
cat >>confdefs.h <<_ACEOF
#define CLVMD_PATH "$CLVMD_PATH"
diff --git a/configure.in b/configure.in
index d4e367d..5b22b93 100644
--- a/configure.in
+++ b/configure.in
@@ -1545,8 +1545,8 @@ AC_DEFINE_UNQUOTED(LVM_PATH, ["$LVM_PATH"], [Path to lvm binary.])
if test "$CLVMD" != none; then
clvmd_prefix=$ac_default_prefix
- CLVMD_PATH="$clvmd_prefix/sbin/clvmd"
test "$prefix" != NONE && clvmd_prefix=$prefix
+ CLVMD_PATH="$clvmd_prefix/sbin/clvmd"
AC_DEFINE_UNQUOTED(CLVMD_PATH, ["$CLVMD_PATH"], [Path to clvmd binary.])
fi
9 years, 5 months