master - [WIP] tests: Use python single liner to generate data
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=02397e337a5d1bb1954...
Commit: 02397e337a5d1bb19544be4a1724aa98d1cb0008
Parent: 70a45c44e89534b6d5f9adeb04620f43453c67bf
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed May 6 12:10:50 2020 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu May 21 15:05:02 2020 +0200
[WIP] tests: Use python single liner to generate data
---
test/shell/integrity-dmeventd.sh | 7 ++++---
test/shell/integrity-large.sh | 7 ++++---
test/shell/integrity-misc.sh | 7 ++++---
test/shell/integrity.sh | 7 ++++---
4 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/test/shell/integrity-dmeventd.sh b/test/shell/integrity-dmeventd.sh
index 58899ca80..665e0e9a2 100644
--- a/test/shell/integrity-dmeventd.sh
+++ b/test/shell/integrity-dmeventd.sh
@@ -22,9 +22,10 @@ mkdir -p $mnt
aux prepare_devs 6 64
-for i in `seq 1 16384`; do echo -n "A" >> fileA; done
-for i in `seq 1 16384`; do echo -n "B" >> fileB; done
-for i in `seq 1 16384`; do echo -n "C" >> fileC; done
+PYTHON="$(which python3 python2 python | head -n 1)"
+$PYTHON -c "print 'A'*16384" >> fileA
+$PYTHON -c "print 'B'*16384" >> fileB
+$PYTHON -c "print 'C'*16384" >> fileC
# generate random data
dd if=/dev/urandom of=randA bs=512K count=2
diff --git a/test/shell/integrity-large.sh b/test/shell/integrity-large.sh
index 0c36e4d54..81fc48ec5 100644
--- a/test/shell/integrity-large.sh
+++ b/test/shell/integrity-large.sh
@@ -25,9 +25,10 @@ mkdir -p $mnt
# raid1 LV needs to be extended to 512MB to test imeta being exended
aux prepare_devs 4 600
-for i in `seq 1 16384`; do echo -n "A" >> fileA; done
-for i in `seq 1 16384`; do echo -n "B" >> fileB; done
-for i in `seq 1 16384`; do echo -n "C" >> fileC; done
+PYTHON="$(which python3 python2 python | head -n 1)"
+$PYTHON -c "print 'A'*16384" >> fileA
+$PYTHON -c "print 'B'*16384" >> fileB
+$PYTHON -c "print 'C'*16384" >> fileC
# generate random data
dd if=/dev/urandom of=randA bs=512K count=2
diff --git a/test/shell/integrity-misc.sh b/test/shell/integrity-misc.sh
index 73b0a67d8..0483885ca 100644
--- a/test/shell/integrity-misc.sh
+++ b/test/shell/integrity-misc.sh
@@ -22,9 +22,10 @@ mkdir -p $mnt
aux prepare_devs 5 64
-for i in `seq 1 16384`; do echo -n "A" >> fileA; done
-for i in `seq 1 16384`; do echo -n "B" >> fileB; done
-for i in `seq 1 16384`; do echo -n "C" >> fileC; done
+PYTHON="$(which python3 python2 python | head -n 1)"
+$PYTHON -c "print 'A'*16384" >> fileA
+$PYTHON -c "print 'B'*16384" >> fileB
+$PYTHON -c "print 'C'*16384" >> fileC
# generate random data
dd if=/dev/urandom of=randA bs=512K count=2
diff --git a/test/shell/integrity.sh b/test/shell/integrity.sh
index 7e4f2cb0b..b01920818 100644
--- a/test/shell/integrity.sh
+++ b/test/shell/integrity.sh
@@ -23,9 +23,10 @@ mkdir -p $mnt
aux prepare_devs 5 64
-for i in `seq 1 16384`; do echo -n "A" >> fileA; done
-for i in `seq 1 16384`; do echo -n "B" >> fileB; done
-for i in `seq 1 16384`; do echo -n "C" >> fileC; done
+PYTHON="$(which python3 python2 python | head -n 1)"
+$PYTHON -c "print 'A'*16384" >> fileA
+$PYTHON -c "print 'B'*16384" >> fileB
+$PYTHON -c "print 'C'*16384" >> fileC
# generate random data
dd if=/dev/urandom of=randA bs=512K count=2
3 years, 11 months
master - build: make generate
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=70a45c44e89534b6d5f...
Commit: 70a45c44e89534b6d5f9adeb04620f43453c67bf
Parent: d3b515cea54bae28c438eeef77cd3625d9b2a00c
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu May 21 15:02:31 2020 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu May 21 15:02:31 2020 +0200
build: make generate
---
man/lvconvert.8_pregen | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++
man/lvcreate.8_pregen | 53 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 116 insertions(+)
diff --git a/man/lvconvert.8_pregen b/man/lvconvert.8_pregen
index b676e724d..74409848c 100644
--- a/man/lvconvert.8_pregen
+++ b/man/lvconvert.8_pregen
@@ -162,6 +162,18 @@ lvconvert - Change logical volume layout
\fB-q\fP|\fB--quiet\fP
.ad b
.br
+.ad l
+ \fB--raidintegrity\fP \fBy\fP|\fBn\fP
+.ad b
+.br
+.ad l
+ \fB--raidintegrityblocksize\fP \fINumber\fP
+.ad b
+.br
+.ad l
+ \fB--raidintegritymode\fP \fIString\fP
+.ad b
+.br
.ad l
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
.ad b
@@ -982,6 +994,28 @@ Poll LV to continue conversion.
.br
-
+Add or remove data integrity checksums to raid images.
+.br
+.P
+\fBlvconvert\fP \fB--raidintegrity\fP \fBy\fP|\fBn\fP \fILV\fP\fI_raid\fP
+.br
+.RS 4
+.ad l
+[ \fB--raidintegritymode\fP \fIString\fP ]
+.ad b
+.br
+.ad l
+[ \fB--raidintegrityblocksize\fP \fINumber\fP ]
+.ad b
+.br
+[ COMMON_OPTIONS ]
+.RE
+.br
+.RS 4
+[ \fIPV\fP ... ]
+.RE
+-
+
Common options for command:
.
.RS 4
@@ -1405,6 +1439,35 @@ Repeat once to also suppress any prompts with answer 'no'.
.ad b
.HP
.ad l
+\fB--raidintegrity\fP \fBy\fP|\fBn\fP
+.br
+Enable or disable data integrity checksums for raid images.
+.ad b
+.HP
+.ad l
+\fB--raidintegrityblocksize\fP \fINumber\fP
+.br
+The block size to use for dm-integrity on raid images.
+The integrity block size should usually match the device
+logical block size, or the file system block size.
+It may be less than the file system block size, but not
+less than the device logical block size.
+Possible values: 512, 1024, 2048, 4096.
+.ad b
+.HP
+.ad l
+\fB--raidintegritymode\fP \fIString\fP
+.br
+Use a journal (default) or bitmap for keeping integrity checksums consistent
+in case of a crash. The bitmap areas are recalculated after a crash, so corruption
+in those areas would not be detected. A journal does not have this problem.
+The journal mode doubles writes to storage, but can improve performance for
+scattered writes packed into a single journal write.
+bitmap mode can in theory achieve full write throughput of the device,
+but would not benefit from the potential scattered write optimization.
+.ad b
+.HP
+.ad l
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
.br
Sets read ahead sector count of an LV.
diff --git a/man/lvcreate.8_pregen b/man/lvcreate.8_pregen
index a80f9f571..be8e78389 100644
--- a/man/lvcreate.8_pregen
+++ b/man/lvcreate.8_pregen
@@ -186,6 +186,18 @@ lvcreate - Create a logical volume
\fB-q\fP|\fB--quiet\fP
.ad b
.br
+.ad l
+ \fB--raidintegrity\fP \fBy\fP|\fBn\fP
+.ad b
+.br
+.ad l
+ \fB--raidintegrityblocksize\fP \fINumber\fP
+.ad b
+.br
+.ad l
+ \fB--raidintegritymode\fP \fIString\fP
+.ad b
+.br
.ad l
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
.ad b
@@ -425,6 +437,18 @@ Create a raid LV (a specific raid level must be used, e.g. raid1).
[ \fB--[raid]maxrecoveryrate\fP \fISize\fP[k|UNIT] ]
.ad b
.br
+.ad l
+[ \fB--raidintegrity\fP \fBy\fP|\fBn\fP ]
+.ad b
+.br
+.ad l
+[ \fB--raidintegritymode\fP \fIString\fP ]
+.ad b
+.br
+.ad l
+[ \fB--raidintegrityblocksize\fP \fINumber\fP ]
+.ad b
+.br
[ COMMON_OPTIONS ]
.RE
.br
@@ -1420,6 +1444,35 @@ Repeat once to also suppress any prompts with answer 'no'.
.ad b
.HP
.ad l
+\fB--raidintegrity\fP \fBy\fP|\fBn\fP
+.br
+Enable or disable data integrity checksums for raid images.
+.ad b
+.HP
+.ad l
+\fB--raidintegrityblocksize\fP \fINumber\fP
+.br
+The block size to use for dm-integrity on raid images.
+The integrity block size should usually match the device
+logical block size, or the file system block size.
+It may be less than the file system block size, but not
+less than the device logical block size.
+Possible values: 512, 1024, 2048, 4096.
+.ad b
+.HP
+.ad l
+\fB--raidintegritymode\fP \fIString\fP
+.br
+Use a journal (default) or bitmap for keeping integrity checksums consistent
+in case of a crash. The bitmap areas are recalculated after a crash, so corruption
+in those areas would not be detected. A journal does not have this problem.
+The journal mode doubles writes to storage, but can improve performance for
+scattered writes packed into a single journal write.
+bitmap mode can in theory achieve full write throughput of the device,
+but would not benefit from the potential scattered write optimization.
+.ad b
+.HP
+.ad l
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
.br
Sets read ahead sector count of an LV.
3 years, 11 months
master - tests: add wait on udev processing
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d3b515cea54bae28c43...
Commit: d3b515cea54bae28c438eeef77cd3625d9b2a00c
Parent: deb51601818ec9d2f9a29205896125c82cf6ce00
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 15 16:56:40 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 20 16:01:20 2020 +0200
tests: add wait on udev processing
Trying to avoid collision with udev watch rule preventing to
succeed 'dmsetup remove' becuase it keeps device open.
---
test/shell/thin-foreign-repair.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/test/shell/thin-foreign-repair.sh b/test/shell/thin-foreign-repair.sh
index 147a9a073..8b4018e4e 100644
--- a/test/shell/thin-foreign-repair.sh
+++ b/test/shell/thin-foreign-repair.sh
@@ -56,7 +56,9 @@ dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
mkfs.ext4 "$DM_DEV_DIR/mapper/$THIN"
-dmsetup remove "$THIN"
+aux udev_wait
+
+dmsetup remove "$THIN" || { sleep .5 ; dmsetup remove "$THIN" }
lvchange -an $vg/pool
3 years, 11 months
master - list: use container_of
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=deb51601818ec9d2f9a...
Commit: deb51601818ec9d2f9a29205896125c82cf6ce00
Parent: 16da6651a1eebd776aa461db76cecaf3997cbf50
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 15 14:41:23 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 20 16:01:20 2020 +0200
list: use container_of
Reuse macro
---
base/data-struct/list.h | 4 ++--
daemons/lvmlockd/lvmlockd-internal.h | 6 ++----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/base/data-struct/list.h b/base/data-struct/list.h
index 54cb1c10b..e0a6256a4 100644
--- a/base/data-struct/list.h
+++ b/base/data-struct/list.h
@@ -1,7 +1,7 @@
#ifndef BASE_DATA_STRUCT_LIST_H
#define BASE_DATA_STRUCT_LIST_H
-#include <stddef.h> /* offsetof */
+#include "base/memory/container_of.h"
//----------------------------------------------------------------
@@ -100,7 +100,7 @@ struct dm_list *dm_list_next(const struct dm_list *head, const struct dm_list *e
* contained in a structure of type t, return the containing structure.
*/
#define dm_list_struct_base(v, t, head) \
- ((t *)((const char *)(v) - offsetof(t, head)))
+ container_of(v, t, head)
/*
* Given the address v of an instance of 'struct dm_list list' contained in
diff --git a/daemons/lvmlockd/lvmlockd-internal.h b/daemons/lvmlockd/lvmlockd-internal.h
index 04100c0c1..191c44926 100644
--- a/daemons/lvmlockd/lvmlockd-internal.h
+++ b/daemons/lvmlockd/lvmlockd-internal.h
@@ -11,6 +11,8 @@
#ifndef _LVM_LVMLOCKD_INTERNAL_H
#define _LVM_LVMLOCKD_INTERNAL_H
+#include "base/memory/container_of.h"
+
#define MAX_NAME 64
#define MAX_ARGS 64
@@ -217,10 +219,6 @@ struct val_blk {
/* lm_unlock flags */
#define LMUF_FREE_VG 0x00000001
-#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
-
static inline void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
3 years, 11 months
master - pvck: set dump on one call
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=16da6651a1eebd776aa...
Commit: 16da6651a1eebd776aa461db76cecaf3997cbf50
Parent: cf74123830250984743d28687e66a0954510b4fa
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 15 15:05:39 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 20 15:55:39 2020 +0200
pvck: set dump on one call
arg_str_value() has built-in arg_is_set().
Also this makes it obvious to coverity 'dump != NULL' & 'repair != NULL'
at the branch code path.
---
tools/pvck.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/tools/pvck.c b/tools/pvck.c
index 71bfc1b63..a0f567eeb 100644
--- a/tools/pvck.c
+++ b/tools/pvck.c
@@ -3065,11 +3065,9 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
label_scan_setup_bcache();
- if (arg_is_set(cmd, dump_ARG)) {
+ if ((dump = arg_str_value(cmd, dump_ARG, NULL))) {
cmd->use_hints = 0;
- dump = arg_str_value(cmd, dump_ARG, NULL);
-
if (!strcmp(dump, "metadata"))
ret = _dump_metadata(cmd, dump, &set, labelsector, dev, def, PRINT_CURRENT, 0);
@@ -3096,11 +3094,9 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
return ECMD_PROCESSED;
}
- if (arg_is_set(cmd, repairtype_ARG)) {
+ if ((repair = arg_str_value(cmd, repairtype_ARG, NULL))) {
cmd->use_hints = 0;
- repair = arg_str_value(cmd, repairtype_ARG, NULL);
-
if (!strcmp(repair, "label_header"))
ret = _repair_label_header(cmd, repair, &set, labelsector, dev);
3 years, 11 months
master - cov: lvconvert: missing check for function failure
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cf74123830250984743...
Commit: cf74123830250984743d28687e66a0954510b4fa
Parent: ce8277b47ed95e71e31c933b5c6a35b24dd52756
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun May 17 18:29:54 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 20 15:55:39 2020 +0200
cov: lvconvert: missing check for function failure
---
tools/lvconvert.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index e969b4459..cf935385f 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5589,7 +5589,8 @@ static struct logical_volume *_lv_writecache_create(struct cmd_context *cmd,
memcpy(&seg->writecache_settings, settings, sizeof(struct writecache_settings));
- add_seg_to_segs_using_this_lv(lv_fast, seg);
+ if (!add_seg_to_segs_using_this_lv(lv_fast, seg))
+ return_NULL;
return lv_wcorig;
}
3 years, 11 months
master - cov: check strdup for NULL
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ce8277b47ed95e71e31...
Commit: ce8277b47ed95e71e31c933b5c6a35b24dd52756
Parent: 33fdeaf3f18c02f13fb20e9a7fe8bf99e8e21cba
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 15 17:22:18 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 20 15:55:39 2020 +0200
cov: check strdup for NULL
---
tools/command.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/command.c b/tools/command.c
index 50791b169..511dda13d 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -2319,7 +2319,8 @@ static void _print_val_man(struct command_name *cname, int opt_enum, int val_enu
}
if (strchr(str, '|')) {
- line = strdup(str);
+ if (!(line = strdup(str)))
+ return;
_split_line(line, &line_argc, line_argv, '|');
for (i = 0; i < line_argc; i++) {
if (i)
@@ -3606,9 +3607,12 @@ int main(int argc, char *argv[])
goto out_free;
}
- if (optind < argc)
- cmdname = strdup(argv[optind++]);
- else {
+ if (optind < argc) {
+ if (!(cmdname = strdup(argv[optind++]))) {
+ log_error("Out of memory.");
+ goto out_free;
+ }
+ } else {
log_error("Missing command name.");
goto out_free;
}
3 years, 11 months
master - cov: check for deactivation failure
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=33fdeaf3f18c02f13fb...
Commit: 33fdeaf3f18c02f13fb20e9a7fe8bf99e8e21cba
Parent: 2a304d7a75b572282c288c60497c7c489e7c3cbd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 15 17:44:03 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed May 20 15:55:39 2020 +0200
cov: check for deactivation failure
---
tools/vgchange.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index a10bf1165..58c8ddc84 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -991,8 +991,13 @@ static int _vgchange_locktype_single(struct cmd_context *cmd, const char *vg_nam
* deactivate it.
*/
if (vg->lock_type && !strcmp(vg->lock_type, "sanlock") &&
- (cmd->command->command_enum == vgchange_locktype_CMD))
- deactivate_lv(cmd, vg->sanlock_lv);
+ (cmd->command->command_enum == vgchange_locktype_CMD)) {
+ if (!deactivate_lv(cmd, vg->sanlock_lv)) {
+ log_error("Failed to deativate %s.",
+ display_lvname(vg->sanlock_lv));
+ return ECMD_FAILED;
+ }
+ }
log_print_unless_silent("Volume group \"%s\" successfully changed", vg->name);
3 years, 11 months
stable-2.02 - build: make generate
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7ea50a47d15dea016f2...
Commit: 7ea50a47d15dea016f252a5940c6aa5c0d598bb6
Parent: bac7d5951dd3b5b04d4532b342c1034802f0d466
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Mon May 11 18:01:15 2020 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue May 19 11:38:23 2020 +0200
build: make generate
---
conf/example.conf.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 38855e933..29b0df497 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -326,6 +326,12 @@ devices {
# Enabling this setting allows the VG to be used as usual even with
# uncertain devices.
allow_changes_with_duplicate_pvs = 0
+
+ # Configuration option devices/allow_mixed_block_sizes.
+ # Allow PVs in the same VG with different logical block sizes.
+ # When allowed, the user is responsible to ensure that an LV is
+ # using PVs with matching block sizes when necessary.
+ allow_mixed_block_sizes = 1
}
# Configuration section allocation.
3 years, 11 months
master - lvmcache: free vginfo lock_type
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2a304d7a75b572282c2...
Commit: 2a304d7a75b572282c288c60497c7c489e7c3cbd
Parent: 5c095400de2f84511726cc8178800d19657b814d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu May 14 10:20:08 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu May 14 10:20:08 2020 -0500
lvmcache: free vginfo lock_type
---
lib/cache/lvmcache.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index b8575ff62..6cb5ff0d8 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -1189,6 +1189,8 @@ static void _free_vginfo(struct lvmcache_vginfo *vginfo)
free(vginfo->vgname);
free(vginfo->system_id);
free(vginfo->creation_host);
+ if (vginfo->lock_type)
+ free(vginfo->lock_type);
free(vginfo);
}
3 years, 11 months