master - format_text: Supply mempool directly to raw_read_mda_header.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=145ded10c29a2e76ea1...
Commit: 145ded10c29a2e76ea12aab98a797e79135d6d44
Parent: 83e1a0bad836f8950cb1e38924bf2600f118861e
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Dec 15 14:57:05 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Dec 15 14:57:05 2017 +0000
format_text: Supply mempool directly to raw_read_mda_header.
---
lib/format_text/format-text.c | 21 ++++++++++-----------
lib/format_text/layout.h | 3 +--
lib/format_text/text_label.c | 3 ++-
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 1aa91c7..ab610ad 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -196,7 +196,7 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
if (!dev_open_readonly(area->dev))
return_0;
- if (!(mdah = raw_read_mda_header(fmt, area, mda_is_primary(mda))))
+ if (!(mdah = raw_read_mda_header(fmt->cmd->mem, area, mda_is_primary(mda))))
goto_out;
rlocn = mdah->raw_locns;
@@ -370,18 +370,17 @@ static int _raw_read_mda_header(struct mda_header *mdah, struct device_area *dev
return 1;
}
-struct mda_header *raw_read_mda_header(const struct format_type *fmt,
- struct device_area *dev_area, int primary_mda)
+struct mda_header *raw_read_mda_header(struct dm_pool *mem, struct device_area *dev_area, int primary_mda)
{
struct mda_header *mdah;
- if (!(mdah = dm_pool_alloc(fmt->cmd->mem, MDA_HEADER_SIZE))) {
+ if (!(mdah = dm_pool_alloc(mem, MDA_HEADER_SIZE))) {
log_error("struct mda_header allocation failed");
return NULL;
}
if (!_raw_read_mda_header(mdah, dev_area, primary_mda)) {
- dm_pool_free(fmt->cmd->mem, mdah);
+ dm_pool_free(mem, mdah);
return NULL;
}
@@ -529,7 +528,7 @@ static int _raw_holds_vgname(struct format_instance *fid,
if (!dev_open_readonly(dev_area->dev))
return_0;
- if (!(mdah = raw_read_mda_header(fid->fmt, dev_area, 0)))
+ if (!(mdah = raw_read_mda_header(fid->fmt->cmd->mem, dev_area, 0)))
return_0;
if (_find_vg_rlocn(dev_area, mdah, 0, vgname, &noprecommit))
@@ -556,7 +555,7 @@ static struct volume_group *_vg_read_raw_area(struct format_instance *fid,
char *desc;
uint32_t wrap = 0;
- if (!(mdah = raw_read_mda_header(fid->fmt, area, primary_mda)))
+ if (!(mdah = raw_read_mda_header(fid->fmt->cmd->mem, area, primary_mda)))
goto_out;
if (!(rlocn = _find_vg_rlocn(area, mdah, primary_mda, vgname, &precommitted))) {
@@ -733,7 +732,7 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
if (!dev_open(mdac->area.dev))
return_0;
- if (!(mdah = raw_read_mda_header(fid->fmt, &mdac->area, mda_is_primary(mda))))
+ if (!(mdah = raw_read_mda_header(fid->fmt->cmd->mem, &mdac->area, mda_is_primary(mda))))
goto_out;
/* Following space is zero-filled up to the next MDA_ALIGNMENT boundary */
@@ -865,7 +864,7 @@ static int _vg_commit_raw_rlocn(struct format_instance *fid,
if (!found)
return 1;
- if (!(mdah = raw_read_mda_header(fid->fmt, &mdac->area, mda_is_primary(mda))))
+ if (!(mdah = raw_read_mda_header(fid->fmt->cmd->mem, &mdac->area, mda_is_primary(mda))))
goto_out;
if (!(rlocn = _find_vg_rlocn(&mdac->area, mdah, mda_is_primary(mda), old_vg_name ? : vg->name, &noprecommit))) {
@@ -985,7 +984,7 @@ static int _vg_remove_raw(struct format_instance *fid, struct volume_group *vg,
if (!dev_open(mdac->area.dev))
return_0;
- if (!(mdah = raw_read_mda_header(fid->fmt, &mdac->area, mda_is_primary(mda))))
+ if (!(mdah = raw_read_mda_header(fid->fmt->cmd->mem, &mdac->area, mda_is_primary(mda))))
goto_out;
if (!(rlocn = _find_vg_rlocn(&mdac->area, mdah, mda_is_primary(mda), vg->name, &noprecommit))) {
@@ -1414,7 +1413,7 @@ static int _scan_raw(const struct format_type *fmt, const char *vgname __attribu
continue;
}
- if (!(mdah = raw_read_mda_header(fmt, &rl->dev_area, 0))) {
+ if (!(mdah = raw_read_mda_header(fmt->cmd->mem, &rl->dev_area, 0))) {
stack;
goto close_dev;
}
diff --git a/lib/format_text/layout.h b/lib/format_text/layout.h
index bc25597..c0906a6 100644
--- a/lib/format_text/layout.h
+++ b/lib/format_text/layout.h
@@ -81,8 +81,7 @@ struct mda_header {
struct raw_locn raw_locns[0]; /* NULL-terminated list */
} __attribute__ ((packed));
-struct mda_header *raw_read_mda_header(const struct format_type *fmt,
- struct device_area *dev_area, int primary_mda);
+struct mda_header *raw_read_mda_header(struct dm_pool *mem, struct device_area *dev_area, int primary_mda);
struct mda_lists {
struct dm_list dirs;
diff --git a/lib/format_text/text_label.c b/lib/format_text/text_label.c
index 7058f70..d5e4820 100644
--- a/lib/format_text/text_label.c
+++ b/lib/format_text/text_label.c
@@ -19,6 +19,7 @@
#include "label.h"
#include "xlate.h"
#include "lvmcache.h"
+#include "toolcontext.h"
#include <sys/stat.h>
#include <fcntl.h>
@@ -344,7 +345,7 @@ static int _update_mda(struct metadata_area *mda, void *baton)
return 1;
}
- if (!(mdah = raw_read_mda_header(fmt, &mdac->area, mda_is_primary(mda)))) {
+ if (!(mdah = raw_read_mda_header(fmt->cmd->mem, &mdac->area, mda_is_primary(mda)))) {
stack;
goto close_dev;
}
6 years, 4 months
master - lvm2app: Suppress deprecation warnings for our builds
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=83e1a0bad836f8950cb...
Commit: 83e1a0bad836f8950cb1e38924bf2600f118861e
Parent: c957d46f1d73891e3a7e9c1482c1d4a39ca0e79a
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Dec 14 13:49:33 2017 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Dec 14 16:45:53 2017 +0100
lvm2app: Suppress deprecation warnings for our builds
---
liblvm/lvm2app.h | 2 ++
make.tmpl.in | 2 ++
python/liblvm.c | 1 +
3 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h
index f64262d..10ecd2e 100644
--- a/liblvm/lvm2app.h
+++ b/liblvm/lvm2app.h
@@ -18,7 +18,9 @@
#include <stdint.h>
+#ifndef _BUILDING_LVM
#warning "liblvm2app is deprecated, use D-Bus API instead."
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/make.tmpl.in b/make.tmpl.in
index 65362d8..bdf2349 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -261,6 +261,8 @@ endif
# end of fPIC protection
endif
+DEFS += -D_BUILDING_LVM
+
LDFLAGS += -L$(top_builddir)/libdm -L$(top_builddir)/lib
CLDFLAGS += -L$(top_builddir)/libdm -L$(top_builddir)/lib
diff --git a/python/liblvm.c b/python/liblvm.c
index 6d67b8b..06120e6 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -22,6 +22,7 @@
*/
#include <Python.h>
+#define _BUILDING_LVM
#include "lvm2app.h"
#include "defaults.h"
6 years, 4 months
master - lvmdbusd: Make lvmdbusd executable
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c957d46f1d73891e3a7...
Commit: c957d46f1d73891e3a7e9c1482c1d4a39ca0e79a
Parent: c48d22bd3cddfe540413ed591ea18399c571a852
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Dec 14 13:40:05 2017 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Dec 14 16:45:53 2017 +0100
lvmdbusd: Make lvmdbusd executable
- Add files built from *.in to builddir files.
- Add all files built from *.in to DISTCLEAN_TARGETS.
---
daemons/lvmdbusd/Makefile.in | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/daemons/lvmdbusd/Makefile.in b/daemons/lvmdbusd/Makefile.in
index 0d52406..7cd7724 100644
--- a/daemons/lvmdbusd/Makefile.in
+++ b/daemons/lvmdbusd/Makefile.in
@@ -26,9 +26,7 @@ LVMDBUS_SRCDIR_FILES = \
__init__.py \
job.py \
loader.py \
- lvmdb.py \
main.py \
- lvm_shell_proxy.py \
lv.py \
manager.py \
objectmanager.py \
@@ -40,14 +38,19 @@ LVMDBUS_SRCDIR_FILES = \
vg.py
LVMDBUS_BUILDDIR_FILES = \
+ lvmdb.py \
+ lvm_shell_proxy.py \
path.py
-LVMDBUSD = $(srcdir)/lvmdbusd
+LVMDBUSD = lvmdbusd
include $(top_builddir)/make.tmpl
.PHONY: install_lvmdbusd
+all:
+ test -x $(LVMDBUSD) || chmod 755 $(LVMDBUSD)
+
install_lvmdbusd:
$(INSTALL_DIR) $(sbindir)
$(INSTALL_SCRIPT) $(LVMDBUSD) $(sbindir)
@@ -63,4 +66,5 @@ install_lvm2: install_lvmdbusd
install: install_lvm2
DISTCLEAN_TARGETS+= \
- $(LVMDBUS_BUILDDIR_FILES)
+ $(LVMDBUS_BUILDDIR_FILES) \
+ $(LVMDBUSD)
6 years, 4 months
master - docs: Add TESTING file
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c48d22bd3cddfe54041...
Commit: c48d22bd3cddfe540413ed591ea18399c571a852
Parent: 584ff361dff9dc27a05839ac179899a80007b56e
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Dec 14 15:42:34 2017 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Dec 14 16:45:47 2017 +0100
docs: Add TESTING file
---
TESTING | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/TESTING b/TESTING
new file mode 100644
index 0000000..57932f5
--- /dev/null
+++ b/TESTING
@@ -0,0 +1,62 @@
+LVM2 Test Suite
+===============
+
+The codebase contains many tests in the test subdirectory.
+
+Before running tests
+--------------------
+
+Keep in mind the testsuite MUST run under root user.
+
+It is recommended not to use LVM on the test machine, especially when running
+tests with udev (`make check_system`.)
+
+You MUST disable (or mask) any LVM daemons:
+
+- lvmetad
+- dmeventd
+- lvmpolld
+- lvmdbusd
+- lvmlockd
+- clvmd
+- cmirrord
+
+For running cluster tests, we are using singlenode locking. Pass
+`--with-clvmd=singlenode` to configure.
+
+NOTE: This is useful only for testing, and should not be used in produciton
+code.
+
+To run D-Bus daemon tests, existing D-Bus session is required.
+
+Running tests
+-------------
+
+As root run:
+
+ make check
+
+To run only tests matching a string:
+
+ make check T=test
+
+To skip tests matching a string:
+
+ make check S=test
+
+There are other targets and many environment variables can be used to tweak the
+testsuite - for full list and description run `make -C test help`.
+
+Installing testsuite
+--------------------
+
+It is possible to install and run a testsuite against installed LVM. Run the
+following:
+
+ make -C test install
+
+Then lvm2-testsuite binary can be executed to test installed binaries.
+
+See `lvm2-testsuite --help` for options. The same environment variables can be
+used as with `make check`.
+
6 years, 4 months
master - test: fix trap adding proper teardown to previous, new raid tests
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=584ff361dff9dc27a05...
Commit: 584ff361dff9dc27a05839ac179899a80007b56e
Parent: 86fa0333fffe89547263f8b46b291d19726e7cca
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Dec 13 14:39:06 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Dec 13 14:41:23 2017 +0100
test: fix trap adding proper teardown to previous, new raid tests
Also remove superfluous variable.
---
test/shell/lvconvert-raid-reshape-load.sh | 25 ++++++++++--------
.../lvconvert-raid-reshape-stripes-load-fail.sh | 27 +++++++++++---------
.../lvconvert-raid-reshape-stripes-load-reload.sh | 25 ++++++++++--------
test/shell/lvconvert-raid-reshape-stripes-load.sh | 25 ++++++++++--------
4 files changed, 57 insertions(+), 45 deletions(-)
diff --git a/test/shell/lvconvert-raid-reshape-load.sh b/test/shell/lvconvert-raid-reshape-load.sh
index 55e2ad4..d17b186 100644
--- a/test/shell/lvconvert-raid-reshape-load.sh
+++ b/test/shell/lvconvert-raid-reshape-load.sh
@@ -13,8 +13,6 @@
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
-LVM_SKIP_LARGE_TESTS=1
-
. lib/inittest
# Test reshaping under io load
@@ -22,9 +20,13 @@ LVM_SKIP_LARGE_TESTS=1
which mkfs.ext4 || skip
aux have_raid 1 13 1 || skip
-mpoint=/tmp/mpoint.$$
+mount_dir="mnt"
-trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
+cleanup_mounted_and_teardown()
+{
+ umount "$mount_dir" || true
+ aux teardown
+}
aux prepare_pvs 16 32
@@ -32,6 +34,8 @@ get_devs
vgcreate -s 1M "$vg" "${DEVICES[@]}"
+trap 'cleanup_mounted_and_teardown' EXIT
+
# Create 13-way striped raid5 (14 legs total)
lvcreate --yes --type raid5_ls --stripes 13 -L190M -n$lv1 $vg
check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
@@ -40,15 +44,15 @@ check lv_first_seg_field $vg/$lv1 stripes 14
echo y|mkfs -t ext4 /dev/$vg/$lv1
aux wait_for_sync $vg $lv1
-mkdir -p $mpoint
-mount "$DM_DEV_DIR/$vg/$lv1" $mpoint
-mkdir -p $mpoint/1 $mpoint/2
+mkdir -p $mount_dir
+mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
+mkdir -p $mount_dir/1 $mount_dir/2
aux delay_dev "$dev2" 0 100
echo 3 >/proc/sys/vm/drop_caches
-cp -r /usr/bin $mpoint/1 >/dev/null 2>/dev/null &
-cp -r /usr/bin $mpoint/2 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mount_dir/1 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mount_dir/2 >/dev/null 2>/dev/null &
sync &
# Reshape it to 256K stripe size
@@ -59,8 +63,7 @@ check lv_first_seg_field $vg/$lv1 stripesize "256.00k"
kill -9 %%
wait
-umount $mpoint
-[ -d $mpoint ] && rmdir $mpoint
+umount $mount_dir
fsck -fn "$DM_DEV_DIR/$vg/$lv1"
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
index 96bea52..38af778 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
@@ -13,8 +13,6 @@
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
-LVM_SKIP_LARGE_TESTS=1
-
. lib/inittest
# Test reshaping under io load
@@ -22,9 +20,13 @@ LVM_SKIP_LARGE_TESTS=1
which mkfs.ext4 || skip
aux have_raid 1 13 1 || skip
-mpoint=/tmp/mpoint.$$
+mount_dir="mnt"
-trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
+cleanup_mounted_and_teardown()
+{
+ umount "$mount_dir" || true
+ aux teardown
+}
aux prepare_pvs 16 32
@@ -32,6 +34,8 @@ get_devs
vgcreate -s 1M "$vg" "${DEVICES[@]}"
+trap 'cleanup_mounted_and_teardown' EXIT
+
# Create 13-way striped raid5 (14 legs total)
lvcreate --yes --type raid5_ls --stripesize 64K --stripes 10 -L200M -n$lv1 $vg
check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
@@ -40,14 +44,14 @@ check lv_first_seg_field $vg/$lv1 data_stripes 10
check lv_first_seg_field $vg/$lv1 stripes 11
echo y|mkfs -t ext4 /dev/$vg/$lv1
-mkdir -p $mpoint
-mount "$DM_DEV_DIR/$vg/$lv1" $mpoint
-mkdir -p $mpoint/1 $mpoint/2
+mkdir -p $mount_dir
+mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
+mkdir -p $mount_dir/1 $mount_dir/2
echo 3 >/proc/sys/vm/drop_caches
-cp -r /usr/bin $mpoint/1 >/dev/null 2>/dev/null &
-cp -r /usr/bin $mpoint/2 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mount_dir/1 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mount_dir/2 >/dev/null 2>/dev/null &
sync &
aux wait_for_sync $vg $lv1
@@ -62,13 +66,12 @@ check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
check lv_first_seg_field $vg/$lv1 data_stripes 15
check lv_first_seg_field $vg/$lv1 stripes 16
-rm -fr $mpoint/2
+rm -fr $mount_dir/2
sync
kill -9 %%
wait
-umount $mpoint
-[ -d $mpoint ] && rmdir $mpoint
+umount $mount_dir
fsck -fn "$DM_DEV_DIR/$vg/$lv1"
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
index 9ca3ded..f0a71c3 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
@@ -13,8 +13,6 @@
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
-LVM_SKIP_LARGE_TESTS=1
-
. lib/inittest
# Test reshaping under io load
@@ -22,9 +20,13 @@ LVM_SKIP_LARGE_TESTS=1
which mkfs.ext4 || skip
aux have_raid 1 13 2 || skip
-mpoint=/tmp/mpoint.$$
+mount_dir="mnt"
-trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
+cleanup_mounted_and_teardown()
+{
+ umount "$mount_dir" || true
+ aux teardown
+}
aux prepare_pvs 16 32
@@ -32,6 +34,8 @@ get_devs
vgcreate -s 1M "$vg" "${DEVICES[@]}"
+trap 'cleanup_mounted_and_teardown' EXIT
+
# Create 13-way striped raid5 (14 legs total)
lvcreate --yes --type raid5_ls --stripesize 64K --stripes 10 -L200M -n$lv1 $vg
check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
@@ -40,13 +44,13 @@ check lv_first_seg_field $vg/$lv1 data_stripes 10
check lv_first_seg_field $vg/$lv1 stripes 11
echo y|mkfs -t ext4 /dev/$vg/$lv1
-mkdir -p $mpoint
-mount "$DM_DEV_DIR/$vg/$lv1" $mpoint
-mkdir -p $mpoint/1 $mpoint/2
+mkdir -p $mount_dir
+mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
+mkdir -p $mount_dir/1 $mount_dir/2
echo 3 >/proc/sys/vm/drop_caches
-cp -r /usr/bin $mpoint/1 >/dev/null 2>/dev/null &
-cp -r /usr/bin $mpoint/2 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mount_dir/1 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mount_dir/2 >/dev/null 2>/dev/null &
sync &
aux wait_for_sync $vg $lv1
@@ -73,8 +77,7 @@ aux delay_dev "$dev2" 0
kill -9 %%
wait
-umount $mpoint
-[ -d $mpoint ] && rmdir $mpoint
+umount $mount_dir
fsck -fn "$DM_DEV_DIR/$vg/$lv1"
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load.sh b/test/shell/lvconvert-raid-reshape-stripes-load.sh
index 53bba2e..785ee76 100644
--- a/test/shell/lvconvert-raid-reshape-stripes-load.sh
+++ b/test/shell/lvconvert-raid-reshape-stripes-load.sh
@@ -13,8 +13,6 @@
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
-LVM_SKIP_LARGE_TESTS=1
-
. lib/inittest
# Test reshaping under io load
@@ -22,9 +20,13 @@ LVM_SKIP_LARGE_TESTS=1
which mkfs.ext4 || skip
aux have_raid 1 13 1 || skip
-mpoint=/tmp/mpoint.$$
+mount_dir="mnt"
-trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
+cleanup_mounted_and_teardown()
+{
+ umount "$mount_dir" || true
+ aux teardown
+}
aux prepare_pvs 16 32
@@ -32,6 +34,8 @@ get_devs
vgcreate -s 1M "$vg" "${DEVICES[@]}"
+trap 'cleanup_mounted_and_teardown' EXIT
+
# Create 13-way striped raid5 (14 legs total)
lvcreate --yes --type raid5_ls --stripesize 64K --stripes 10 -L200M -n$lv1 $vg
check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
@@ -40,14 +44,14 @@ check lv_first_seg_field $vg/$lv1 data_stripes 10
check lv_first_seg_field $vg/$lv1 stripes 11
echo y|mkfs -t ext4 /dev/$vg/$lv1
-mkdir -p $mpoint
-mount "$DM_DEV_DIR/$vg/$lv1" $mpoint
-mkdir -p $mpoint/1 $mpoint/2
+mkdir -p $mount_dir
+mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
+mkdir -p $mount_dir/1 $mount_dir/2
echo 3 >/proc/sys/vm/drop_caches
-cp -r /usr/bin $mpoint/1 >/dev/null 2>/dev/null &
-cp -r /usr/bin $mpoint/2 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mount_dir/1 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mount_dir/2 >/dev/null 2>/dev/null &
sync &
aux wait_for_sync $vg $lv1
@@ -64,8 +68,7 @@ check lv_first_seg_field $vg/$lv1 stripes 16
kill -9 %%
wait
-umount $mpoint
-[ -d $mpoint ] && rmdir $mpoint
+umount $mount_dir
fsck -fn "$DM_DEV_DIR/$vg/$lv1"
6 years, 4 months
master - test: new raid tests
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=86fa0333fffe8954726...
Commit: 86fa0333fffe89547263f8b46b291d19726e7cca
Parent: 3edc25dbdfc5d8d5ba109921dae87c5415a0b460
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Dec 13 02:55:06 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Dec 13 13:30:53 2017 +0100
test: new raid tests
Add three new raid tests with io load and table
reloads during reshape for target 1.13.2.
Add a raid0 to raid10 conversion test.
Also add more signals to trap in lvconvert-raid-reshape-load.sh.
---
test/shell/lvconvert-raid-reshape-load.sh | 2 +-
.../lvconvert-raid-reshape-stripes-load-fail.sh | 75 ++++++++++++++++++
.../lvconvert-raid-reshape-stripes-load-reload.sh | 81 ++++++++++++++++++++
test/shell/lvconvert-raid-reshape-stripes-load.sh | 72 +++++++++++++++++
test/shell/lvconvert-raid0_to_raid10.sh | 32 ++++++++
5 files changed, 261 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-raid-reshape-load.sh b/test/shell/lvconvert-raid-reshape-load.sh
index 4ccf01f..55e2ad4 100644
--- a/test/shell/lvconvert-raid-reshape-load.sh
+++ b/test/shell/lvconvert-raid-reshape-load.sh
@@ -24,7 +24,7 @@ aux have_raid 1 13 1 || skip
mpoint=/tmp/mpoint.$$
-trap "[ -d $mpoint ] && rmdir $mpoint" 15
+trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
aux prepare_pvs 16 32
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
new file mode 100644
index 0000000..96bea52
--- /dev/null
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
@@ -0,0 +1,75 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+LVM_SKIP_LARGE_TESTS=1
+
+. lib/inittest
+
+# Test reshaping under io load
+
+which mkfs.ext4 || skip
+aux have_raid 1 13 1 || skip
+
+mpoint=/tmp/mpoint.$$
+
+trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
+
+aux prepare_pvs 16 32
+
+get_devs
+
+vgcreate -s 1M "$vg" "${DEVICES[@]}"
+
+# Create 13-way striped raid5 (14 legs total)
+lvcreate --yes --type raid5_ls --stripesize 64K --stripes 10 -L200M -n$lv1 $vg
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 10
+check lv_first_seg_field $vg/$lv1 stripes 11
+echo y|mkfs -t ext4 /dev/$vg/$lv1
+
+mkdir -p $mpoint
+mount "$DM_DEV_DIR/$vg/$lv1" $mpoint
+mkdir -p $mpoint/1 $mpoint/2
+
+
+echo 3 >/proc/sys/vm/drop_caches
+cp -r /usr/bin $mpoint/1 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mpoint/2 >/dev/null 2>/dev/null &
+sync &
+
+aux wait_for_sync $vg $lv1
+aux delay_dev "$dev2" 0 100
+
+# Reshape it to 15 data stripes
+lvconvert --yes --stripes 15 $vg/$lv1
+aux disable_dev $dev1
+aux delay_dev "$dev2" 0 0
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 15
+check lv_first_seg_field $vg/$lv1 stripes 16
+
+rm -fr $mpoint/2
+sync
+kill -9 %%
+wait
+
+umount $mpoint
+[ -d $mpoint ] && rmdir $mpoint
+
+fsck -fn "$DM_DEV_DIR/$vg/$lv1"
+
+vgremove -ff $vg
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
new file mode 100644
index 0000000..9ca3ded
--- /dev/null
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
@@ -0,0 +1,81 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+LVM_SKIP_LARGE_TESTS=1
+
+. lib/inittest
+
+# Test reshaping under io load
+
+which mkfs.ext4 || skip
+aux have_raid 1 13 2 || skip
+
+mpoint=/tmp/mpoint.$$
+
+trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
+
+aux prepare_pvs 16 32
+
+get_devs
+
+vgcreate -s 1M "$vg" "${DEVICES[@]}"
+
+# Create 13-way striped raid5 (14 legs total)
+lvcreate --yes --type raid5_ls --stripesize 64K --stripes 10 -L200M -n$lv1 $vg
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 10
+check lv_first_seg_field $vg/$lv1 stripes 11
+echo y|mkfs -t ext4 /dev/$vg/$lv1
+
+mkdir -p $mpoint
+mount "$DM_DEV_DIR/$vg/$lv1" $mpoint
+mkdir -p $mpoint/1 $mpoint/2
+
+echo 3 >/proc/sys/vm/drop_caches
+cp -r /usr/bin $mpoint/1 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mpoint/2 >/dev/null 2>/dev/null &
+sync &
+
+aux wait_for_sync $vg $lv1
+aux delay_dev "$dev2" 0 200
+
+# Reshape it to 15 data stripes
+lvconvert --yes --stripes 15 $vg/$lv1
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 15
+check lv_first_seg_field $vg/$lv1 stripes 16
+
+# Reload table during reshape to test for data corruption
+for i in {0..5}
+do
+ dmsetup table $vg-$lv1|dmsetup load $vg-$lv1
+ dmsetup suspend --noflush $vg-$lv1
+ dmsetup resume $vg-$lv1
+ sleep 0.3
+done
+
+aux delay_dev "$dev2" 0
+
+kill -9 %%
+wait
+
+umount $mpoint
+[ -d $mpoint ] && rmdir $mpoint
+
+fsck -fn "$DM_DEV_DIR/$vg/$lv1"
+
+vgremove -ff $vg
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load.sh b/test/shell/lvconvert-raid-reshape-stripes-load.sh
new file mode 100644
index 0000000..53bba2e
--- /dev/null
+++ b/test/shell/lvconvert-raid-reshape-stripes-load.sh
@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+LVM_SKIP_LARGE_TESTS=1
+
+. lib/inittest
+
+# Test reshaping under io load
+
+which mkfs.ext4 || skip
+aux have_raid 1 13 1 || skip
+
+mpoint=/tmp/mpoint.$$
+
+trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
+
+aux prepare_pvs 16 32
+
+get_devs
+
+vgcreate -s 1M "$vg" "${DEVICES[@]}"
+
+# Create 13-way striped raid5 (14 legs total)
+lvcreate --yes --type raid5_ls --stripesize 64K --stripes 10 -L200M -n$lv1 $vg
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 10
+check lv_first_seg_field $vg/$lv1 stripes 11
+echo y|mkfs -t ext4 /dev/$vg/$lv1
+
+mkdir -p $mpoint
+mount "$DM_DEV_DIR/$vg/$lv1" $mpoint
+mkdir -p $mpoint/1 $mpoint/2
+
+
+echo 3 >/proc/sys/vm/drop_caches
+cp -r /usr/bin $mpoint/1 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mpoint/2 >/dev/null 2>/dev/null &
+sync &
+
+aux wait_for_sync $vg $lv1
+aux delay_dev "$dev2" 0 100
+
+# Reshape it to 15 data stripes
+lvconvert --yes --stripes 15 $vg/$lv1
+aux delay_dev "$dev2" 0 0
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 15
+check lv_first_seg_field $vg/$lv1 stripes 16
+
+kill -9 %%
+wait
+
+umount $mpoint
+[ -d $mpoint ] && rmdir $mpoint
+
+fsck -fn "$DM_DEV_DIR/$vg/$lv1"
+
+vgremove -ff $vg
diff --git a/test/shell/lvconvert-raid0_to_raid10.sh b/test/shell/lvconvert-raid0_to_raid10.sh
new file mode 100644
index 0000000..d1e1fa0
--- /dev/null
+++ b/test/shell/lvconvert-raid0_to_raid10.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+# rhbz1514500
+
+aux have_raid 1 12 0 || skip
+
+# 8 PVs needed for RAID10 testing (4-stripes/2-mirror)
+aux prepare_pvs 8 64
+get_devs
+vgcreate -s 256k "$vg" "${DEVICES[@]}"
+
+lvcreate -y --ty raid0 -R32.00k -i 4 -n $lv1 -L 64M $vg
+lvcreate -y -i4 -l4 -n $lv2 $vg
+lvextend -y -l +4 $vg/$lv1
+lvconvert -y -R512K --ty raid10 $vg/$lv1
+
+vgremove -ff $vg
6 years, 4 months
master - test: new raid tests
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2883570a8c8ce0480e7...
Commit: 2883570a8c8ce0480e7ccf328784b181dfbba0a0
Parent: 3edc25dbdfc5d8d5ba109921dae87c5415a0b460
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Dec 13 02:55:06 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Dec 13 02:57:57 2017 +0100
test: new raid tests
Add three new raid tests with io load and table
reloads during reshape for target 1.13.2.
Add a raid0 to raid10 conversion test.
Also add more signal to trap in lvconvert-raid-reshape-load.sh.
---
test/shell/lvconvert-raid-reshape-load.sh | 2 +-
.../lvconvert-raid-reshape-stripes-load-fail.sh | 75 ++++++++++++++++++
.../lvconvert-raid-reshape-stripes-load-reload.sh | 81 ++++++++++++++++++++
test/shell/lvconvert-raid-reshape-stripes-load.sh | 72 +++++++++++++++++
test/shell/lvconvert-raid0_to_raid10.sh | 32 ++++++++
5 files changed, 261 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvconvert-raid-reshape-load.sh b/test/shell/lvconvert-raid-reshape-load.sh
index 4ccf01f..55e2ad4 100644
--- a/test/shell/lvconvert-raid-reshape-load.sh
+++ b/test/shell/lvconvert-raid-reshape-load.sh
@@ -24,7 +24,7 @@ aux have_raid 1 13 1 || skip
mpoint=/tmp/mpoint.$$
-trap "[ -d $mpoint ] && rmdir $mpoint" 15
+trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
aux prepare_pvs 16 32
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
new file mode 100644
index 0000000..96bea52
--- /dev/null
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-fail.sh
@@ -0,0 +1,75 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+LVM_SKIP_LARGE_TESTS=1
+
+. lib/inittest
+
+# Test reshaping under io load
+
+which mkfs.ext4 || skip
+aux have_raid 1 13 1 || skip
+
+mpoint=/tmp/mpoint.$$
+
+trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
+
+aux prepare_pvs 16 32
+
+get_devs
+
+vgcreate -s 1M "$vg" "${DEVICES[@]}"
+
+# Create 13-way striped raid5 (14 legs total)
+lvcreate --yes --type raid5_ls --stripesize 64K --stripes 10 -L200M -n$lv1 $vg
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 10
+check lv_first_seg_field $vg/$lv1 stripes 11
+echo y|mkfs -t ext4 /dev/$vg/$lv1
+
+mkdir -p $mpoint
+mount "$DM_DEV_DIR/$vg/$lv1" $mpoint
+mkdir -p $mpoint/1 $mpoint/2
+
+
+echo 3 >/proc/sys/vm/drop_caches
+cp -r /usr/bin $mpoint/1 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mpoint/2 >/dev/null 2>/dev/null &
+sync &
+
+aux wait_for_sync $vg $lv1
+aux delay_dev "$dev2" 0 100
+
+# Reshape it to 15 data stripes
+lvconvert --yes --stripes 15 $vg/$lv1
+aux disable_dev $dev1
+aux delay_dev "$dev2" 0 0
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 15
+check lv_first_seg_field $vg/$lv1 stripes 16
+
+rm -fr $mpoint/2
+sync
+kill -9 %%
+wait
+
+umount $mpoint
+[ -d $mpoint ] && rmdir $mpoint
+
+fsck -fn "$DM_DEV_DIR/$vg/$lv1"
+
+vgremove -ff $vg
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
new file mode 100644
index 0000000..9ca3ded
--- /dev/null
+++ b/test/shell/lvconvert-raid-reshape-stripes-load-reload.sh
@@ -0,0 +1,81 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+LVM_SKIP_LARGE_TESTS=1
+
+. lib/inittest
+
+# Test reshaping under io load
+
+which mkfs.ext4 || skip
+aux have_raid 1 13 2 || skip
+
+mpoint=/tmp/mpoint.$$
+
+trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
+
+aux prepare_pvs 16 32
+
+get_devs
+
+vgcreate -s 1M "$vg" "${DEVICES[@]}"
+
+# Create 13-way striped raid5 (14 legs total)
+lvcreate --yes --type raid5_ls --stripesize 64K --stripes 10 -L200M -n$lv1 $vg
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 10
+check lv_first_seg_field $vg/$lv1 stripes 11
+echo y|mkfs -t ext4 /dev/$vg/$lv1
+
+mkdir -p $mpoint
+mount "$DM_DEV_DIR/$vg/$lv1" $mpoint
+mkdir -p $mpoint/1 $mpoint/2
+
+echo 3 >/proc/sys/vm/drop_caches
+cp -r /usr/bin $mpoint/1 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mpoint/2 >/dev/null 2>/dev/null &
+sync &
+
+aux wait_for_sync $vg $lv1
+aux delay_dev "$dev2" 0 200
+
+# Reshape it to 15 data stripes
+lvconvert --yes --stripes 15 $vg/$lv1
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 15
+check lv_first_seg_field $vg/$lv1 stripes 16
+
+# Reload table during reshape to test for data corruption
+for i in {0..5}
+do
+ dmsetup table $vg-$lv1|dmsetup load $vg-$lv1
+ dmsetup suspend --noflush $vg-$lv1
+ dmsetup resume $vg-$lv1
+ sleep 0.3
+done
+
+aux delay_dev "$dev2" 0
+
+kill -9 %%
+wait
+
+umount $mpoint
+[ -d $mpoint ] && rmdir $mpoint
+
+fsck -fn "$DM_DEV_DIR/$vg/$lv1"
+
+vgremove -ff $vg
diff --git a/test/shell/lvconvert-raid-reshape-stripes-load.sh b/test/shell/lvconvert-raid-reshape-stripes-load.sh
new file mode 100644
index 0000000..53bba2e
--- /dev/null
+++ b/test/shell/lvconvert-raid-reshape-stripes-load.sh
@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+LVM_SKIP_LARGE_TESTS=1
+
+. lib/inittest
+
+# Test reshaping under io load
+
+which mkfs.ext4 || skip
+aux have_raid 1 13 1 || skip
+
+mpoint=/tmp/mpoint.$$
+
+trap "[ -d $mpoint ] && rmdir $mpoint" 1 2 3 15
+
+aux prepare_pvs 16 32
+
+get_devs
+
+vgcreate -s 1M "$vg" "${DEVICES[@]}"
+
+# Create 13-way striped raid5 (14 legs total)
+lvcreate --yes --type raid5_ls --stripesize 64K --stripes 10 -L200M -n$lv1 $vg
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 10
+check lv_first_seg_field $vg/$lv1 stripes 11
+echo y|mkfs -t ext4 /dev/$vg/$lv1
+
+mkdir -p $mpoint
+mount "$DM_DEV_DIR/$vg/$lv1" $mpoint
+mkdir -p $mpoint/1 $mpoint/2
+
+
+echo 3 >/proc/sys/vm/drop_caches
+cp -r /usr/bin $mpoint/1 >/dev/null 2>/dev/null &
+cp -r /usr/bin $mpoint/2 >/dev/null 2>/dev/null &
+sync &
+
+aux wait_for_sync $vg $lv1
+aux delay_dev "$dev2" 0 100
+
+# Reshape it to 15 data stripes
+lvconvert --yes --stripes 15 $vg/$lv1
+aux delay_dev "$dev2" 0 0
+check lv_first_seg_field $vg/$lv1 segtype "raid5_ls"
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 data_stripes 15
+check lv_first_seg_field $vg/$lv1 stripes 16
+
+kill -9 %%
+wait
+
+umount $mpoint
+[ -d $mpoint ] && rmdir $mpoint
+
+fsck -fn "$DM_DEV_DIR/$vg/$lv1"
+
+vgremove -ff $vg
diff --git a/test/shell/lvconvert-raid0_to_raid10.sh b/test/shell/lvconvert-raid0_to_raid10.sh
new file mode 100644
index 0000000..d1e1fa0
--- /dev/null
+++ b/test/shell/lvconvert-raid0_to_raid10.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+# rhbz1514500
+
+aux have_raid 1 12 0 || skip
+
+# 8 PVs needed for RAID10 testing (4-stripes/2-mirror)
+aux prepare_pvs 8 64
+get_devs
+vgcreate -s 256k "$vg" "${DEVICES[@]}"
+
+lvcreate -y --ty raid0 -R32.00k -i 4 -n $lv1 -L 64M $vg
+lvcreate -y -i4 -l4 -n $lv2 $vg
+lvextend -y -l +4 $vg/$lv1
+lvconvert -y -R512K --ty raid10 $vg/$lv1
+
+vgremove -ff $vg
6 years, 4 months
master - format_text: Round size written up to multiple of 4096.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3edc25dbdfc5d8d5ba1...
Commit: 3edc25dbdfc5d8d5ba109921dae87c5415a0b460
Parent: 78ffa44fc58fba6f4e8d2046798783d7f4f11b41
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Dec 12 22:52:22 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Dec 12 22:52:22 2017 +0000
format_text: Round size written up to multiple of 4096.
Zero-fill metadata up to the next 4096 boundary then write out a
multiple of 4096 bytes to avoid triggering a read-modify-write.
---
WHATS_NEW | 1 +
lib/format_text/export.c | 8 +++++++-
lib/format_text/format-text.c | 34 +++++++++++++++++++++++++---------
lib/format_text/layout.h | 1 +
4 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f871377..5fc4cd3 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.177 -
====================================
+ When writing text metadata content, use complete 4096 byte blocks.
Change text format metadata alignment from 512 to 4096 bytes.
When writing metadata, consistently skip mdas marked as failed.
Refactor and adjust text format metadata alignment calculation.
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index e535237..1bcaf83 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -23,6 +23,7 @@
#include "lvm-version.h"
#include "toolcontext.h"
#include "config-util.h"
+#include "layout.h"
#include <stdarg.h>
#include <time.h>
@@ -1079,7 +1080,12 @@ size_t text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf)
goto_out;
}
- r = f->data.buf.used + 1;
+ f->data.buf.used += 1; /* Terminating NUL */
+
+ /* Zero fill up to next alignment boundary */
+ memset(f->data.buf.start + f->data.buf.used, 0, MDA_ALIGNMENT - f->data.buf.used % MDA_ALIGNMENT);
+
+ r = f->data.buf.used;
*buf = f->data.buf.start;
out:
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index ea31a2f..1aa91c7 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -704,11 +704,12 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
struct mda_header *mdah;
struct pv_list *pvl;
int r = 0;
- uint64_t new_wrap; /* Number of bytes of new metadata that wrap around to start of buffer */
+ uint64_t new_wrap = 0; /* Number of bytes of new metadata that wrap around to start of buffer */
uint64_t alignment = MDA_ALIGNMENT;
int found = 0;
int noprecommit = 0;
const char *old_vg_name = NULL;
+ uint64_t new_size_rounded;
/* Ignore any mda on a PV outside the VG. vgsplit relies on this */
dm_list_iterate_items(pvl, &vg->pvs) {
@@ -735,6 +736,7 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
if (!(mdah = raw_read_mda_header(fid->fmt, &mdac->area, mda_is_primary(mda))))
goto_out;
+ /* Following space is zero-filled up to the next MDA_ALIGNMENT boundary */
if (!fidtc->raw_metadata_buf &&
!(fidtc->raw_metadata_buf_size =
text_vg_export_raw(vg, "", &fidtc->raw_metadata_buf))) {
@@ -775,19 +777,33 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
vg->name, dev_name(mdac->area.dev), mdac->rlocn.size, mdah->size - MDA_HEADER_SIZE, rlocn ? rlocn->size : 0);
goto out;
}
+
+ new_size_rounded = mdac->rlocn.size;
+ } else {
+ /* Round up to a multiple of the new alignment */
+ if (mdac->rlocn.offset + new_size_rounded < mdah->size)
+ new_size_rounded = (mdac->rlocn.size | (alignment - 1)) + 1;
+ else
+ new_size_rounded = mdac->rlocn.size;
}
- log_debug_metadata("Writing %s metadata to %s at " FMTu64 " len " FMTu64 " of " FMTu64 " aligned to " FMTu64,
+ log_debug_metadata("Writing %s metadata to %s at " FMTu64 " len " FMTu64 " (rounded to " FMTu64 ") of " FMTu64 " aligned to " FMTu64,
vg->name, dev_name(mdac->area.dev), mdac->area.start +
- mdac->rlocn.offset, mdac->rlocn.size - new_wrap, mdac->rlocn.size, alignment);
+ mdac->rlocn.offset, mdac->rlocn.size - new_wrap, new_size_rounded, mdac->rlocn.size, alignment);
- /* Write text out, circularly */
- if (!dev_write(mdac->area.dev, mdac->area.start + mdac->rlocn.offset,
- (size_t) (mdac->rlocn.size - new_wrap), MDA_CONTENT_REASON(mda_is_primary(mda)),
- fidtc->raw_metadata_buf))
- goto_out;
+ if (!new_wrap) {
+ /* Write text out, in alignment-sized blocks */
+ if (!dev_write(mdac->area.dev, mdac->area.start + mdac->rlocn.offset,
+ (size_t) new_size_rounded, MDA_CONTENT_REASON(mda_is_primary(mda)),
+ fidtc->raw_metadata_buf))
+ goto_out;
+ } else {
+ /* Write text out, circularly */
+ if (!dev_write(mdac->area.dev, mdac->area.start + mdac->rlocn.offset,
+ (size_t) (mdac->rlocn.size - new_wrap), MDA_CONTENT_REASON(mda_is_primary(mda)),
+ fidtc->raw_metadata_buf))
+ goto_out;
- if (new_wrap) {
log_debug_metadata("Writing wrapped metadata to %s at " FMTu64 " len " FMTu64 " of " FMTu64,
dev_name(mdac->area.dev), mdac->area.start +
MDA_HEADER_SIZE, new_wrap, mdac->rlocn.size);
diff --git a/lib/format_text/layout.h b/lib/format_text/layout.h
index 1eed664..bc25597 100644
--- a/lib/format_text/layout.h
+++ b/lib/format_text/layout.h
@@ -17,6 +17,7 @@
#define _LVM_TEXT_LAYOUT_H
#include "config.h"
+#include "format-text.h"
#include "metadata.h"
#include "lvmcache.h"
#include "uuid.h"
6 years, 4 months
master - format_text: Change metadata alignment from 512 to 4096.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=78ffa44fc58fba6f4e8...
Commit: 78ffa44fc58fba6f4e8d2046798783d7f4f11b41
Parent: 643df602c7d199c15ba27958e51e61b822a14755
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Dec 12 20:57:36 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Dec 12 20:57:36 2017 +0000
format_text: Change metadata alignment from 512 to 4096.
If there is sufficient space in the metadata area, align the next
metadata to a disk offset that is a multiple of 4096 bytes and
don't write it circularly. If it doesn't all fit at the end
of the metadata area, go back to the start and write it all there
contiguously.
If there is insufficient space to use the new stricter rules, revert to
the original behaviour, aligning on 512-byte boundaries wrapping around
the circular buffer as required.
---
WHATS_NEW | 1 +
lib/format_text/format-text.c | 70 ++++++++++++++++++++++++++++++++---------
lib/format_text/layout.h | 1 +
3 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f6ead67..f871377 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.177 -
====================================
+ Change text format metadata alignment from 512 to 4096 bytes.
When writing metadata, consistently skip mdas marked as failed.
Refactor and adjust text format metadata alignment calculation.
Fix python3 path in lvmdbusd to use value detected by configure.
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 0c5dd1b..ea31a2f 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -488,7 +488,7 @@ static uint64_t _next_rlocn_offset(struct raw_locn *rlocn, struct mda_header *md
if (!rlocn)
/* Find an empty slot */
/* FIXME Assumes only one VG per mdah for now */
- return alignment;
+ return ALIGN_ABSOLUTE(MDA_HEADER_SIZE, mdac_area_start, alignment);
/* First find the end of the old metadata */
old_end = rlocn->offset + rlocn->size;
@@ -501,10 +501,21 @@ static uint64_t _next_rlocn_offset(struct raw_locn *rlocn, struct mda_header *md
/* Calculate new start position relative to start of buffer rounded up to absolute alignment */
new_start_offset = ALIGN_ABSOLUTE(old_end, mdac_area_start, alignment);
- /* If new location is beyond the end of the buffer, wrap around back to start of circular buffer */
- if (new_start_offset >= mdah->size)
- new_start_offset -= (mdah->size - MDA_HEADER_SIZE);
+ /* If new location is beyond the end of the buffer, return to start of circular buffer and realign */
+ if (new_start_offset >= mdah->size) {
+ /* If the start of the buffer is occupied, move past it */
+ if (old_wrapped || rlocn->offset == MDA_HEADER_SIZE)
+ new_start_offset = old_end;
+ else
+ new_start_offset = MDA_HEADER_SIZE;
+
+ new_start_offset = ALIGN_ABSOLUTE(new_start_offset, mdac_area_start, alignment);
+ }
+ /*
+ * Note that we don't check here that this location isn't inside the existing metadata.
+ * If it is, then it means this value of alignment cannot be used.
+ */
return new_start_offset;
}
@@ -640,6 +651,15 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
uint64_t old_start = 0; /* The start of the existing metadata */
uint64_t new_start = mdac->rlocn.offset; /* The proposed start of the new metadata */
+ /*
+ * If the (aligned) start of the new metadata is already beyond the end
+ * of the buffer this means it didn't fit with the given alignment.
+ * (The caller has already tried to wrap it back to the start
+ * of the buffer but the alignment pushed it back outside.)
+ */
+ if (new_start >= mdah->size)
+ return_0;
+
/* Does the total amount of metadata, old and new, fit inside the buffer? */
if (MDA_HEADER_SIZE + (rlocn ? rlocn->size : 0) + mdac->rlocn.size >= mdah->size)
return_0;
@@ -654,7 +674,7 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
old_wrap = old_end - mdah->size;
}
- new_end = new_wrap ? new_wrap + MDA_HEADER_SIZE : (mdac->rlocn.offset + mdac->rlocn.size);
+ new_end = new_wrap ? new_wrap + MDA_HEADER_SIZE : new_start + mdac->rlocn.size;
/* If both wrap around, there's necessarily overlap */
if (new_wrap && old_wrap)
@@ -668,6 +688,10 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
if ((new_wrap || old_wrap) && (new_end > old_start))
return_0;
+ /* If there's no wrap, check there's no overlap */
+ if (!new_wrap && !old_wrap && (old_end > new_start) && (old_start < new_end))
+ return_0;
+
return 1;
}
@@ -681,7 +705,7 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
struct pv_list *pvl;
int r = 0;
uint64_t new_wrap; /* Number of bytes of new metadata that wrap around to start of buffer */
- uint64_t alignment = MDA_ORIGINAL_ALIGNMENT;
+ uint64_t alignment = MDA_ALIGNMENT;
int found = 0;
int noprecommit = 0;
const char *old_vg_name = NULL;
@@ -725,16 +749,32 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
/* Find where the new metadata would be written with our preferred alignment */
mdac->rlocn.offset = _next_rlocn_offset(rlocn, mdah, mdac->area.start, alignment);
- /* Does the new metadata wrap around? */
+ /* If metadata extends beyond the buffer, return to the start instead of wrapping it */
if (mdac->rlocn.offset + mdac->rlocn.size > mdah->size)
- new_wrap = (mdac->rlocn.offset + mdac->rlocn.size) - mdah->size;
- else
- new_wrap = 0;
+ mdac->rlocn.offset = ALIGN_ABSOLUTE(MDA_HEADER_SIZE, mdac->area.start, alignment);
- if (!_metadata_fits_into_buffer(mdac, mdah, rlocn, new_wrap)) {
- log_error("VG %s metadata on %s (" FMTu64 " bytes) too large for circular buffer (" FMTu64 " bytes with " FMTu64 " used)",
- vg->name, dev_name(mdac->area.dev), mdac->rlocn.size, mdah->size - MDA_HEADER_SIZE, rlocn ? rlocn->size : 0);
- goto out;
+ /*
+ * If the metadata doesn't fit into the buffer correctly with these
+ * settings, fall back to the 512-byte alignment used by the original
+ * LVM2 code and allow the metadata to be split into two parts,
+ * wrapping around from the end of the circular buffer back to the
+ * beginning.
+ */
+ if (!_metadata_fits_into_buffer(mdac, mdah, rlocn, 0)) {
+ alignment = MDA_ORIGINAL_ALIGNMENT;
+ mdac->rlocn.offset = _next_rlocn_offset(rlocn, mdah, mdac->area.start, alignment);
+
+ /* Does the new metadata wrap around? */
+ if (mdac->rlocn.offset + mdac->rlocn.size > mdah->size)
+ new_wrap = (mdac->rlocn.offset + mdac->rlocn.size) - mdah->size;
+ else
+ new_wrap = 0;
+
+ if (!_metadata_fits_into_buffer(mdac, mdah, rlocn, new_wrap)) {
+ log_error("VG %s metadata on %s (" FMTu64 " bytes) too large for circular buffer (" FMTu64 " bytes with " FMTu64 " used)",
+ vg->name, dev_name(mdac->area.dev), mdac->rlocn.size, mdah->size - MDA_HEADER_SIZE, rlocn ? rlocn->size : 0);
+ goto out;
+ }
}
log_debug_metadata("Writing %s metadata to %s at " FMTu64 " len " FMTu64 " of " FMTu64 " aligned to " FMTu64,
@@ -1323,7 +1363,7 @@ int vgname_from_mda(const struct format_type *fmt,
(char *)&vgsummary->vgid);
if (mda_free_sectors) {
- current_usage = ALIGN_ABSOLUTE(rlocn->size, dev_area->start + rlocn->offset, MDA_ORIGINAL_ALIGNMENT);
+ current_usage = ALIGN_ABSOLUTE(rlocn->size, dev_area->start + rlocn->offset, MDA_ALIGNMENT);
buffer_size = mdah->size - MDA_HEADER_SIZE;
diff --git a/lib/format_text/layout.h b/lib/format_text/layout.h
index 1746b9c..1eed664 100644
--- a/lib/format_text/layout.h
+++ b/lib/format_text/layout.h
@@ -103,6 +103,7 @@ struct mda_context {
#define LVM2_LABEL "LVM2 001"
#define MDA_SIZE_MIN (8 * (unsigned) lvm_getpagesize())
#define MDA_ORIGINAL_ALIGNMENT 512 /* Original alignment used for start of VG metadata content */
+#define MDA_ALIGNMENT 4096 /* Default alignment in bytes since 2.02.177 for start of VG metadata content. */
int vgname_from_mda(const struct format_type *fmt, struct mda_header *mdah, int primary_mda,
struct device_area *dev_area, struct lvmcache_vgsummary *vgsummary,
6 years, 4 months
master - format_text: More refactoring of metadata offset calcs
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=643df602c7d199c15ba...
Commit: 643df602c7d199c15ba27958e51e61b822a14755
Parent: 4002f5e206ae89db28eb60bdfb3685bd926fed57
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Dec 12 18:46:25 2017 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Dec 12 18:51:32 2017 +0000
format_text: More refactoring of metadata offset calcs
---
lib/format_text/format-text.c | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 174a579..0c5dd1b 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -482,15 +482,24 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
*/
static uint64_t _next_rlocn_offset(struct raw_locn *rlocn, struct mda_header *mdah, uint64_t mdac_area_start, uint64_t alignment)
{
- uint64_t new_start_offset;
+ uint64_t old_end, new_start_offset;
+ int old_wrapped = 0; /* Does the old metadata wrap around? */
if (!rlocn)
/* Find an empty slot */
/* FIXME Assumes only one VG per mdah for now */
return alignment;
+ /* First find the end of the old metadata */
+ old_end = rlocn->offset + rlocn->size;
+
+ if (old_end > mdah->size) {
+ old_wrapped = 1;
+ old_end -= (mdah->size - MDA_HEADER_SIZE);
+ }
+
/* Calculate new start position relative to start of buffer rounded up to absolute alignment */
- new_start_offset = ALIGN_ABSOLUTE(rlocn->offset + rlocn->size, mdac_area_start, alignment);
+ new_start_offset = ALIGN_ABSOLUTE(old_end, mdac_area_start, alignment);
/* If new location is beyond the end of the buffer, wrap around back to start of circular buffer */
if (new_start_offset >= mdah->size)
@@ -626,16 +635,23 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
struct raw_locn *rlocn, uint64_t new_wrap)
{
uint64_t old_wrap = 0; /* Amount of wrap around in existing metadata */
- uint64_t new_end; /* The end location of the new metadata */
+ uint64_t old_end = 0; /* The (byte after the) end of the existing metadata */
+ uint64_t new_end; /* The (byte after the) end of the new metadata */
+ uint64_t old_start = 0; /* The start of the existing metadata */
+ uint64_t new_start = mdac->rlocn.offset; /* The proposed start of the new metadata */
/* Does the total amount of metadata, old and new, fit inside the buffer? */
if (MDA_HEADER_SIZE + (rlocn ? rlocn->size : 0) + mdac->rlocn.size >= mdah->size)
return_0;
- /* Does the existing metadata wrap around the end of the buffer? */
+ /* If there's existing metadata, set old_start, old_end and old_wrap. */
if (rlocn) {
- if (rlocn->offset + rlocn->size > mdah->size)
- old_wrap = (rlocn->offset + rlocn->size) - mdah->size;
+ old_start = rlocn->offset;
+ old_end = old_start + rlocn->size;
+
+ /* Does the existing metadata wrap around the end of the buffer? */
+ if (old_end > mdah->size)
+ old_wrap = old_end - mdah->size;
}
new_end = new_wrap ? new_wrap + MDA_HEADER_SIZE : (mdac->rlocn.offset + mdac->rlocn.size);
@@ -649,7 +665,7 @@ static int _metadata_fits_into_buffer(struct mda_context *mdac, struct mda_heade
return 1;
/* If either wraps around, there's overlap if the new end falls beyond the old start */
- if ((new_wrap || old_wrap) && (new_end > rlocn->offset))
+ if ((new_wrap || old_wrap) && (new_end > old_start))
return_0;
return 1;
6 years, 4 months