master - tests: skip test on failing kernel
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7bd015861d7426f39e4...
Commit: 7bd015861d7426f39e4a143236f1b991faa2bcf5
Parent: a940979ff78e06b24a6a059e5da3a35b7e4ab16d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 12 09:46:21 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Sep 12 13:24:03 2020 +0200
tests: skip test on failing kernel
---
test/shell/lvconvert-raid-reshape-stripes-load-fail.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
index 656e49818..220cd365c 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
@@ -17,6 +17,10 @@ SKIP_WITH_LVMPOLLD=1
# Test reshaping under io load
+case "$(uname -r)" in
+ 3.10.0-862*) die "Cannot run this test on unfixed kernel." ;;
+esac
+
which mkfs.ext4 || skip
aux have_raid 1 13 2 || skip
3 years, 9 months
master - cov: drop checking for EWOULDBLOCK
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a940979ff78e06b24a6...
Commit: a940979ff78e06b24a6a059e5da3a35b7e4ab16d
Parent: 740d5bf6cd39015aac086ddca98a089ba6028d72
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 12 13:15:12 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Sep 12 13:24:03 2020 +0200
cov: drop checking for EWOULDBLOCK
Reduce cov warning and remove this really ancient define
as lvm2 was never compilable on such platform.
---
libdaemon/client/daemon-io.c | 2 --
libdaemon/server/daemon-server.c | 3 +--
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/libdaemon/client/daemon-io.c b/libdaemon/client/daemon-io.c
index 1f9d84053..6b7437ecc 100644
--- a/libdaemon/client/daemon-io.c
+++ b/libdaemon/client/daemon-io.c
@@ -48,7 +48,6 @@ int buffer_read(int fd, struct buffer *buffer) {
errno = ECONNRESET;
return 0; /* we should never encounter EOF here */
} else if (result < 0 && (errno == EAGAIN ||
- (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK) ||
errno == EINTR || errno == EIO)) {
fd_set in;
FD_ZERO(&in);
@@ -78,7 +77,6 @@ int buffer_write(int fd, const struct buffer *buffer) {
if (result > 0)
written += result;
else if (result < 0 && (errno == EAGAIN ||
- (EWOULDBLOCK != EAGAIN && errno == EWOULDBLOCK) ||
errno == EINTR || errno == EIO)) {
fd_set out;
FD_ZERO(&out);
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index 0368a9446..7c1b1cf89 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -677,8 +677,7 @@ void daemon_start(daemon_state s)
perror("sigprocmask error");
if (ret < 0) {
- if (errno != EINTR && errno != EAGAIN &&
- (EWOULDBLOCK == EAGAIN || errno != EWOULDBLOCK))
+ if ((errno != EINTR) && (errno != EAGAIN))
perror("select error");
continue;
}
3 years, 9 months
master - cov: check sscanf result
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=740d5bf6cd39015aac0...
Commit: 740d5bf6cd39015aac086ddca98a089ba6028d72
Parent: a5d45b237dbb6d9c1984fd98ba84bce9bde0ea99
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 12 13:03:07 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Sep 12 13:24:03 2020 +0200
cov: check sscanf result
---
daemons/lvmlockd/lvmlockd-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index a0803de39..fea8ee6cf 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -887,8 +887,8 @@ static int read_adopt_file(struct list_head *vg_lockd)
continue;
else if (!strncmp(adopt_line, "lvmlockd", 8)) {
unsigned int v_major = 0, v_minor = 0;
- sscanf(adopt_line, "lvmlockd adopt_version %u.%u", &v_major, &v_minor);
- if (v_major != ADOPT_VERSION_MAJOR)
+ if ((sscanf(adopt_line, "lvmlockd adopt_version %u.%u", &v_major, &v_minor) != 2) ||
+ (v_major != ADOPT_VERSION_MAJOR))
goto fail;
} else if (!strncmp(adopt_line, "VG:", 3)) {
3 years, 9 months
master - cov: drop model for origin_from_cow
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a5d45b237dbb6d9c198...
Commit: a5d45b237dbb6d9c1984fd98ba84bce9bde0ea99
Parent: a9cb96f146377ff59a34a40792a9d8537ec89755
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 12 09:45:52 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Sep 12 13:23:49 2020 +0200
cov: drop model for origin_from_cow
---
coverity/coverity_model.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/coverity/coverity_model.c b/coverity/coverity_model.c
index 24a6afeef..a6840a6ed 100644
--- a/coverity/coverity_model.c
+++ b/coverity/coverity_model.c
@@ -46,6 +46,7 @@ const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile
return "STRING";
}
+/*
struct logical_volume *origin_from_cow(const struct logical_volume *lv)
{
if (lv)
@@ -53,6 +54,7 @@ struct logical_volume *origin_from_cow(const struct logical_volume *lv)
__coverity_panic__();
}
+*/
/* simple_memccpy() from glibc */
void *memccpy(void *dest, const void *src, int c, size_t n)
3 years, 9 months
master - lvconvert: check if LV has cow type
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a9cb96f146377ff59a3...
Commit: a9cb96f146377ff59a34a40792a9d8537ec89755
Parent: 463a61e62e32aa81391f40468d48d19948cd5062
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 12 12:08:15 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Sep 12 12:55:20 2020 +0200
lvconvert: check if LV has cow type
Cow may not be a COW type, the return value of origin_from_cow(cow) may be NULL.
Reported-by: Wu Guanghao <wuguanghao3(a)huawei.com>
Reported-by: Zhiqiang Liu <liuzhiqiang26(a)huawei.com>
---
tools/lvconvert.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index d420eb52f..780a81567 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1825,6 +1825,11 @@ static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volu
struct volume_group *vg = cow->vg;
const char *cow_name = display_lvname(cow);
+ if (!lv_is_cow(cow)) {
+ log_error(INTERNAL_ERROR "Volume %s is not a COW.", cow_name);
+ return 0;
+ }
+
if (lv_is_virtual_origin(origin_from_cow(cow))) {
log_error("Unable to split off snapshot %s with virtual origin.", cow_name);
return 0;
3 years, 9 months
master - revert "lvconvert: check if LV has snapshot type"
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=463a61e62e32aa81391...
Commit: 463a61e62e32aa81391f40468d48d19948cd5062
Parent: 93e252c4a30eddd642a0b2e2e9c00161f4895a0a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 12 12:07:12 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Sep 12 12:55:17 2020 +0200
revert "lvconvert: check if LV has snapshot type"
This reverts commit 7db124774a2b79105e7c9c6b42df88219fc070ca.
Actually we need to check for lv_is_cow().
---
tools/lvconvert.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 6ab8f6d2c..d420eb52f 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1825,11 +1825,6 @@ static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volu
struct volume_group *vg = cow->vg;
const char *cow_name = display_lvname(cow);
- if (!lv_is_snapshot(cow)) {
- log_error(INTERNAL_ERROR "Cow volume %s is not a snapshot.", cow_name);
- return 0;
- }
-
if (lv_is_virtual_origin(origin_from_cow(cow))) {
log_error("Unable to split off snapshot %s with virtual origin.", cow_name);
return 0;
3 years, 9 months
master - tests: check for boundary allocation sizes
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=93e252c4a30eddd642a...
Commit: 93e252c4a30eddd642a0b2e2e9c00161f4895a0a
Parent: f84a7266bc991d22572381671ced88e93dcb0a68
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 11 21:15:42 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 11 21:52:55 2020 +0200
tests: check for boundary allocation sizes
---
test/shell/lvcreate-thin-limits.sh | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/test/shell/lvcreate-thin-limits.sh b/test/shell/lvcreate-thin-limits.sh
new file mode 100644
index 000000000..101132b9c
--- /dev/null
+++ b/test/shell/lvcreate-thin-limits.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 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 allocation of thin-pool on limiting extents number
+
+SKIP_WITH_LVMPOLLD=1
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+#
+# Main
+#
+aux have_thin 1 0 0 || skip
+which mkfs.ext4 || skip
+
+aux prepare_pvs 1 16777216
+get_devs
+
+vgcreate $SHARED -s 4K "$vg" "${DEVICES[@]}"
+
+not lvcreate -T -L15.995T -vvvv --poolmetadatasize 5G $vg/pool
+
+lvs -ao+seg_pe_ranges $vg
+
+vgremove -ff $vg
3 years, 9 months
master - tests: reduce disk space usage by pvck-dump
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f84a7266bc991d22572...
Commit: f84a7266bc991d22572381671ced88e93dcb0a68
Parent: c9b40083fc34b5e2a1bfc7b251b38c0b8737483f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 11 14:44:05 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 11 21:52:55 2020 +0200
tests: reduce disk space usage by pvck-dump
Lower disk usage for 'dd'.
---
test/shell/pvck-dump.sh | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/test/shell/pvck-dump.sh b/test/shell/pvck-dump.sh
index 8892152b2..3b6344d93 100644
--- a/test/shell/pvck-dump.sh
+++ b/test/shell/pvck-dump.sh
@@ -12,16 +12,16 @@
. lib/inittest
-# 4 devs each 128MB
-aux prepare_devs 4 128
+SIZE_MB=80
+# 4 devs each $SIZE_MB
+aux prepare_devs 4 $SIZE_MB
get_devs
-dd if=/dev/zero of="$dev1" bs=1M count=2 || true
-dd if=/dev/zero of="$dev2" bs=1M count=2 || true
-dd if=/dev/zero of="$dev3" bs=1M count=2 || true
-dd if=/dev/zero of="$dev4" bs=1M count=2 || true
+dd if=/dev/zero of="$dev1" bs=1M count=2 conv=fdatasync
+dd if=/dev/zero of="$dev2" bs=1M count=2 conv=fdatasync
# clear entire dev to cover mda2
-dd if=/dev/zero of="$dev3" || true
+dd if=/dev/zero of="$dev3" bs=1M count=$SIZE_MB conv=fdatasync
+dd if=/dev/zero of="$dev4" bs=1M count=2 conv=fdatasync
pvcreate "$dev1"
pvcreate "$dev2"
@@ -135,16 +135,15 @@ diff area1 area3b
vgremove -ff $vg
-dd if=/dev/zero of="$dev1" bs=1M count=32 || true
-dd if=/dev/zero of="$dev2" bs=1M count=32 || true
-dd if=/dev/zero of="$dev3" bs=1M count=32 || true
-dd if=/dev/zero of="$dev4" bs=1M count=32 || true
# clear entire dev to cover mda2
-dd if=/dev/zero of="$dev1" || true
+dd if=/dev/zero of="$dev1" bs=1M count=$SIZE_MB conv=fdatasync
+dd if=/dev/zero of="$dev2" bs=1M count=32 conv=fdatasync
+dd if=/dev/zero of="$dev3" bs=1M count=32 conv=fdatasync
+dd if=/dev/zero of="$dev4" bs=1M count=32 conv=fdatasync
pvcreate --pvmetadatacopies 2 --metadatasize 32M "$dev1"
-vgcreate $SHARED -s 512K --metadatasize 32M $vg "$dev1" "$dev2" "$dev3" "$dev4"
+vgcreate $SHARED -s 64K --metadatasize 32M $vg "$dev1" "$dev2" "$dev3" "$dev4"
for i in $(seq 1 500); do echo "lvcreate -an -n lv$i -l1 $vg"; done | lvm
3 years, 9 months
master - tests: lower at_least to version 1.19
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c9b40083fc34b5e2a1b...
Commit: c9b40083fc34b5e2a1bfc7b251b38c0b8737483f
Parent: f233d9a909a233c5147065bb5b17a2693622b281
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 11 13:35:30 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 11 21:52:55 2020 +0200
tests: lower at_least to version 1.19
With this version already can be seen different metadata usage on
kernel side, so lower the target version.
---
test/shell/lvextend-thin-metadata-dmeventd.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/shell/lvextend-thin-metadata-dmeventd.sh b/test/shell/lvextend-thin-metadata-dmeventd.sh
index 2f16d48b5..38a405668 100644
--- a/test/shell/lvextend-thin-metadata-dmeventd.sh
+++ b/test/shell/lvextend-thin-metadata-dmeventd.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2014-2016 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014-2020 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
@@ -91,7 +91,7 @@ lvchange -an $vg/pool
# Consume more then (100% - 4MiB) out of 32MiB metadata volume (>87.5%)
# (Test for less than 4MiB free space in metadata, which is less than 25%)
DATA=7200 # Newer version of thin-pool have hidden reserve, so use lower value
-aux target_at_least dm-thin-pool 1 20 0 || DATA=7400
+aux target_at_least dm-thin-pool 1 19 0 || DATA=7400
fake_metadata_ "$DATA" 2 >data
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv2"
# Swap volume with restored fake metadata
@@ -177,7 +177,7 @@ lvchange -an $vg
#
DATA=300 # Newer version of thin-pool have hidden reserve, so use lower value
-aux target_at_least dm-thin-pool 1 20 0 || DATA=350
+aux target_at_least dm-thin-pool 1 19 0 || DATA=350
fake_metadata_ $DATA 2 >data
lvchange -ay $vg/$lv1
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv1"
3 years, 9 months
master - tests: have_cache function checks for cache-pool
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f233d9a909a233c5147...
Commit: f233d9a909a233c5147065bb5b17a2693622b281
Parent: 77fdc17d70e62cab75efaaf0dad02493b948610d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 11 11:59:55 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Sep 11 21:52:55 2020 +0200
tests: have_cache function checks for cache-pool
Check for cache-pool segment as plain cache can match writecache.
---
test/lib/aux.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 1418bb473..364b80a5c 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1625,7 +1625,7 @@ have_raid4 () {
}
have_cache() {
- lvm segtypes 2>/dev/null | grep cache$ >/dev/null || {
+ lvm segtypes 2>/dev/null | grep ' cache-pool$' >/dev/null || {
echo "Cache is not built-in." >&2
return 1
}
3 years, 9 months