lvm2/lvm2-2_02_99-fix-lv_is_active-in-lvcreate.patch

45 lines
1.5 KiB
Diff
Raw Normal View History

commit 191de7c40463b04ef80b424982221784df0a99ed
Author: Peter Rajnoha <prajnoha@redhat.com>
Date: Tue May 14 11:02:39 2013 +0200
lvm2-2_02_99-fix-lv_is_active-in-lvcreate.patch
---
lib/metadata/lv_manip.c | 10 ++--------
test/shell/lvcreate-usage.sh | 2 ++
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index a59e03f..557df58 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4348,14 +4348,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
}
- if (!lv_is_active(org)) {
- log_error("Check for existence of active snapshot "
- "origin '%s' failed.", org->name);
- return NULL;
- }
- origin_active = 1;
-
- if (vg_is_clustered(vg) &&
+ if ((origin_active = lv_is_active(org)) &&
+ vg_is_clustered(vg) &&
!lv_is_active_exclusive_locally(org)) {
log_error("%s must be active exclusively to"
" create snapshot", org->name);
diff --git a/test/shell/lvcreate-usage.sh b/test/shell/lvcreate-usage.sh
index ddde401..c9c906a 100644
--- a/test/shell/lvcreate-usage.sh
+++ b/test/shell/lvcreate-usage.sh
@@ -64,6 +64,8 @@ lvcreate -l1 -n $lv3 $vg
not lvcreate -l1 -n $lv4 $vg
lvremove -ff $vg/$lv3
+# check snapshot of inactive origin
+lvchange -an $vg/$lv1
lvcreate -l1 -s -n $lv3 $vg/$lv1
not lvcreate -l1 -n $lv4 $vg
not lvcreate -l1 -m1 -n $lv4 $vg