master - lvconvert: fix conversion attempts to linear
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e83c4f07ca4a8480817...
Commit: e83c4f07ca4a84808178d5d22cba655e5e370cd8
Parent: 10ede2cc0fdabaeb19c5b5b3341164432f6d4425
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Aug 22 16:39:36 2018 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Aug 22 17:12:43 2018 +0200
lvconvert: fix conversion attempts to linear
"lvconvert --type linear RaidLV" on striped and raid4/5/6/10
have to provide the convenient interim layouts. Fix involves
a cleanup to the convenience type function.
As a result of testing, add missing sync waits to
lvconvert-raid-reshape-linear_to_raid6-single-type.sh.
Resolves: rhbz1447809
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 147 +++++++++-----------
...ert-raid-reshape-linear_to_raid6-single-type.sh | 2 +
3 files changed, 69 insertions(+), 81 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0ea2789..fd1b732 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 3.0.0
=============
+ Fix lvconvert conversion attempts to linear.
Fix lvconvert raid0/raid0_meta -> striped regression.
Fix lvconvert --splitmirror for mirror type (2.02.178).
Do not pair cache policy and cache metadata format.
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 5441527..6cbf601 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6110,8 +6110,7 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
const struct segment_type *segtype_sav = *segtype;
/* Linear -> striped request */
- if (seg_is_striped(seg_from) &&
- seg_from->area_count == 1 &&
+ if (seg_is_linear(seg_from) &&
segtype_is_striped(*segtype))
;
/* Bail out if same RAID level is requested. */
@@ -6120,24 +6119,20 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
log_debug("Checking LV %s requested %s segment type for convenience",
display_lvname(seg_from->lv), (*segtype)->name);
- /* striped/raid0 -> raid5/6 */
- if (seg_is_striped(seg_from) || seg_is_any_raid0(seg_from)) {
- /* linear -> raid*, interim/first conversion is to raid1 */
- if (seg_from->area_count == 1)
- seg_flag = SEG_RAID1;
-
- else if (seg_is_any_raid0(seg_from) && segtype_is_striped(*segtype))
- ;
-
- /* If this is any raid5 conversion request -> enforce raid5_n, because we convert from striped */
- else if (((segtype_is_striped(*segtype) && !segtype_is_any_raid0(*segtype)) || segtype_is_any_raid5(*segtype)) &&
- !segtype_is_raid5_n(*segtype))
- seg_flag = SEG_RAID5_N;
- /* If this is any raid6 conversion request -> enforce raid6_n_6, because we convert from striped */
- else if (segtype_is_any_raid6(*segtype) && !segtype_is_raid6_n_6(*segtype))
+ /* linear -> */
+ if (seg_is_linear(seg_from)) {
+ seg_flag = SEG_RAID1;
+
+ /* striped/raid0 -> */
+ } else if (seg_is_striped(seg_from) || seg_is_any_raid0(seg_from)) {
+ if (segtype_is_any_raid6(*segtype))
seg_flag = SEG_RAID6_N_6;
+ if (segtype_is_linear(*segtype) ||
+ (!segtype_is_raid10(*segtype) && !segtype_is_striped(*segtype)))
+ seg_flag = SEG_RAID5_N;
+
/* raid1 -> */
} else if (seg_is_raid1(seg_from) && !segtype_is_mirror(*segtype)) {
if (seg_from->area_count != 2) {
@@ -6147,85 +6142,68 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
}
if (segtype_is_striped(*segtype) ||
- segtype_is_any_raid0(*segtype) ||
- segtype_is_raid10(*segtype))
+ segtype_is_any_raid0(*segtype) ||
+ segtype_is_raid10(*segtype))
seg_flag = SEG_RAID5_N;
else if (!segtype_is_raid4(*segtype) && !segtype_is_any_raid5(*segtype))
seg_flag = SEG_RAID5_LS;
- /* raid4/raid5 -> striped/raid0/raid1/raid6/raid10 */
- } else if (seg_is_raid4(seg_from) || seg_is_any_raid5(seg_from)) {
- if ((segtype_is_raid1(*segtype) || segtype_is_linear(*segtype)) && seg_is_raid5_n(seg_from)) {
+ /* raid5* -> */
+ } else if (seg_is_any_raid5(seg_from)) {
+ if (segtype_is_raid1(*segtype) || segtype_is_linear(*segtype)) {
if (seg_from->area_count != 2) {
log_error("Converting %s LV %s to 2 stripes first.",
lvseg_name(seg_from), display_lvname(seg_from->lv));
*new_image_count = 2;
- seg_flag = SEG_RAID5_N;
+ *segtype = seg_from->segtype;
+ seg_flag = 0;
} else
seg_flag = SEG_RAID1;
- } else if (segtype_is_raid1(*segtype) && seg_from->area_count != 2) {
- log_error("Convert %s LV %s to 2 stripes first (i.e. --stripes 1).",
- lvseg_name(seg_from), display_lvname(seg_from->lv));
- return 0;
-
- } else if (seg_is_raid4(seg_from) &&
- (segtype_is_linear(*segtype) || segtype_is_any_raid5(*segtype)) &&
- !segtype_is_raid5_n(*segtype))
- seg_flag = SEG_RAID5_N;
+ } else if (segtype_is_any_raid6(*segtype)) {
+ if (seg_from->area_count < 4) {
+ if (*stripes > 3)
+ *new_image_count = *stripes + seg_from->segtype->parity_devs;
+ else
+ *new_image_count = 4;
- else if (seg_is_raid5_n(seg_from) && seg_from->area_count == 2) {
- if (*stripes >= 2) {
+ *segtype = seg_from->segtype;
log_error("Converting %s LV %s to %u stripes first.",
- lvseg_name(seg_from), display_lvname(seg_from->lv), *stripes);
+ lvseg_name(seg_from), display_lvname(seg_from->lv), *new_image_count);
+
+ } else
+ seg_flag = _raid_seg_flag_5_to_6(seg_from);
+
+ } else if (segtype_is_striped(*segtype) || segtype_is_raid10(*segtype)) {
+ int change = 0;
+
+ if (!seg_is_raid5_n(seg_from)) {
+ seg_flag = SEG_RAID5_N;
+
+ } else if (*stripes > 2 && *stripes != seg_from->area_count - seg_from->segtype->parity_devs) {
+ change = 1;
*new_image_count = *stripes + seg_from->segtype->parity_devs;
seg_flag = SEG_RAID5_N;
- } else {
- log_error("Convert %s LV %s to minimum 3 stripes first (i.e. --stripes 2).",
- lvseg_name(seg_from), display_lvname(seg_from->lv));
- return 0;
- }
- } else if (seg_is_any_raid5(seg_from) &&
- (segtype_is_linear(*segtype) || segtype_is_raid4(*segtype)) &&
- !segtype_is_raid5_n(*segtype))
- seg_flag = SEG_RAID5_N;
- else if (segtype_is_raid10(*segtype)) {
- if (seg_from->area_count < 3) {
- if (*stripes >= 2) {
- log_error("Converting %s LV %s to %u stripes first.",
- lvseg_name(seg_from), display_lvname(seg_from->lv), *stripes);
- *new_image_count = *stripes + seg_from->segtype->parity_devs;
- seg_flag = SEG_RAID5_N;
- } else {
- log_error("Convert %s LV %s to minimum 3 stripes first (i.e. --stripes 2).",
- lvseg_name(seg_from), display_lvname(seg_from->lv));
- return 0;
- }
- } else
- seg_flag = seg_is_raid5_n(seg_from) ? SEG_RAID0_META : SEG_RAID5_N;
+ } else if (seg_from->area_count < 3) {
+ change = 1;
+ *new_image_count = 3;
+ seg_flag = SEG_RAID5_N;
- } else if (segtype_is_any_raid6(*segtype)) {
- if (seg_from->area_count < 4 &&
- seg_is_any_raid5(seg_from)) {
- if (*stripes >= 3) {
- log_error("Converting %s LV %s to %u stripes first.",
- lvseg_name(seg_from), display_lvname(seg_from->lv), *stripes);
- *new_image_count = *stripes + seg_from->segtype->parity_devs;
- seg_flag = SEG_RAID5_LS;
- } else {
- log_error("Convert %s LV %s to minimum 4 stripes first (i.e. --stripes 3).",
- lvseg_name(seg_from), display_lvname(seg_from->lv));
- return 0;
- }
+ } else if (!segtype_is_striped(*segtype))
+ seg_flag = SEG_RAID0_META;
- } else if (seg_is_raid4(seg_from) && !segtype_is_raid6_n_6(*segtype))
- seg_flag = SEG_RAID6_N_6;
- else
- seg_flag = _raid_seg_flag_5_to_6(seg_from);
+ if (change)
+ log_error("Converting %s LV %s to %u stripes first.",
+ lvseg_name(seg_from), display_lvname(seg_from->lv), *new_image_count);
}
+ /* raid4 -> !raid4/raid5* */
+ } else if (seg_is_raid4(seg_from) &&
+ !segtype_is_raid4(*segtype) && !segtype_is_any_raid5(*segtype)) {
+ seg_flag = SEG_RAID5_N;
+
/* raid6 -> striped/raid0/raid5/raid10 */
} else if (seg_is_any_raid6(seg_from)) {
if (segtype_is_raid1(*segtype)) {
@@ -6237,6 +6215,9 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
} else if (segtype_is_any_raid10(*segtype)) {
seg_flag = seg_is_raid6_n_6(seg_from) ? SEG_RAID0_META : SEG_RAID6_N_6;
+ } else if (segtype_is_linear(*segtype)) {
+ seg_flag = seg_is_raid6_n_6(seg_from) ? SEG_RAID5_N : SEG_RAID6_N_6;
+
} else if (segtype_is_striped(*segtype) || segtype_is_any_raid0(*segtype)) {
if (!seg_is_raid6_n_6(seg_from))
seg_flag = SEG_RAID6_N_6;
@@ -6267,12 +6248,16 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
return 0;
}
- /* raid10 -> ... */
- } else if (seg_is_raid10(seg_from) &&
- !segtype_is_striped(*segtype) &&
- !segtype_is_any_raid0(*segtype))
- seg_flag = SEG_RAID0_META;
+ } else if (seg_is_raid10(seg_from)) {
+ if (segtype_is_linear(*segtype) ||
+ (!segtype_is_striped(*segtype) &&
+ !segtype_is_any_raid0(*segtype))) {
+ seg_flag = SEG_RAID0_META;
+ }
+ }
+
+ /* raid10 -> ... */
if (seg_flag) {
if (!(*segtype = get_segtype_from_flag(cmd, seg_flag)))
return_0;
diff --git a/test/shell/lvconvert-raid-reshape-linear_to_raid6-single-type.sh b/test/shell/lvconvert-raid-reshape-linear_to_raid6-single-type.sh
index f01e7ef..05cb616 100644
--- a/test/shell/lvconvert-raid-reshape-linear_to_raid6-single-type.sh
+++ b/test/shell/lvconvert-raid-reshape-linear_to_raid6-single-type.sh
@@ -78,6 +78,7 @@ check lv_first_seg_field $vg/$lv data_stripes 3
check lv_first_seg_field $vg/$lv stripesize "64.00k"
check lv_first_seg_field $vg/$lv regionsize "128.00k"
check lv_first_seg_field $vg/$lv reshape_len_le 0
+aux wait_for_sync $vg $lv
# Convert raid6_ls_6 -> raid6(_zr) (reshape)
lvconvert -y --type raid6 --stripes 3 --stripesize 64K --regionsize 128K $vg/$lv
@@ -88,6 +89,7 @@ check lv_first_seg_field $vg/$lv data_stripes 3
check lv_first_seg_field $vg/$lv stripesize "64.00k"
check lv_first_seg_field $vg/$lv regionsize "128.00k"
check lv_first_seg_field $vg/$lv reshape_len_le 10
+aux wait_for_sync $vg $lv
# Remove reshape space
lvconvert -y --type raid6 --stripes 3 --stripesize 64K --regionsize 128K $vg/$lv
5 years, 8 months
master - config: improve use_blkid_wiping
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=10ede2cc0fdabaeb19c...
Commit: 10ede2cc0fdabaeb19c5b5b3341164432f6d4425
Parent: 4578411633a40c8c9068ff439ef3c33cbe78d25a
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Aug 21 12:24:35 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Aug 21 12:24:35 2018 -0500
config: improve use_blkid_wiping
mention that libblkid is used to both detect
and erase signatures.
---
lib/config/config_settings.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 7882e95..1d0cc79 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -471,7 +471,7 @@ cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, 0,
"and revert to the previous algorithm.\n")
cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_USE_BLKID_WIPING, vsn(2, 2, 105), "@DEFAULT_USE_BLKID_WIPING@", 0, NULL,
- "Use blkid to detect existing signatures on new PVs and LVs.\n"
+ "Use blkid to detect and erase existing signatures on new PVs and LVs.\n"
"The blkid library can detect more signatures than the native LVM\n"
"detection code, but may take longer. LVM needs to be compiled with\n"
"blkid wiping support for this setting to apply. LVM native detection\n"
5 years, 8 months
master - lvconvert: fix regression preventing direct striped conversion
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4578411633a40c8c906...
Commit: 4578411633a40c8c9068ff439ef3c33cbe78d25a
Parent: 8b05f1f230517aa42878aa160d94383ed0534c64
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Tue Aug 21 17:12:33 2018 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Tue Aug 21 17:28:56 2018 +0200
lvconvert: fix regression preventing direct striped conversion
Conversion to striped from raid0/raid0_meta is directly possible.
Fix a regression setting superfluous interim raid5_n conversion type
introduced by commit bd7cdd0b09ba123b064937fddde08daacbed7dab.
Add new test script lvconvert-raid0-striped.sh.
Resolves: rhbz1608067
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 3 +++
test/shell/lvconvert-raid0-striped.sh | 25 +++++++++++++++++++++++++
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0a0b6e9..0ea2789 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 3.0.0
=============
+ Fix lvconvert raid0/raid0_meta -> striped regression.
Fix lvconvert --splitmirror for mirror type (2.02.178).
Do not pair cache policy and cache metadata format.
lvconvert: reject conversions on raid1 LVs with split tracked SubLVs
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 931b411..5441527 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6126,6 +6126,9 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
if (seg_from->area_count == 1)
seg_flag = SEG_RAID1;
+ else if (seg_is_any_raid0(seg_from) && segtype_is_striped(*segtype))
+ ;
+
/* If this is any raid5 conversion request -> enforce raid5_n, because we convert from striped */
else if (((segtype_is_striped(*segtype) && !segtype_is_any_raid0(*segtype)) || segtype_is_any_raid5(*segtype)) &&
!segtype_is_raid5_n(*segtype))
diff --git a/test/shell/lvconvert-raid0-striped.sh b/test/shell/lvconvert-raid0-striped.sh
new file mode 100644
index 0000000..4521b34
--- /dev/null
+++ b/test/shell/lvconvert-raid0-striped.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2018 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+aux have_raid 1 7 0 || skip
+
+aux prepare_vg 3 16
+
+lvcreate -aey --type raid0 -i 3 -l3 -n $lv $vg
+lvconvert -y --type striped $vg/$lv
+check lv_field $vg/$lv segtype "striped"
+vgremove -ff $vg
5 years, 8 months
master - radix-tree: Fix bug in remove_prefix()
by Joe Thornber
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8b05f1f230517aa4287...
Commit: 8b05f1f230517aa42878aa160d94383ed0534c64
Parent: 54668feaabead997cdf099c970999af667bcf274
Author: Joe Thornber <ejt(a)redhat.com>
AuthorDate: Mon Aug 20 15:23:40 2018 +0100
Committer: Joe Thornber <ejt(a)redhat.com>
CommitterDate: Mon Aug 20 15:23:40 2018 +0100
radix-tree: Fix bug in remove_prefix()
Accidental decrement of the nr entries when a n256 didn't have the
entry in the first place.
---
base/data-struct/radix-tree.c | 3 +
test/unit/radix_tree_t.c | 116 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 119 insertions(+), 0 deletions(-)
diff --git a/base/data-struct/radix-tree.c b/base/data-struct/radix-tree.c
index 1d24dad..1eef1f8 100644
--- a/base/data-struct/radix-tree.c
+++ b/base/data-struct/radix-tree.c
@@ -907,6 +907,9 @@ static bool _remove_subtree(struct radix_tree *rt, struct value *root, uint8_t *
case NODE256:
n256 = root->value.ptr;
+ if (n256->values[*kb].type == UNSET)
+ return true; // No entries
+
r = _remove_subtree(rt, n256->values + (*kb), kb + 1, ke, count);
if (r && n256->values[*kb].type == UNSET) {
n256->nr_entries--;
diff --git a/test/unit/radix_tree_t.c b/test/unit/radix_tree_t.c
index e5d3e98..0dde6b7 100644
--- a/test/unit/radix_tree_t.c
+++ b/test/unit/radix_tree_t.c
@@ -635,6 +635,121 @@ static void test_bcache_scenario(void *fixture)
//----------------------------------------------------------------
+static void _bcs2_step1(struct radix_tree *rt)
+{
+ unsigned i;
+ uint8_t k[12];
+ union radix_value v;
+
+ memset(k, 0, sizeof(k));
+ for (i = 0x6; i < 0x69; i++) {
+ k[0] = i;
+ v.n = i;
+ T_ASSERT(radix_tree_insert(rt, k, k + sizeof(k), v));
+ }
+ T_ASSERT(radix_tree_is_well_formed(rt));
+}
+
+static void _bcs2_step2(struct radix_tree *rt)
+{
+ unsigned i;
+ uint8_t k[12];
+
+ memset(k, 0, sizeof(k));
+ for (i = 0x6; i < 0x69; i++) {
+ k[0] = i;
+ radix_tree_remove_prefix(rt, k, k + 4);
+ }
+ T_ASSERT(radix_tree_is_well_formed(rt));
+}
+
+static void test_bcache_scenario2(void *fixture)
+{
+ unsigned i;
+ struct radix_tree *rt = fixture;
+ uint8_t k[12];
+ union radix_value v;
+
+ _bcs2_step1(rt);
+ _bcs2_step2(rt);
+
+ memset(k, 0, sizeof(k));
+ for (i = 0; i < 50; i++) {
+ k[0] = 0x6;
+ v.n = 0x6;
+ T_ASSERT(radix_tree_insert(rt, k, k + sizeof(k), v));
+ radix_tree_remove_prefix(rt, k, k + 4);
+ }
+ T_ASSERT(radix_tree_is_well_formed(rt));
+
+ _bcs2_step1(rt);
+ _bcs2_step2(rt);
+ _bcs2_step1(rt);
+ _bcs2_step2(rt);
+
+ memset(k, 0, sizeof(k));
+ for(i = 0x6; i < 0x37; i++) {
+ k[0] = i;
+ k[4] = 0xf;
+ k[5] = 0x1;
+ T_ASSERT(radix_tree_insert(rt, k, k + sizeof(k), v));
+ k[4] = 0;
+ k[5] = 0;
+ T_ASSERT(radix_tree_insert(rt, k, k + sizeof(k), v));
+ }
+ T_ASSERT(radix_tree_is_well_formed(rt));
+
+ memset(k, 0, sizeof(k));
+ for (i = 0x38; i < 0x69; i++) {
+ k[0] = i - 0x32;
+ k[4] = 0xf;
+ k[5] = 1;
+ T_ASSERT(radix_tree_remove(rt, k, k + sizeof(k)));
+
+ k[0] = i;
+ T_ASSERT(radix_tree_insert(rt, k, k + sizeof(k), v));
+
+ k[0] = i - 0x32;
+ k[4] = 0;
+ k[5] = 0;
+ T_ASSERT(radix_tree_remove(rt, k, k + sizeof(k)));
+
+ k[0] = i;
+ T_ASSERT(radix_tree_insert(rt, k, k + sizeof(k), v));
+ }
+ T_ASSERT(radix_tree_is_well_formed(rt));
+
+ memset(k, 0, sizeof(k));
+ k[0] = 0x6;
+ radix_tree_remove_prefix(rt, k, k + 4);
+ T_ASSERT(radix_tree_is_well_formed(rt));
+
+ k[0] = 0x38;
+ k[4] = 0xf;
+ k[5] = 0x1;
+ T_ASSERT(radix_tree_remove(rt, k, k + sizeof(k)));
+ T_ASSERT(radix_tree_is_well_formed(rt));
+
+ memset(k, 0, sizeof(k));
+ k[0] = 0x6;
+ T_ASSERT(radix_tree_insert(rt, k, k + sizeof(k), v));
+ T_ASSERT(radix_tree_is_well_formed(rt));
+
+ k[0] = 0x7;
+ radix_tree_remove_prefix(rt, k, k + 4);
+ T_ASSERT(radix_tree_is_well_formed(rt));
+
+ k[0] = 0x38;
+ T_ASSERT(radix_tree_remove(rt, k, k + sizeof(k)));
+ T_ASSERT(radix_tree_is_well_formed(rt));
+
+ k[0] = 7;
+ T_ASSERT(radix_tree_insert(rt, k, k + sizeof(k), v));
+ T_ASSERT(radix_tree_is_well_formed(rt));
+}
+
+//----------------------------------------------------------------
+
#define T(path, desc, fn) register_test(ts, "/base/data-struct/radix-tree/" path, desc, fn)
void radix_tree_tests(struct dm_list *all_tests)
@@ -668,6 +783,7 @@ void radix_tree_tests(struct dm_list *all_tests)
T("remove-calls-dtr", "remove should call the dtr for the value", test_remove_calls_dtr);
T("destroy-calls-dtr", "destroy should call the dtr for all values", test_destroy_calls_dtr);
T("bcache-scenario", "A specific series of keys from a bcache scenario", test_bcache_scenario);
+ T("bcache-scenario-2", "A second series of keys from a bcache scenario", test_bcache_scenario2);
dm_list_add(all_tests, &ts->list);
}
5 years, 8 months
master - tests: check policy mq can be used with format2
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=54668feaabead997cdf...
Commit: 54668feaabead997cdf099c970999af667bcf274
Parent: d1310242550e28dfe7c386a78435235955963c95
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Aug 7 15:20:31 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 7 17:59:50 2018 +0200
tests: check policy mq can be used with format2
---
test/shell/cache-metadata2.sh | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/test/shell/cache-metadata2.sh b/test/shell/cache-metadata2.sh
index 57c6e23..0270f5d 100644
--- a/test/shell/cache-metadata2.sh
+++ b/test/shell/cache-metadata2.sh
@@ -88,6 +88,12 @@ lvcreate -H -L10 -n $lv1 --cachepool $vg/cpool
check lv_field $vg/$lv1 cachemetadataformat "2"
lvremove -f $vg
+lvcreate --type cache-pool --cachepolicy mq --cachemetadataformat 1 -L1 $vg/cpool
+check lv_field $vg/cpool cachemetadataformat "1"
+lvcreate -H -L10 -n $lv1 --cachemetadataformat 2 --cachepool $vg/cpool
+check lv_field $vg/$lv1 cachemetadataformat "2"
+lvremove -f $vg
+
fi
#lvs -a -o name,cachemetadataformat,kernelmetadataformat,chunksize,cachepolicy,cachemode $vg
5 years, 8 months
master - cache: drop metadata_format validation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c34291e3bf61cc26443...
Commit: c34291e3bf61cc2644389cbce77e9953f67a843a
Parent: 9adae653e98256901897e65aa349bb83a9f9ad5c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Aug 7 10:33:19 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 7 17:57:00 2018 +0200
cache: drop metadata_format validation
Allow to use any combination of cache metadata format for policy.
---
WHATS_NEW | 1 +
lib/metadata/cache_manip.c | 5 -----
2 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2c5b5d3..2cf7969 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 3.0.0
=============
+ Do not pair cache policy and cache metadata format.
lvconvert: reject conversions on raid1 LVs with split tracked SubLVs
lvconvert: reject conversions on raid1 split tracked SubLVs
Add basic creation support for VDO target.
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 4132e2f..5ba353c 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -842,15 +842,10 @@ int cache_set_metadata_format(struct lv_segment *seg, cache_metadata_format_t fo
/*
* If policy is unselected, but format 2 is selected, policy smq is enforced.
- * ATM no other then smq & cleaner policy is allowed to select format 2.
*/
if (!seg->policy_name) {
if (format == CACHE_METADATA_FORMAT_2)
seg->policy_name = "smq";
- } else if (strcmp(seg->policy_name, "smq") &&
- strcmp(seg->policy_name, "cleaner")) {
- seg->cache_metadata_format = CACHE_METADATA_FORMAT_1;
- return 1;
}
/* Check if we need to search for configured cache metadata format */
5 years, 8 months
master - tests: splitmirror for mirror type
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d1310242550e28dfe7c...
Commit: d1310242550e28dfe7c386a78435235955963c95
Parent: acab59137869e2f8119d8faa09fdab5074b8c4b2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Aug 7 10:34:59 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 7 17:59:50 2018 +0200
tests: splitmirror for mirror type
---
test/shell/lvconvert-mirror-split.sh | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvconvert-mirror-split.sh b/test/shell/lvconvert-mirror-split.sh
new file mode 100644
index 0000000..40720a4
--- /dev/null
+++ b/test/shell/lvconvert-mirror-split.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2018 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Check --splitmirrors for mirror segtype
+
+. lib/inittest
+
+aux prepare_vg 3
+
+###########################################
+# Mirror split tests
+###########################################
+# 3-way to 2-way/linear
+lvcreate --type mirror -m 2 -l 2 -n $lv1 $vg
+aux wait_for_sync $vg $lv1
+lvconvert --splitmirrors 1 -n $lv2 -vvvv $vg/$lv1
+
+check lv_exists $vg $lv1
+check linear $vg $lv2
+check active $vg $lv2
+# FIXME: ensure no residual devices
+
+vgremove -ff $vg
5 years, 8 months
master - mirror: fix splitmirrors for mirror type
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=acab59137869e2f8119...
Commit: acab59137869e2f8119d8faa09fdab5074b8c4b2
Parent: c34291e3bf61cc2644389cbce77e9953f67a843a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Aug 7 10:34:17 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 7 17:58:30 2018 +0200
mirror: fix splitmirrors for mirror type
With improved mirror activation code --splitmirror issue poppedup
since there was missing proper preload code and deactivation
for splitted mirror leg.
---
WHATS_NEW | 1 +
lib/activate/activate.c | 5 +++++
lib/metadata/mirror.c | 2 +-
3 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2cf7969..0a0b6e9 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 3.0.0
=============
+ Fix lvconvert --splitmirror for mirror type (2.02.178).
Do not pair cache policy and cache metadata format.
lvconvert: reject conversions on raid1 LVs with split tracked SubLVs
lvconvert: reject conversions on raid1 split tracked SubLVs
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index d4a20c9..ead3b8d 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2001,6 +2001,11 @@ static int _preload_detached_lv(struct logical_volume *lv, void *data)
!lv_is_raid_metadata(lv_pre) && lv_is_active(lv) &&
!_lv_preload(lv_pre, detached->laopts, detached->flush_required))
return_0;
+ } else if (lv_is_mirror_image(lv)) {
+ if ((lv_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) &&
+ !lv_is_mirror_image(lv_pre) && lv_is_active(lv) &&
+ !_lv_preload(lv_pre, detached->laopts, detached->flush_required))
+ return_0;
}
if (!lv_is_visible(lv) && (lv_pre = find_lv(detached->lv_pre->vg, lv->name)) &&
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 58615d8..c86ff90 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -774,7 +774,7 @@ static int _split_mirror_images(struct logical_volume *lv,
act = lv_is_active(lv_lock_holder(lv));
- if (act && !_activate_lv_like_model(lv, new_lv)) {
+ if (act && (!deactivate_lv(cmd, new_lv) || !_activate_lv_like_model(lv, new_lv))) {
log_error("Failed to rename newly split LV in the kernel");
return 0;
}
5 years, 8 months
master - mirrors: fix read_only_volume_list
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9adae653e9825690189...
Commit: 9adae653e98256901897e65aa349bb83a9f9ad5c
Parent: 763219611c30d6870013b7cb84d66ec67a5dd7ec
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Aug 2 11:26:59 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 2 11:42:33 2018 -0500
mirrors: fix read_only_volume_list
If a mirror LV is listed in read_only_volume_list, it would
still be activated rw. The activation would initially be
readonly, but the monitoring function would immediately
change it to rw. This was a regression from commit
fade45b1d14c mirror: improve table update
The monitoring function needs to copy the read_only setting
into the new set of mirror activation options it uses.
---
lib/activate/activate.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 28d67b4..d4a20c9 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1740,6 +1740,8 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
if (!laopts)
laopts = &zlaopts;
+ else
+ mirr_laopts.read_only = laopts->read_only;
/* skip dmeventd code altogether */
if (dmeventd_monitor_mode() == DMEVENTD_MONITOR_IGNORE)
5 years, 8 months
master - vgcreate: close exclusive fd after pvcreate
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=763219611c30d687001...
Commit: 763219611c30d6870013b7cb84d66ec67a5dd7ec
Parent: aa464aa2f6b438092a50ca20f149557550c7147b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Aug 1 10:26:28 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Aug 1 11:22:23 2018 -0500
vgcreate: close exclusive fd after pvcreate
When vgcreate does an automatic pvcreate, it opens the
dev with O_EXCL to ensure no other subsystem is using
the device. This exclusive fd remained in bcache and
prevented activation parts of lvm from using the dev.
This appeared with vgcreate of a sanlock VG because of
the unique combination where the dev is not yet a PV,
so pvcreate is needed, and the vgcreate also creates
and activates an internal LV for sanlock.
Fix this by closing the exclusive fd after it's used
by pvcreate so that it won't interfere with other
bits of lvm that may try to use the device.
---
lib/label/label.c | 6 +++---
tools/toollib.c | 7 +++++++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/label/label.c b/lib/label/label.c
index d2c8685..9fe11f6 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1185,7 +1185,7 @@ bool dev_write_bytes(struct device *dev, uint64_t start, size_t len, void *data)
return false;
}
- if (!(dev->flags & DEV_BCACHE_WRITE)) {
+ if (_in_bcache(dev) && !(dev->flags & DEV_BCACHE_WRITE)) {
/* FIXME: avoid tossing out bcache blocks just to replace fd. */
log_debug("Close and reopen to write %s", dev_name(dev));
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
@@ -1231,7 +1231,7 @@ bool dev_write_zeros(struct device *dev, uint64_t start, size_t len)
return false;
}
- if (!(dev->flags & DEV_BCACHE_WRITE)) {
+ if (_in_bcache(dev) && !(dev->flags & DEV_BCACHE_WRITE)) {
/* FIXME: avoid tossing out bcache blocks just to replace fd. */
log_debug("Close and reopen to write %s", dev_name(dev));
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
@@ -1277,7 +1277,7 @@ bool dev_set_bytes(struct device *dev, uint64_t start, size_t len, uint8_t val)
return false;
}
- if (!(dev->flags & DEV_BCACHE_WRITE)) {
+ if (_in_bcache(dev) && !(dev->flags & DEV_BCACHE_WRITE)) {
/* FIXME: avoid tossing out bcache blocks just to replace fd. */
log_debug("Close and reopen to write %s", dev_name(dev));
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
diff --git a/tools/toollib.c b/tools/toollib.c
index 36ae125..85d44b3 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -5782,6 +5782,13 @@ do_command:
pd->name);
}
+ /*
+ * Don't keep devs open excl in bcache because the excl will prevent
+ * using that dev elsewhere.
+ */
+ dm_list_iterate_items(devl, &rescan_devs)
+ label_scan_invalidate(devl->dev);
+
dm_list_iterate_items(pd, &pp->arg_fail)
log_debug("%s: command failed for %s.",
cmd->command->name, pd->name);
5 years, 8 months