master - writecache: allow pvmove on origin
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d8bb85d9638e1b0cad9...
Commit: d8bb85d9638e1b0cad96c654a1e4a61b6d33aa97
Parent: f5a669f3145c92220346871bad4ab1c0149a1cc2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 2 14:45:52 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 2 14:45:52 2020 -0500
writecache: allow pvmove on origin
The removed check didn't actually prevent pvmoving the origin,
which was possible by naming the wcorig lv, or naming no lv.
---
test/shell/writecache-misc.sh | 80 +++++++++++++++++++++++++++++++++++++++++++
tools/pvmove.c | 5 ---
2 files changed, 80 insertions(+), 5 deletions(-)
diff --git a/test/shell/writecache-misc.sh b/test/shell/writecache-misc.sh
new file mode 100644
index 000000000..4f4c125fb
--- /dev/null
+++ b/test/shell/writecache-misc.sh
@@ -0,0 +1,80 @@
+#!/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
+
+# Test single lv cache options
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+mkfs_mount_umount()
+{
+ lvt=$1
+
+ mkfs.xfs -f -s size=4096 "$DM_DEV_DIR/$vg/$lvt"
+ mount "$DM_DEV_DIR/$vg/$lvt" "$mount_dir"
+ cp pattern1 "$mount_dir/pattern1"
+ dd if=/dev/zero of="$mount_dir/zeros2M" bs=1M count=32 conv=fdatasync
+ umount "$mount_dir"
+}
+
+mount_umount()
+{
+ lvt=$1
+
+ mount "$DM_DEV_DIR/$vg/$lvt" "$mount_dir"
+ diff pattern1 "$mount_dir/pattern1"
+ dd if="$mount_dir/zeros2M" of=/dev/null bs=1M count=32
+ umount "$mount_dir"
+}
+
+aux have_writecache 1 0 0 || skip
+which mkfs.xfs || skip
+
+mount_dir="mnt"
+mkdir -p "$mount_dir"
+
+# generate random data
+dd if=/dev/urandom of=pattern1 bs=512K count=1
+
+aux prepare_devs 4
+
+vgcreate $SHARED $vg "$dev1" "$dev2" "$dev3" "$dev4"
+
+
+#
+# Test pvmove with writecache
+#
+
+lvcreate -n $lv1 -l 16 -an $vg "$dev1" "$dev4"
+lvcreate -n $lv2 -l 4 -an $vg "$dev2"
+
+lvconvert -y --type writecache --cachevol $lv2 $vg/$lv1
+
+lvchange -ay $vg/$lv1
+mkfs_mount_umount $lv1
+
+# cannot pvmove the cachevol
+not pvmove "$dev2" "$dev3"
+
+# can pvmove the origin
+pvmove "$dev1" "$dev3"
+
+mount_umount $lv1
+
+# can pvmove the origin, naming the lv with the writecache
+pvmove -n $vg/$lv1 "$dev3" "$dev1"
+
+mount_umount $lv1
+lvchange -an $vg/$lv1
+
+vgremove -ff $vg
diff --git a/tools/pvmove.c b/tools/pvmove.c
index a346b5338..cc512b9de 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -626,11 +626,6 @@ static int _pvmove_setup_single(struct cmd_context *cmd,
return ECMD_FAILED;
}
- if (lv_is_writecache(lv)) {
- log_error("pvmove not allowed on LV using writecache.");
- return ECMD_FAILED;
- }
-
if (lv_is_raid(lv) && lv_raid_has_integrity(lv)) {
log_error("pvmove not allowed on raid LV with integrity.");
return ECMD_FAILED;
3 years, 8 months
master - pvck: repair should clear hints
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f5a669f3145c9222034...
Commit: f5a669f3145c92220346871bad4ab1c0149a1cc2
Parent: 8b9028bbe7a6f2e01ba6bddcf256d02fc11d4858
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 2 14:21:17 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 2 14:21:17 2020 -0500
pvck: repair should clear hints
repairing a pv can cause the hint file to become incorrect
---
test/shell/hints.sh | 15 +++++++++++++++
tools/pvck.c | 2 ++
2 files changed, 17 insertions(+)
diff --git a/test/shell/hints.sh b/test/shell/hints.sh
index f95505a20..176ee2176 100644
--- a/test/shell/hints.sh
+++ b/test/shell/hints.sh
@@ -338,6 +338,21 @@ pvs
not diff $HINTS $PREV
+#
+# Test pvck --repair forces refresh
+#
+
+rm $HINTS $PREV
+pvs
+cp $HINTS $PREV
+pvck --repairtype label_header -y "$dev5"
+cat $NEWHINTS
+grep 'Created empty by pvck' $HINTS
+# this next pvs creates new hints
+pvs
+# the only diff will be "Created by..."
+not diff $HINTS $PREV
+
#
# Test incorrect dev-to-pvid info in hints is detected
diff --git a/tools/pvck.c b/tools/pvck.c
index 302c74621..39449af68 100644
--- a/tools/pvck.c
+++ b/tools/pvck.c
@@ -3037,6 +3037,8 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
if (arg_is_set(cmd, repairtype_ARG) || arg_is_set(cmd, repair_ARG)) {
pv_name = argv[0];
+ clear_hint_file(cmd);
+
if (!(dev = dev_cache_get(cmd, pv_name, cmd->filter))) {
log_error("No device found for %s %s.", pv_name, dev_cache_filtered_reason(pv_name));
return ECMD_FAILED;
3 years, 8 months
master - hints: remove warning when clearing hint file
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8b9028bbe7a6f2e01ba...
Commit: 8b9028bbe7a6f2e01ba6bddcf256d02fc11d4858
Parent: d1019a6434a0ffb2b9ed63985e1895435ddeadcf
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 2 14:06:46 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 2 14:06:46 2020 -0500
hints: remove warning when clearing hint file
When the hint file cannot be accessed, silently
ignore hints, like other instances do.
---
lib/label/hints.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/label/hints.c b/lib/label/hints.c
index 8da131428..4177c678f 100644
--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -274,7 +274,7 @@ static int _clear_hints(struct cmd_context *cmd)
time_t t;
if (!(fp = fopen(_hints_file, "w"))) {
- log_warn("Failed to clear hint file.");
+ log_debug("clear_hints open errno %d", errno);
/* shouldn't happen, but try to unlink in case */
_unlink_hints();
return 0;
3 years, 8 months
master - integrity: improve lv type checks
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d1019a6434a0ffb2b9e...
Commit: d1019a6434a0ffb2b9ed63985e1895435ddeadcf
Parent: 9a7b81fb7262dbd896b74bc76a98f070a9309fed
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 2 12:40:45 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 2 12:40:45 2020 -0500
integrity: improve lv type checks
---
lib/metadata/integrity_manip.c | 52 ++++++++++++++++++++++++++----------------
1 file changed, 32 insertions(+), 20 deletions(-)
diff --git a/lib/metadata/integrity_manip.c b/lib/metadata/integrity_manip.c
index 5854a2a52..ddcce9886 100644
--- a/lib/metadata/integrity_manip.c
+++ b/lib/metadata/integrity_manip.c
@@ -155,6 +155,9 @@ int lv_extend_integrity_in_raid(struct logical_volume *lv, struct dm_list *pvh)
uint32_t meta_extents, prev_meta_extents;
uint32_t area_count, s;
+ if (!lv_is_raid(lv))
+ return_0;
+
seg_top = first_seg(lv);
if (!(segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_STRIPED)))
@@ -794,6 +797,11 @@ void lv_clear_integrity_recalculate_metadata(struct logical_volume *lv)
struct lv_segment *seg, *seg_image;
uint32_t s;
+ if (!lv_is_raid(lv) && !lv_is_integrity(lv)) {
+ log_error("Invalid LV type for clearing integrity");
+ return;
+ }
+
seg = first_seg(lv);
if (seg_is_raid(seg)) {
@@ -804,9 +812,6 @@ void lv_clear_integrity_recalculate_metadata(struct logical_volume *lv)
}
} else if (seg_is_integrity(seg)) {
seg->integrity_recalculate = 0;
- } else {
- log_error("Invalid LV type for clearing integrity");
- return;
}
if (!vg_write(vg) || !vg_commit(vg)) {
@@ -822,6 +827,9 @@ int lv_has_integrity_recalculate_metadata(struct logical_volume *lv)
uint32_t s;
int ret = 0;
+ if (!lv_is_raid(lv) && !lv_is_integrity(lv))
+ return_0;
+
seg = first_seg(lv);
if (seg_is_raid(seg)) {
@@ -847,17 +855,17 @@ int lv_raid_has_integrity(struct logical_volume *lv)
struct lv_segment *seg, *seg_image;
uint32_t s;
- if (!(seg = first_seg(lv)))
- return 0;
+ if (!lv_is_raid(lv))
+ return_0;
- if (seg_is_raid(seg)) {
- for (s = 0; s < seg->area_count; s++) {
- lv_image = seg_lv(seg, s);
- seg_image = first_seg(lv_image);
+ seg = first_seg(lv);
- if (seg_is_integrity(seg_image))
- return 1;
- }
+ for (s = 0; s < seg->area_count; s++) {
+ lv_image = seg_lv(seg, s);
+ seg_image = first_seg(lv_image);
+
+ if (seg_is_integrity(seg_image))
+ return 1;
}
return 0;
@@ -869,17 +877,18 @@ int lv_get_raid_integrity_settings(struct logical_volume *lv, struct integrity_s
struct lv_segment *seg, *seg_image;
uint32_t s;
+ if (!lv_is_raid(lv))
+ return_0;
+
seg = first_seg(lv);
- if (seg_is_raid(seg)) {
- for (s = 0; s < seg->area_count; s++) {
- lv_image = seg_lv(seg, s);
- seg_image = first_seg(lv_image);
+ for (s = 0; s < seg->area_count; s++) {
+ lv_image = seg_lv(seg, s);
+ seg_image = first_seg(lv_image);
- if (seg_is_integrity(seg_image)) {
- *isettings = &seg_image->integrity_settings;
- return 1;
- }
+ if (seg_is_integrity(seg_image)) {
+ *isettings = &seg_image->integrity_settings;
+ return 1;
}
}
@@ -892,6 +901,9 @@ int lv_integrity_mismatches(struct cmd_context *cmd,
{
struct lv_with_info_and_seg_status status;
+ if (!lv_is_integrity(lv))
+ return_0;
+
memset(&status, 0, sizeof(status));
status.seg_status.type = SEG_STATUS_NONE;
3 years, 8 months
master - integrity: fix segfault for lv with no seg
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9a7b81fb7262dbd896b...
Commit: 9a7b81fb7262dbd896b74bc76a98f070a9309fed
Parent: 739827ef1c1a256114aa0b2a385baa0983fac289
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 2 09:15:58 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 2 09:15:58 2020 -0500
integrity: fix segfault for lv with no seg
in lv_raid_has_integrity
---
lib/metadata/integrity_manip.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/metadata/integrity_manip.c b/lib/metadata/integrity_manip.c
index 6b2d352a7..5854a2a52 100644
--- a/lib/metadata/integrity_manip.c
+++ b/lib/metadata/integrity_manip.c
@@ -847,7 +847,8 @@ int lv_raid_has_integrity(struct logical_volume *lv)
struct lv_segment *seg, *seg_image;
uint32_t s;
- seg = first_seg(lv);
+ if (!(seg = first_seg(lv)))
+ return 0;
if (seg_is_raid(seg)) {
for (s = 0; s < seg->area_count; s++) {
3 years, 8 months
master - tests: add new integrity reporting fields
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=739827ef1c1a256114a...
Commit: 739827ef1c1a256114aa0b2a385baa0983fac289
Parent: ed249a2c539098aa4451b475cbf461212a93f77d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Sep 1 17:07:36 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Sep 1 17:13:46 2020 -0500
tests: add new integrity reporting fields
---
test/shell/integrity-blocksize.sh | 3 +++
test/shell/integrity-misc.sh | 2 ++
test/shell/integrity.sh | 31 +++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+)
diff --git a/test/shell/integrity-blocksize.sh b/test/shell/integrity-blocksize.sh
index eb6a364f2..61d58e2a3 100644
--- a/test/shell/integrity-blocksize.sh
+++ b/test/shell/integrity-blocksize.sh
@@ -81,6 +81,7 @@ not lvcreate --type raid1 -m1 --raidintegrity y --raidintegrityblocksize 512 -l
# lvcreate --bs 4096 on dev512, result 4k
lvcreate --type raid1 -m1 --raidintegrity y --raidintegrityblocksize 4096 -l 8 -n $lv1 $vg1
+lvs -o raidintegrityblocksize $vg1/$lv1 | grep 4096
pvck --dump metadata $LOOP1 | grep 'block_size = 4096'
lvremove -y $vg1/$lv1
@@ -184,6 +185,7 @@ aux wipefs_a /dev/$vg1/$lv1
mkfs.xfs -f -s size=4096 "$DM_DEV_DIR/$vg1/$lv1"
blkid "$DM_DEV_DIR/$vg1/$lv1" | grep BLOCK_SIZE=\"4096\"
lvconvert --raidintegrity y --raidintegrityblocksize 512 $vg1/$lv1
+lvs -o raidintegrityblocksize $vg1/$lv1 | grep 512
blkid "$DM_DEV_DIR/$vg1/$lv1" | grep BLOCK_SIZE=\"4096\"
mount "$DM_DEV_DIR/$vg1/$lv1" $mnt
umount $mnt
@@ -198,6 +200,7 @@ blkid "$DM_DEV_DIR/$vg1/$lv1" | grep BLOCK_SIZE=\"4096\"
lvchange -an $vg1/$lv1
# lv needs to be inactive to increase LBS from 512
lvconvert --raidintegrity y --raidintegrityblocksize 1024 $vg1/$lv1
+lvs -o raidintegrityblocksize $vg1/$lv1 | grep 1024
lvchange -ay $vg1/$lv1
blkid "$DM_DEV_DIR/$vg1/$lv1" | grep BLOCK_SIZE=\"4096\"
mount "$DM_DEV_DIR/$vg1/$lv1" $mnt
diff --git a/test/shell/integrity-misc.sh b/test/shell/integrity-misc.sh
index 2dae25f59..c8ec3bf49 100644
--- a/test/shell/integrity-misc.sh
+++ b/test/shell/integrity-misc.sh
@@ -145,6 +145,7 @@ lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -l 8 $vg "$dev1" "$dev2"
_wait_sync $vg/${lv1}_rimage_0
_wait_sync $vg/${lv1}_rimage_1
_wait_sync $vg/$lv1
+lvs -o raidintegritymode $vg/$lv1 | grep journal
_add_new_data_to_mnt
lvconvert --replace "$dev1" $vg/$lv1 "$dev3"
lvs -a -o+devices $vg > out
@@ -167,6 +168,7 @@ lvcreate --type raid1 -m1 --raidintegrity y --raidintegritymode bitmap -n $lv1 -
_wait_sync $vg/${lv1}_rimage_0
_wait_sync $vg/${lv1}_rimage_1
_wait_sync $vg/$lv1
+lvs -o raidintegritymode $vg/$lv1 | grep bitmap
_add_new_data_to_mnt
lvconvert --replace "$dev1" $vg/$lv1 "$dev3"
lvs -a -o+devices $vg > out
diff --git a/test/shell/integrity.sh b/test/shell/integrity.sh
index 0143129e6..f8740bc4f 100644
--- a/test/shell/integrity.sh
+++ b/test/shell/integrity.sh
@@ -104,6 +104,10 @@ _test_fs_with_raid() {
umount $mnt
lvchange -an $vg/$lv1
+ # FIXME: this is only finding/corrupting the bit with raid1
+ # other raid levels may require looking at a different dev.
+ # (Attempt this xxd/tac/sed/xxd on each dev in the LV?)
+
xxd "$dev1" > dev1.txt
tac dev1.txt > dev1.rev
sed -e '0,/4242 4242 4242 4242 4242 4242 4242 4242/ s/4242 4242 4242 4242 4242 4242 4242 4242/4242 4242 4242 4242 4242 4242 4242 4243/' dev1.rev > dev1.rev.bad
@@ -224,6 +228,8 @@ lvcreate --type raid1 -m1 --raidintegrity y -n $lv1 -l 8 $vg
_wait_recalc $vg/${lv1}_rimage_0
_wait_recalc $vg/${lv1}_rimage_1
_test_fs_with_raid
+lvs -o integritymismatches $vg/${lv1}_rimage_0
+lvs -o integritymismatches $vg/${lv1}_rimage_1
lvchange -an $vg/$lv1
lvconvert --raidintegrity n $vg/$lv1
lvremove $vg/$lv1
@@ -235,6 +241,9 @@ _wait_recalc $vg/${lv1}_rimage_0
_wait_recalc $vg/${lv1}_rimage_1
_wait_recalc $vg/${lv1}_rimage_2
_test_fs_with_raid
+lvs -o integritymismatches $vg/${lv1}_rimage_0
+lvs -o integritymismatches $vg/${lv1}_rimage_1
+lvs -o integritymismatches $vg/${lv1}_rimage_2
lvchange -an $vg/$lv1
lvconvert --raidintegrity n $vg/$lv1
lvremove $vg/$lv1
@@ -246,6 +255,9 @@ _wait_recalc $vg/${lv1}_rimage_0
_wait_recalc $vg/${lv1}_rimage_1
_wait_recalc $vg/${lv1}_rimage_2
_test_fs_with_raid
+lvs -o integritymismatches $vg/${lv1}_rimage_0
+lvs -o integritymismatches $vg/${lv1}_rimage_1
+lvs -o integritymismatches $vg/${lv1}_rimage_2
lvchange -an $vg/$lv1
lvconvert --raidintegrity n $vg/$lv1
lvremove $vg/$lv1
@@ -257,6 +269,9 @@ _wait_recalc $vg/${lv1}_rimage_0
_wait_recalc $vg/${lv1}_rimage_1
_wait_recalc $vg/${lv1}_rimage_2
_test_fs_with_raid
+lvs -o integritymismatches $vg/${lv1}_rimage_0
+lvs -o integritymismatches $vg/${lv1}_rimage_1
+lvs -o integritymismatches $vg/${lv1}_rimage_2
lvchange -an $vg/$lv1
lvconvert --raidintegrity n $vg/$lv1
lvremove $vg/$lv1
@@ -270,6 +285,11 @@ _wait_recalc $vg/${lv1}_rimage_2
_wait_recalc $vg/${lv1}_rimage_3
_wait_recalc $vg/${lv1}_rimage_4
_test_fs_with_raid
+lvs -o integritymismatches $vg/${lv1}_rimage_0
+lvs -o integritymismatches $vg/${lv1}_rimage_1
+lvs -o integritymismatches $vg/${lv1}_rimage_2
+lvs -o integritymismatches $vg/${lv1}_rimage_3
+lvs -o integritymismatches $vg/${lv1}_rimage_4
lvchange -an $vg/$lv1
lvconvert --raidintegrity n $vg/$lv1
lvremove $vg/$lv1
@@ -282,6 +302,10 @@ _wait_recalc $vg/${lv1}_rimage_1
_wait_recalc $vg/${lv1}_rimage_2
_wait_recalc $vg/${lv1}_rimage_3
_test_fs_with_raid
+lvs -o integritymismatches $vg/${lv1}_rimage_0
+lvs -o integritymismatches $vg/${lv1}_rimage_1
+lvs -o integritymismatches $vg/${lv1}_rimage_2
+lvs -o integritymismatches $vg/${lv1}_rimage_3
lvchange -an $vg/$lv1
lvconvert --raidintegrity n $vg/$lv1
lvremove $vg/$lv1
@@ -607,6 +631,8 @@ vgremove -ff $vg
_prepare_vg
lvcreate --type raid1 -m1 --raidintegrity y --raidintegritymode bitmap -n $lv1 -l 8 $vg
_test_fs_with_raid
+lvs -o integritymismatches $vg/${lv1}_rimage_0
+lvs -o integritymismatches $vg/${lv1}_rimage_1
lvchange -an $vg/$lv1
lvconvert --raidintegrity n $vg/$lv1
lvremove $vg/$lv1
@@ -615,6 +641,11 @@ vgremove -ff $vg
_prepare_vg
lvcreate --type raid6 --raidintegrity y --raidintegritymode bitmap -n $lv1 -l 8 $vg
_test_fs_with_raid
+lvs -o integritymismatches $vg/${lv1}_rimage_0
+lvs -o integritymismatches $vg/${lv1}_rimage_1
+lvs -o integritymismatches $vg/${lv1}_rimage_2
+lvs -o integritymismatches $vg/${lv1}_rimage_3
+lvs -o integritymismatches $vg/${lv1}_rimage_4
lvchange -an $vg/$lv1
lvconvert --raidintegrity n $vg/$lv1
lvremove $vg/$lv1
3 years, 8 months
master - integrity: report mismatches
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ed249a2c539098aa445...
Commit: ed249a2c539098aa4451b475cbf461212a93f77d
Parent: 47b5fb138cef3e49357af99004275f36d346b0f2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Sep 1 16:15:31 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Sep 1 17:13:21 2020 -0500
integrity: report mismatches
with lvs -o integritymismatches
reported for integrity images, which may report
different values
---
lib/metadata/integrity_manip.c | 41 ++++++++++++++++++++++++++++++++++++++++
lib/metadata/metadata-exported.h | 1 +
lib/report/columns.h | 1 +
lib/report/properties.c | 11 +++++++++++
lib/report/report.c | 15 +++++++++++++++
5 files changed, 69 insertions(+)
diff --git a/lib/metadata/integrity_manip.c b/lib/metadata/integrity_manip.c
index 290b7a863..6b2d352a7 100644
--- a/lib/metadata/integrity_manip.c
+++ b/lib/metadata/integrity_manip.c
@@ -885,3 +885,44 @@ int lv_get_raid_integrity_settings(struct logical_volume *lv, struct integrity_s
return 0;
}
+int lv_integrity_mismatches(struct cmd_context *cmd,
+ const struct logical_volume *lv,
+ uint64_t *mismatches)
+{
+ struct lv_with_info_and_seg_status status;
+
+ memset(&status, 0, sizeof(status));
+ status.seg_status.type = SEG_STATUS_NONE;
+
+ status.seg_status.seg = first_seg(lv);
+
+ /* FIXME: why reporter_pool? */
+ if (!(status.seg_status.mem = dm_pool_create("reporter_pool", 1024))) {
+ log_error("Failed to get mem for LV status.");
+ return 0;
+ }
+
+ if (!lv_info_with_seg_status(cmd, first_seg(lv), &status, 1, 1)) {
+ log_error("Failed to get device mapper status for %s", display_lvname(lv));
+ goto fail;
+ }
+
+ if (!status.info.exists)
+ goto fail;
+
+ if (status.seg_status.type != SEG_STATUS_INTEGRITY) {
+ log_error("Invalid device mapper status type (%d) for %s",
+ (uint32_t)status.seg_status.type, display_lvname(lv));
+ goto fail;
+ }
+
+ *mismatches = status.seg_status.integrity->number_of_mismatches;
+
+ dm_pool_destroy(status.seg_status.mem);
+ return 1;
+
+fail:
+ dm_pool_destroy(status.seg_status.mem);
+ return 0;
+}
+
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index e5c8e4305..670656a0f 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1415,5 +1415,6 @@ int lv_raid_has_integrity(struct logical_volume *lv);
int lv_extend_integrity_in_raid(struct logical_volume *lv, struct dm_list *pvh);
int lv_get_raid_integrity_settings(struct logical_volume *lv, struct integrity_settings **isettings);
int integrity_mode_set(const char *mode, struct integrity_settings *settings);
+int lv_integrity_mismatches(struct cmd_context *cmd, const struct logical_volume *lv, uint64_t *mismatches);
#endif
diff --git a/lib/report/columns.h b/lib/report/columns.h
index f784de5cf..426a32c50 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -86,6 +86,7 @@ FIELD(LVS, lv, NUM, "MinSync", lvid, 0, raidminrecoveryrate, raid_min_recovery_r
FIELD(LVS, lv, NUM, "MaxSync", lvid, 0, raidmaxrecoveryrate, raid_max_recovery_rate, "For RAID1, the maximum recovery I/O load in kiB/sec/disk.", 0)
FIELD(LVS, lv, STR, "IntegMode", lvid, 0, raidintegritymode, raidintegritymode, "The integrity mode", 0)
FIELD(LVS, lv, NUM, "IntegBlkSize", lvid, 0, raidintegrityblocksize, raidintegrityblocksize, "The integrity block size", 0)
+FIELD(LVS, lv, NUM, "IntegMismatches", lvid, 0, integritymismatches, integritymismatches, "The number of integrity mismatches.", 0)
FIELD(LVS, lv, STR, "Move", lvid, 0, movepv, move_pv, "For pvmove, Source PV of temporary LV created by pvmove.", 0)
FIELD(LVS, lv, STR, "Move UUID", lvid, 38, movepvuuid, move_pv_uuid, "For pvmove, the UUID of Source PV of temporary LV created by pvmove.", 0)
FIELD(LVS, lv, STR, "Convert", lvid, 0, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index baf841434..d4ac8c47e 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -121,6 +121,15 @@ static uint32_t _raidintegrityblocksize(const struct logical_volume *lv)
return settings->block_size;
}
+static uint64_t _integritymismatches(const struct logical_volume *lv)
+{
+ uint64_t cnt;
+
+ if (!lv_integrity_mismatches(lv->vg->cmd, lv, &cnt))
+ return 0;
+ return cnt;
+}
+
static dm_percent_t _snap_percent(const struct logical_volume *lv)
{
dm_percent_t percent;
@@ -434,6 +443,8 @@ GET_LV_STR_PROPERTY_FN(raidintegritymode, _raidintegritymode(lv))
#define _raidintegritymode_set prop_not_implemented_set
GET_LV_NUM_PROPERTY_FN(raidintegrityblocksize, _raidintegrityblocksize(lv))
#define _raidintegrityblocksize_set prop_not_implemented_set
+GET_LV_NUM_PROPERTY_FN(integritymismatches, _integritymismatches(lv))
+#define _integritymismatches_set prop_not_implemented_set
GET_LV_STR_PROPERTY_FN(move_pv, lv_move_pv_dup(lv->vg->vgmem, lv))
#define _move_pv_set prop_not_implemented_set
GET_LV_STR_PROPERTY_FN(move_pv_uuid, lv_move_pv_uuid_dup(lv->vg->vgmem, lv))
diff --git a/lib/report/report.c b/lib/report/report.c
index dae797dee..cd7971562 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3323,6 +3323,21 @@ static int _raidintegrityblocksize_disp(struct dm_report *rh __attribute__((unus
return dm_report_field_uint32(rh, field, &settings->block_size);
}
+static int _integritymismatches_disp(struct dm_report *rh __attribute__((unused)),
+ struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data,
+ void *private __attribute__((unused)))
+{
+ struct logical_volume *lv = (struct logical_volume *) data;
+ uint64_t mismatches = 0;
+
+ if (lv_is_integrity(lv) && lv_integrity_mismatches(lv->vg->cmd, lv, &mismatches))
+ return dm_report_field_uint64(rh, field, &mismatches);
+
+ return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_64));
+}
+
static int _datapercent_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
3 years, 8 months
master - integrity: report raidintegritymode randintegrityblocksize
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=47b5fb138cef3e49357...
Commit: 47b5fb138cef3e49357af99004275f36d346b0f2
Parent: f2c1de783cd1afc522b65f5deb45567c6cb2ffbf
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Sep 1 14:39:34 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Sep 1 17:12:36 2020 -0500
integrity: report raidintegritymode randintegrityblocksize
reported for the raid lv and the integrity images
---
lib/report/columns.h | 2 ++
lib/report/properties.c | 34 ++++++++++++++++++++++++++++++++
lib/report/report.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 88 insertions(+)
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 31a1d1702..f784de5cf 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -84,6 +84,8 @@ FIELD(LVS, lv, STR, "SyncAction", lvid, 0, raidsyncaction, raid_sync_action, "Fo
FIELD(LVS, lv, NUM, "WBehind", lvid, 0, raidwritebehind, raid_write_behind, "For RAID1, the number of outstanding writes allowed to writemostly devices.", 0)
FIELD(LVS, lv, NUM, "MinSync", lvid, 0, raidminrecoveryrate, raid_min_recovery_rate, "For RAID1, the minimum recovery I/O load in kiB/sec/disk.", 0)
FIELD(LVS, lv, NUM, "MaxSync", lvid, 0, raidmaxrecoveryrate, raid_max_recovery_rate, "For RAID1, the maximum recovery I/O load in kiB/sec/disk.", 0)
+FIELD(LVS, lv, STR, "IntegMode", lvid, 0, raidintegritymode, raidintegritymode, "The integrity mode", 0)
+FIELD(LVS, lv, NUM, "IntegBlkSize", lvid, 0, raidintegrityblocksize, raidintegrityblocksize, "The integrity block size", 0)
FIELD(LVS, lv, STR, "Move", lvid, 0, movepv, move_pv, "For pvmove, Source PV of temporary LV created by pvmove.", 0)
FIELD(LVS, lv, STR, "Move UUID", lvid, 38, movepvuuid, move_pv_uuid, "For pvmove, the UUID of Source PV of temporary LV created by pvmove.", 0)
FIELD(LVS, lv, STR, "Convert", lvid, 0, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 325750559..baf841434 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -91,6 +91,36 @@ static uint32_t _raidmaxrecoveryrate(const struct logical_volume *lv)
return first_seg(lv)->max_recovery_rate;
}
+static const char *_raidintegritymode(const struct logical_volume *lv)
+{
+ struct integrity_settings *settings;
+
+ if (lv_raid_has_integrity((struct logical_volume *)lv))
+ lv_get_raid_integrity_settings((struct logical_volume *)lv, &settings);
+ else if (lv_is_integrity(lv))
+ settings = &first_seg(lv)->integrity_settings;
+
+ if (settings->mode[0] == 'B')
+ return "bitmap";
+ if (settings->mode[0] == 'J')
+ return "journal";
+ return "unknown";
+}
+
+static uint32_t _raidintegrityblocksize(const struct logical_volume *lv)
+{
+ struct integrity_settings *settings;
+
+ if (lv_raid_has_integrity((struct logical_volume *)lv))
+ lv_get_raid_integrity_settings((struct logical_volume *)lv, &settings);
+ else if (lv_is_integrity(lv))
+ settings = &first_seg(lv)->integrity_settings;
+ else
+ return 0;
+
+ return settings->block_size;
+}
+
static dm_percent_t _snap_percent(const struct logical_volume *lv)
{
dm_percent_t percent;
@@ -400,6 +430,10 @@ GET_LV_NUM_PROPERTY_FN(raid_max_recovery_rate, _raidmaxrecoveryrate(lv))
#define _raid_max_recovery_rate_set prop_not_implemented_set
GET_LV_STR_PROPERTY_FN(raid_sync_action, _raidsyncaction(lv))
#define _raid_sync_action_set prop_not_implemented_set
+GET_LV_STR_PROPERTY_FN(raidintegritymode, _raidintegritymode(lv))
+#define _raidintegritymode_set prop_not_implemented_set
+GET_LV_NUM_PROPERTY_FN(raidintegrityblocksize, _raidintegrityblocksize(lv))
+#define _raidintegrityblocksize_set prop_not_implemented_set
GET_LV_STR_PROPERTY_FN(move_pv, lv_move_pv_dup(lv->vg->vgmem, lv))
#define _move_pv_set prop_not_implemented_set
GET_LV_STR_PROPERTY_FN(move_pv_uuid, lv_move_pv_uuid_dup(lv->vg->vgmem, lv))
diff --git a/lib/report/report.c b/lib/report/report.c
index b0d514202..dae797dee 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3271,6 +3271,58 @@ static int _raidmaxrecoveryrate_disp(struct dm_report *rh __attribute__((unused)
return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_64));
}
+static int _raidintegritymode_disp(struct dm_report *rh __attribute__((unused)),
+ struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data,
+ void *private __attribute__((unused)))
+{
+ struct logical_volume *lv = (struct logical_volume *) data;
+ struct integrity_settings *settings;
+ const char *mode = NULL;
+ char *repstr;
+
+ if (lv_raid_has_integrity(lv))
+ lv_get_raid_integrity_settings(lv, &settings);
+ else if (lv_is_integrity(lv))
+ settings = &first_seg(lv)->integrity_settings;
+
+ if (settings->mode[0]) {
+ if (settings->mode[0] == 'B')
+ mode = "bitmap";
+ else if (settings->mode[0] == 'J')
+ mode = "journal";
+
+ if (mode) {
+ if (!(repstr = dm_pool_strdup(mem, mode))) {
+ log_error("Failed to allocate buffer for mode.");
+ return 0;
+ }
+ return _field_set_value(field, repstr, NULL);
+ }
+ }
+ return _field_set_value(field, "", NULL);
+}
+
+static int _raidintegrityblocksize_disp(struct dm_report *rh __attribute__((unused)),
+ struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data,
+ void *private __attribute__((unused)))
+{
+ struct logical_volume *lv = (struct logical_volume *) data;
+ struct integrity_settings *settings;
+
+ if (lv_raid_has_integrity(lv))
+ lv_get_raid_integrity_settings(lv, &settings);
+ else if (lv_is_integrity(lv))
+ settings = &first_seg(lv)->integrity_settings;
+ else
+ return dm_report_field_int32(rh, field, &GET_TYPE_RESERVED_VALUE(num_undef_32));
+
+ return dm_report_field_uint32(rh, field, &settings->block_size);
+}
+
static int _datapercent_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
3 years, 8 months
master - integrity: always default to journal mode
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f2c1de783cd1afc522b...
Commit: f2c1de783cd1afc522b65f5deb45567c6cb2ffbf
Parent: 9a06700017bd2d97ff96854f7acbe4b1c74c2ab3
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Sep 1 12:53:00 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Sep 1 17:12:28 2020 -0500
integrity: always default to journal mode
lvconvert was defaulting to bitmap mode,
and lvcreate was defaulting to journal mode.
---
lib/metadata/integrity_manip.c | 15 +++++++++++++++
lib/metadata/metadata-exported.h | 1 +
tools/toollib.c | 14 --------------
tools/tools.h | 2 --
4 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/lib/metadata/integrity_manip.c b/lib/metadata/integrity_manip.c
index 3322a2101..290b7a863 100644
--- a/lib/metadata/integrity_manip.c
+++ b/lib/metadata/integrity_manip.c
@@ -303,6 +303,21 @@ int lv_remove_integrity_from_raid(struct logical_volume *lv)
return 1;
}
+int integrity_mode_set(const char *mode, struct integrity_settings *settings)
+{
+ if (!mode)
+ settings->mode[0] = DEFAULT_MODE;
+ else if (!strcmp(mode, "bitmap") || !strcmp(mode, "B"))
+ settings->mode[0] = 'B';
+ else if (!strcmp(mode, "journal") || !strcmp(mode, "J"))
+ settings->mode[0] = 'J';
+ else {
+ log_error("Invalid raid integrity mode (use \"bitmap\" or \"journal\")");
+ return 0;
+ }
+ return 1;
+}
+
static int _set_integrity_block_size(struct cmd_context *cmd, struct logical_volume *lv, int is_active,
struct integrity_settings *settings,
int lbs_4k, int lbs_512, int pbs_4k, int pbs_512)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index db41ca36c..e5c8e4305 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1414,5 +1414,6 @@ int lv_has_integrity_recalculate_metadata(struct logical_volume *lv);
int lv_raid_has_integrity(struct logical_volume *lv);
int lv_extend_integrity_in_raid(struct logical_volume *lv, struct dm_list *pvh);
int lv_get_raid_integrity_settings(struct logical_volume *lv, struct integrity_settings **isettings);
+int integrity_mode_set(const char *mode, struct integrity_settings *settings);
#endif
diff --git a/tools/toollib.c b/tools/toollib.c
index eb0de5501..019346ce9 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -718,20 +718,6 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
return 1;
}
-int integrity_mode_set(const char *mode, struct integrity_settings *settings)
-{
- if (!mode || !strcmp(mode, "bitmap") || !strcmp(mode, "B"))
- settings->mode[0] = 'B';
- else if (!strcmp(mode, "journal") || !strcmp(mode, "J"))
- settings->mode[0] = 'J';
- else {
- /* FIXME: the kernel has other modes, should we allow any of those? */
- log_error("Invalid raid integrity mode (use \"bitmap\" or \"journal\")");
- return 0;
- }
- return 1;
-}
-
/* Shared code for changing activation state for vgchange/lvchange */
int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
activation_change_t activate)
diff --git a/tools/tools.h b/tools/tools.h
index befff5708..a0be4bedb 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -212,8 +212,6 @@ unsigned grouped_arg_is_set(const struct arg_values *av, int a);
const char *grouped_arg_str_value(const struct arg_values *av, int a, const char *def);
int32_t grouped_arg_int_value(const struct arg_values *av, int a, const int32_t def);
-int integrity_mode_set(const char *mode, struct integrity_settings *settings);
-
const char *command_name(struct cmd_context *cmd);
int pvmove_poll(struct cmd_context *cmd, const char *pv_name, const char *uuid,
3 years, 8 months
master - tests: skip this test for current 5.8 5.9 kernels
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9a06700017bd2d97ff9...
Commit: 9a06700017bd2d97ff96854f7acbe4b1c74c2ab3
Parent: fa1290f40e17c82030d23c21af1f318688631759
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 1 23:14:47 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 1 23:40:24 2020 +0200
tests: skip this test for current 5.8 5.9 kernels
Kernel is hitting not yet fixed kernel bug.
Skip the test to avoid killing testing machine.
---
test/shell/lvconvert-raid-reshape-stripes-load-reload.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
index a38d9287b..414445244 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
@@ -21,6 +21,10 @@ which md5sum || skip
which mkfs.ext4 || skip
aux have_raid 1 13 2 || skip
+case "$(uname -r)" in
+ 5.[89]*) skip "Unfixed kernel" ;;
+esac
+
mount_dir="mnt"
cleanup_mounted_and_teardown()
3 years, 8 months