master - integrity: add initial size to metadata size
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ad773511c59aea23959...
Commit: ad773511c59aea239592c014a2dab4161ed92214
Parent: 3f32f9811e01c8953d201c7c9b563561ad856130
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jun 30 12:52:27 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jun 30 16:43:05 2020 -0500
integrity: add initial size to metadata size
The metadata device size needs to include space for
the dm-integrity "initial_sectors" which hold journals.
---
lib/metadata/integrity_manip.c | 28 +++++++++++++++++++++++++++-
test/shell/integrity-large.sh | 20 +++++++++++---------
2 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/lib/metadata/integrity_manip.c b/lib/metadata/integrity_manip.c
index b622743f0..3322a2101 100644
--- a/lib/metadata/integrity_manip.c
+++ b/lib/metadata/integrity_manip.c
@@ -28,6 +28,7 @@
#define DEFAULT_BLOCK_SIZE 512
#define ONE_MB_IN_BYTES 1048576
+#define ONE_GB_IN_BYTES 1073741824
int lv_is_integrity_origin(const struct logical_volume *lv)
{
@@ -45,10 +46,35 @@ int lv_is_integrity_origin(const struct logical_volume *lv)
/*
* Every 500M of data needs 4M of metadata.
* (From trial and error testing.)
+ *
+ * plus some initial space for journals.
+ * (again from trial and error testing.)
*/
static uint64_t _lv_size_bytes_to_integrity_meta_bytes(uint64_t lv_size_bytes)
{
- return ((lv_size_bytes / (500 * ONE_MB_IN_BYTES)) + 1) * (4 * ONE_MB_IN_BYTES);
+ uint64_t meta_bytes;
+ uint64_t initial_bytes;
+
+ /* Every 500M of data needs 4M of metadata. */
+ meta_bytes = ((lv_size_bytes / (500 * ONE_MB_IN_BYTES)) + 1) * (4 * ONE_MB_IN_BYTES);
+
+ /*
+ * initial space used for journals
+ * lv_size <= 512M -> 4M
+ * lv_size <= 1G -> 8M
+ * lv_size <= 4G -> 32M
+ * lv_size > 4G -> 64M
+ */
+ if (lv_size_bytes <= (512 * ONE_MB_IN_BYTES))
+ initial_bytes = 4 * ONE_MB_IN_BYTES;
+ else if (lv_size_bytes <= ONE_GB_IN_BYTES)
+ initial_bytes = 8 * ONE_MB_IN_BYTES;
+ else if (lv_size_bytes <= (4ULL * ONE_GB_IN_BYTES))
+ initial_bytes = 32 * ONE_MB_IN_BYTES;
+ else if (lv_size_bytes > (4ULL * ONE_GB_IN_BYTES))
+ initial_bytes = 64 * ONE_MB_IN_BYTES;
+
+ return meta_bytes + initial_bytes;
}
/*
diff --git a/test/shell/integrity-large.sh b/test/shell/integrity-large.sh
index 1df9e6b53..06b0e03db 100644
--- a/test/shell/integrity-large.sh
+++ b/test/shell/integrity-large.sh
@@ -23,7 +23,7 @@ mnt="mnt"
mkdir -p $mnt
# raid1 LV needs to be extended to 512MB to test imeta being exended
-aux prepare_devs 4 600
+aux prepare_devs 4 632
printf "%0.sA" {1..16384} >> fileA
printf "%0.sB" {1..16384} >> fileB
@@ -131,8 +131,8 @@ _verify_data_on_lv
_wait_recalc $vg/${lv1}_rimage_0
_wait_recalc $vg/${lv1}_rimage_1
lvs -a -o+devices $vg
-check lv_field $vg/${lv1}_rimage_0_imeta size "8.00m"
-check lv_field $vg/${lv1}_rimage_1_imeta size "8.00m"
+check lv_field $vg/${lv1}_rimage_0_imeta size "12.00m"
+check lv_field $vg/${lv1}_rimage_1_imeta size "12.00m"
# provide space to extend the images onto new devs
vgextend $vg "$dev3" "$dev4"
@@ -153,33 +153,35 @@ lvconvert --raidintegrity y $vg/$lv1
_wait_recalc $vg/${lv1}_rimage_0
_wait_recalc $vg/${lv1}_rimage_1
lvs -a -o+devices $vg
-check lv_field $vg/${lv1}_rimage_0_imeta size "12.00m"
-check lv_field $vg/${lv1}_rimage_1_imeta size "12.00m"
+check lv_field $vg/${lv1}_rimage_0_imeta size "20.00m"
+check lv_field $vg/${lv1}_rimage_1_imeta size "20.00m"
lvchange -an $vg/$lv1
lvremove $vg/$lv1
# this succeeds because dev1,dev2 can hold rmeta+rimage
lvcreate --type raid1 -n $lv1 -L 592M -an $vg "$dev1" "$dev2"
+lvs -a -o+devices $vg
+lvchange -an $vg/$lv1
+lvremove $vg/$lv1
# this fails because dev1,dev2 can hold rmeta+rimage, but not imeta
# and we require imeta to be on same devs as rmeta/rimeta
-not lvcreate --type raid1 --raidintegrity y -n $lv1 -L 592M -an $vg "$dev1" "$dev2"
+not lvcreate --type raid1 --raidintegrity y -n $lv1 -L 624M -an $vg "$dev1" "$dev2"
lvs -a -o+devices $vg
-lvremove $vg/$lv1
# this can allocate from more devs so there's enough space for imeta to
# be allocated in the vg, but lvcreate fails because rmeta+rimage are
# allocated from dev1,dev2, we restrict imeta to being allocated on the
# same devs as rmeta/rimage, and dev1,dev2 can't fit imeta.
-not lvcreate --type raid1 --raidintegrity y -n $lv1 -L 592M -an $vg
+not lvcreate --type raid1 --raidintegrity y -n $lv1 -L 624M -an $vg
lvs -a -o+devices $vg
# counterintuitively, increasing the size will allow lvcreate to succeed
# because rmeta+rimage are pushed to being allocated on dev1,dev2,dev3,dev4
# which means imeta is now free to be allocated from dev3,dev4 which have
# plenty of space
-lvcreate --type raid1 --raidintegrity y -n $lv1 -L 600M -an $vg
+lvcreate --type raid1 --raidintegrity y -n $lv1 -L 640M -an $vg
lvs -a -o+devices $vg
vgremove -ff $vg
3 years, 5 months
master - tests: check pool metadata are zeroed
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3f32f9811e01c8953d2...
Commit: 3f32f9811e01c8953d201c7c9b563561ad856130
Parent: 094d6f80ddb6d8a1c64977dfaae4073827063fe3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 24 14:42:11 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 24 15:01:03 2020 +0200
tests: check pool metadata are zeroed
---
test/lib/aux.sh | 1 +
test/shell/lvcreate-thin.sh | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index e40da9592..17e7935ee 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1234,6 +1234,7 @@ activation/verify_udev_operations = $LVM_VERIFY_UDEV
activation/raid_region_size = 512
allocation/wipe_signatures_when_zeroing_new_lvs = 0
allocation/vdo_slab_size_mb = 128
+allocation/zero_metadata = 0
backup/archive = 0
backup/backup = 0
devices/cache_dir = "$TESTDIR/etc"
diff --git a/test/shell/lvcreate-thin.sh b/test/shell/lvcreate-thin.sh
index 9ca7f1141..c073eaf24 100644
--- a/test/shell/lvcreate-thin.sh
+++ b/test/shell/lvcreate-thin.sh
@@ -248,4 +248,25 @@ not lvcreate -s $vg/lv1 -L4M -V2G --name $vg/lv4
not lvcreate -T mirpool -L4M --alloc anywhere -m1 $vg
not lvcreate --thinpool mirpool -L4M --alloc anywhere -m1 $vg
+
+# Check pool metadata volume is zeroed, when zero_metadata is enabled.
+# 1st. ensure 8megs of both PVs will have some non-0 data
+lvcreate -L8m -n $lv1 $vg "$dev1"
+lvextend -L+8m $vg/$lv1 "$dev2"
+dd if=/dev/urandom of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=16 oflag=direct conv=fdatasync
+lvremove -ff $vg/$lv1
+
+lvcreate -l1 --poolmetadatasize 4m --conf 'allocation/zero_metadata=1' -vvvv -T $vg/pool
+lvchange -an $vg
+# component activation to check device was zeroed
+lvchange -y -ay $vg/pool_tmeta
+dd if="$DM_DEV_DIR/$vg/pool_tmeta" of=file bs=1M count=3 skip=1 iflag=direct conv=fdatasync
+
+md5sum -b file | tee out
+# md5sum of 3M of zeros
+grep d1dd210d6b1312cb342b56d02bd5e651 out
+lvchange -an $vg
+lvremove -ff $vg
+
+
vgremove -ff $vg
3 years, 5 months
master - tests: failure of zeroing fails command
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=094d6f80ddb6d8a1c64...
Commit: 094d6f80ddb6d8a1c64977dfaae4073827063fe3
Parent: 88b92d4225b90db82047f3bac55d8059918e9c1b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 23 14:10:18 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 24 15:01:03 2020 +0200
tests: failure of zeroing fails command
---
test/shell/lvcreate-signature-wiping.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/test/shell/lvcreate-signature-wiping.sh b/test/shell/lvcreate-signature-wiping.sh
index 73fea54fd..18d7a2f7e 100644
--- a/test/shell/lvcreate-signature-wiping.sh
+++ b/test/shell/lvcreate-signature-wiping.sh
@@ -42,6 +42,13 @@ init_lv_
test_blkid_ || skip
lvremove -f $vg/$lv1
+# Zeroing stops the command when there is a failure (write error in this case)
+aux error_dev "$dev1" "$(get first_extent_sector "$dev1"):2"
+not lvcreate -l1 -n $lv1 $vg 2>&1 | tee out
+grep "Failed to initialize" out
+aux enable_dev "$dev1"
+
+
aux lvmconf "allocation/wipe_signatures_when_zeroing_new_lvs = 0"
lvcreate -y -Zn -l1 -n $lv1 $vg 2>&1 | tee out
3 years, 5 months
master - make: make generate
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=88b92d4225b90db8204...
Commit: 88b92d4225b90db82047f3bac55d8059918e9c1b
Parent: b7885dbb734de97e39dca28a38850cbb623cf57f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 23 12:19:35 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 24 15:01:03 2020 +0200
make: make generate
update
---
conf/example.conf.in | 6 +-
man/lvconvert.8_pregen | 58 ++++++++++++
man/lvcreate.8_pregen | 246 +++++++++++++++++++++++++++++++++++++++++++++----
man/lvs.8_pregen | 4 +
man/vgck.8_pregen | 9 ++
5 files changed, 303 insertions(+), 20 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 05b085792..a3d8ca380 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -488,7 +488,7 @@ allocation {
# This configuration option does not have a default value defined.
# Configuration option allocation/thin_pool_metadata_require_separate_pvs.
- # Thin pool metdata and data will always use different PVs.
+ # Thin pool metadata and data will always use different PVs.
thin_pool_metadata_require_separate_pvs = 0
# Configuration option allocation/thin_pool_zero.
@@ -526,6 +526,10 @@ allocation {
# This configuration option has an automatic default value.
# thin_pool_chunk_size_policy = "generic"
+ # Configuration option allocation/zero_metadata.
+ # Zero whole metadata area before use with thin or cache pool.
+ zero_metadata = 1
+
# Configuration option allocation/thin_pool_chunk_size.
# The minimal chunk size in KiB for thin pool volumes.
# Larger chunk sizes may improve performance for plain thin volumes,
diff --git a/man/lvconvert.8_pregen b/man/lvconvert.8_pregen
index 74409848c..37b0a47d2 100644
--- a/man/lvconvert.8_pregen
+++ b/man/lvconvert.8_pregen
@@ -22,6 +22,10 @@ lvconvert - Change logical volume layout
\fB-H\fP|\fB--cache\fP
.ad b
.br
+.ad l
+ \fB--cachedevice\fP \fIPV\fP
+.ad b
+.br
.ad l
\fB--cachemetadataformat\fP \fBauto\fP|\fB1\fP|\fB2\fP
.ad b
@@ -42,6 +46,10 @@ lvconvert - Change logical volume layout
\fB--cachesettings\fP \fIString\fP
.ad b
.br
+.ad l
+ \fB--cachesize\fP \fISize\fP[m|UNIT]
+.ad b
+.br
.ad l
\fB--cachevol\fP \fILV\fP
.ad b
@@ -738,6 +746,44 @@ Attach a cache to an LV, converts the LV to type cache.
.br
-
+Add a writecache to an LV, using a specified cache device.
+.br
+.P
+\fBlvconvert\fP \fB--type\fP \fBwritecache\fP \fB--cachedevice\fP \fIPV\fP \fILV\fP
+.br
+.RS 4
+.ad l
+[ \fB--cachesize\fP \fISize\fP[m|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB--cachesettings\fP \fIString\fP ]
+.ad b
+.br
+[ COMMON_OPTIONS ]
+.RE
+.br
+-
+
+Add a cache to an LV, using a specified cache device.
+.br
+.P
+\fBlvconvert\fP \fB--type\fP \fBcache\fP \fB--cachedevice\fP \fIPV\fP \fILV\fP
+.br
+.RS 4
+.ad l
+[ \fB--cachesize\fP \fISize\fP[m|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB--cachesettings\fP \fIString\fP ]
+.ad b
+.br
+[ COMMON_OPTIONS ]
+.RE
+.br
+-
+
Convert LV to type thin-pool.
.br
.P
@@ -1135,6 +1181,12 @@ See \fBlvmcache\fP(7) for more information about LVM caching.
.ad b
.HP
.ad l
+\fB--cachedevice\fP \fIPV\fP
+.br
+The name of a device to use for a cache.
+.ad b
+.HP
+.ad l
\fB--cachemetadataformat\fP \fBauto\fP|\fB1\fP|\fB2\fP
.br
Specifies the cache metadata format used by cache target.
@@ -1182,6 +1234,12 @@ See \fBlvmcache\fP(7) for more information.
.ad b
.HP
.ad l
+\fB--cachesize\fP \fISize\fP[m|UNIT]
+.br
+The size of cache to use.
+.ad b
+.HP
+.ad l
\fB--cachevol\fP \fILV\fP
.br
The name of a cache volume.
diff --git a/man/lvcreate.8_pregen b/man/lvcreate.8_pregen
index be8e78389..ee6903431 100644
--- a/man/lvcreate.8_pregen
+++ b/man/lvcreate.8_pregen
@@ -30,6 +30,10 @@ lvcreate - Create a logical volume
\fB-H\fP|\fB--cache\fP
.ad b
.br
+.ad l
+ \fB--cachedevice\fP \fIPV\fP
+.ad b
+.br
.ad l
\fB--cachemetadataformat\fP \fBauto\fP|\fB1\fP|\fB2\fP
.ad b
@@ -50,6 +54,14 @@ lvcreate - Create a logical volume
\fB--cachesettings\fP \fIString\fP
.ad b
.br
+.ad l
+ \fB--cachesize\fP \fISize\fP[m|UNIT]
+.ad b
+.br
+.ad l
+ \fB--cachevol\fP \fILV\fP
+.ad b
+.br
.ad l
\fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT]
.ad b
@@ -816,11 +828,9 @@ where the new thin pool is named by the --thinpool arg.
.RE
-
-Create a cache LV, first creating a new origin LV,
+Create a new LV, then attach the specified cachepool
.br
-then combining it with the existing cache pool named
-.br
-by the --cachepool arg.
+which converts the new LV to type cache.
.br
.P
\fBlvcreate\fP \fB--type\fP \fBcache\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT]
@@ -881,6 +891,190 @@ by the --cachepool arg.
.RE
-
+Create a new LV, then attach the specified cachevol
+.br
+which converts the new LV to type cache.
+.br
+.P
+\fBlvcreate\fP \fB--type\fP \fBcache\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT]
+.RS 5
+ \fB--cachevol\fP \fILV\fP \fIVG\fP
+.RE
+.br
+.RS 4
+.ad l
+[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
+.ad b
+.br
+.ad l
+[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
+.ad b
+.br
+.ad l
+[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB--cachemode\fP \fBwritethrough\fP|\fBwriteback\fP|\fBpassthrough\fP ]
+.ad b
+.br
+.ad l
+[ \fB--cachepolicy\fP \fIString\fP ]
+.ad b
+.br
+.ad l
+[ \fB--cachesettings\fP \fIString\fP ]
+.ad b
+.br
+.ad l
+[ \fB--cachemetadataformat\fP \fBauto\fP|\fB1\fP|\fB2\fP ]
+.ad b
+.br
+[ COMMON_OPTIONS ]
+.RE
+.br
+.RS 4
+[ \fIPV\fP ... ]
+.RE
+-
+
+Create a new LV, then attach a cachevol created from
+.br
+the specified cache device, which converts the
+.br
+new LV to type cache.
+.br
+.P
+\fBlvcreate\fP \fB--type\fP \fBcache\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT]
+.RS 5
+ \fB--cachedevice\fP \fIPV\fP \fIVG\fP
+.RE
+.br
+.RS 4
+.ad l
+[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
+.ad b
+.br
+.ad l
+[ \fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
+.ad b
+.br
+.ad l
+[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB--cachemode\fP \fBwritethrough\fP|\fBwriteback\fP|\fBpassthrough\fP ]
+.ad b
+.br
+.ad l
+[ \fB--cachepolicy\fP \fIString\fP ]
+.ad b
+.br
+.ad l
+[ \fB--cachesettings\fP \fIString\fP ]
+.ad b
+.br
+.ad l
+[ \fB--cachemetadataformat\fP \fBauto\fP|\fB1\fP|\fB2\fP ]
+.ad b
+.br
+.ad l
+[ \fB--cachesize\fP \fISize\fP[m|UNIT] ]
+.ad b
+.br
+[ COMMON_OPTIONS ]
+.RE
+.br
+.RS 4
+[ \fIPV\fP ... ]
+.RE
+-
+
+Create a new LV, then attach the specified cachevol
+.br
+which converts the new LV to type writecache.
+.br
+.P
+\fBlvcreate\fP \fB--type\fP \fBwritecache\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT]
+.RS 5
+ \fB--cachevol\fP \fILV\fP \fIVG\fP
+.RE
+.br
+.RS 4
+.ad l
+[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
+.ad b
+.br
+.ad l
+[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
+.ad b
+.br
+.ad l
+[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB--cachesettings\fP \fIString\fP ]
+.ad b
+.br
+[ COMMON_OPTIONS ]
+.RE
+.br
+.RS 4
+[ \fIPV\fP ... ]
+.RE
+-
+
+Create a new LV, then attach a cachevol created from
+.br
+the specified cache device, which converts the
+.br
+new LV to type writecache.
+.br
+.P
+\fBlvcreate\fP \fB--type\fP \fBwritecache\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT]
+.RS 5
+ \fB--cachedevice\fP \fIPV\fP \fIVG\fP
+.RE
+.br
+.RS 4
+.ad l
+[ \fB-l\fP|\fB--extents\fP \fINumber\fP[PERCENT] ]
+.ad b
+.br
+.ad l
+[ \fB-i\fP|\fB--stripes\fP \fINumber\fP ]
+.ad b
+.br
+.ad l
+[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB--cachesize\fP \fISize\fP[m|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB--cachesettings\fP \fIString\fP ]
+.ad b
+.br
+[ COMMON_OPTIONS ]
+.RE
+.br
+.RS 4
+[ \fIPV\fP ... ]
+.RE
+-
+
Common options for command:
.
.RS 4
@@ -1091,6 +1285,12 @@ See \fBlvmcache\fP(7) for more information about LVM caching.
.ad b
.HP
.ad l
+\fB--cachedevice\fP \fIPV\fP
+.br
+The name of a device to use for a cache.
+.ad b
+.HP
+.ad l
\fB--cachemetadataformat\fP \fBauto\fP|\fB1\fP|\fB2\fP
.br
Specifies the cache metadata format used by cache target.
@@ -1138,6 +1338,18 @@ See \fBlvmcache\fP(7) for more information.
.ad b
.HP
.ad l
+\fB--cachesize\fP \fISize\fP[m|UNIT]
+.br
+The size of cache to use.
+.ad b
+.HP
+.ad l
+\fB--cachevol\fP \fILV\fP
+.br
+The name of a cache volume.
+.ad b
+.HP
+.ad l
\fB-c\fP|\fB--chunksize\fP \fISize\fP[k|UNIT]
.br
The size of chunks in a snapshot, cache pool or thin pool.
@@ -2659,11 +2871,11 @@ config setting sparse_segtype_default.
.RE
-
-Create a cache LV, first creating a new origin LV,
+Create a new LV, then attach the specified cachepool
.br
-then combining it with the existing cache pool named
+which converts the new LV to type cache
.br
-by the --cachepool arg (variant, infers --type cache).
+(variant, infers --type cache.)
.br
.P
\fBlvcreate\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fB--cachepool\fP \fILV\fP\fI_cachepool\fP \fIVG\fP
@@ -2717,11 +2929,11 @@ by the --cachepool arg (variant, infers --type cache).
.RE
-
-Create a cache LV, first creating a new origin LV,
+Create a new LV, then attach the specified cachepool
.br
-then combining it with the existing cache pool named
+which converts the new LV to type cache.
.br
-in the first arg (variant, also use --cachepool).
+(variant, also use --cachepool).
.br
.P
\fBlvcreate\fP \fB--type\fP \fBcache\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fILV\fP\fI_cachepool\fP
@@ -2779,19 +2991,15 @@ in the first arg (variant, also use --cachepool).
.RE
-
-When LV is a cache pool, create a cache LV,
-.br
-first creating a new origin LV, then combining it with
-.br
-the existing cache pool named in the first arg
+When the LV arg is a cachepool, then create a new LV and
.br
-(variant, infers --type cache, also use --cachepool).
+attach the cachepool arg to it.
.br
-When LV is not a cache pool, convert the specified LV
+(variant, use --type cache and --cachepool.)
.br
-to type cache after creating a new cache pool LV to use
+When the LV arg is not a cachepool, then create a new cachepool
.br
-(use lvconvert).
+and attach it to the LV arg (alternative, use lvconvert.)
.br
.P
\fBlvcreate\fP \fB-H\fP|\fB--cache\fP \fB-L\fP|\fB--size\fP \fISize\fP[m|UNIT] \fILV\fP
diff --git a/man/lvs.8_pregen b/man/lvs.8_pregen
index 8c3091dee..8aea3566a 100644
--- a/man/lvs.8_pregen
+++ b/man/lvs.8_pregen
@@ -577,6 +577,10 @@ Related to Thin Logical Volumes: (F)ailed.
.br
(F)ailed is set when related thin pool enters Failed state and no further I/O
is permitted at all.
+.IP
+Related to writecache logical volumes: (E)rror.
+.br
+(E)rror is set dm-writecache reports an error.
.IP 10 3
s(k)ip activation: this volume is flagged to be skipped during activation.
.SH SEE ALSO
diff --git a/man/vgck.8_pregen b/man/vgck.8_pregen
index a66de5d7f..2a1ec2364 100644
--- a/man/vgck.8_pregen
+++ b/man/vgck.8_pregen
@@ -199,6 +199,15 @@ back metadata it believes has changed but hasn't.
\fB--updatemetadata\fP
.br
Update VG metadata to correct problems.
+If VG metadata was updated while a PV was missing, and the PV
+reappears with an old version of metadata, then this option
+(or any other command that writes metadata) will update the
+metadata on the previously missing PV. If a PV was removed
+from a VG while it was missing, and the PV reappears, using
+this option will clear the outdated metadata from the previously
+missing PV. If metadata text is damaged on one PV, using this
+option will replace the damaged metadata text. For more severe
+damage, e.g. with headers, see \fBpvck\fP(8).
.ad b
.HP
.ad l
3 years, 5 months
master - man: update cache page
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b7885dbb734de97e39d...
Commit: b7885dbb734de97e39dca28a38850cbb623cf57f
Parent: cca2a652d1ac2fa67677e3dca50141efa8e2c1a9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 23 12:19:54 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 24 15:01:03 2020 +0200
man: update cache page
Few more sentences around migration threshold.
---
man/lvmcache.7_main | 55 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 51 insertions(+), 4 deletions(-)
diff --git a/man/lvmcache.7_main b/man/lvmcache.7_main
index 244ea1e48..37d0e3359 100644
--- a/man/lvmcache.7_main
+++ b/man/lvmcache.7_main
@@ -129,6 +129,17 @@ attached.
LV VG Attr Type Devices
fast vg -wi------- linear /dev/fast_ssd
main vg -wi------- linear /dev/slow_hhd
+
+To stop caching the main LV and also remove unneeded cache pool,
+use the --uncache:
+
+.nf
+ $ lvconvert --uncache vg/main
+
+ $ lvs -a
+ LV VG Attr Type Devices
+ main vg -wi------- linear /dev/slow_hhd
+
.fi
.SS Create a new LV with caching.
@@ -170,8 +181,10 @@ same fast LV. This option can be used with dm-writecache or dm-cache.
Pass this option a cachepool LV or a standard LV. When using a cache
pool, lvm places cache data and cache metadata on different LVs. The two
-LVs together are called a cache pool. This permits specific placement of
-data and metadata. A cache pool is represented as a special type of LV
+LVs together are called a cache pool. This has a bit better performance
+for dm-cache and permits specific placement and segment type selection
+for data and metadata volumes.
+A cache pool is represented as a special type of LV
that cannot be used directly. If a standard LV is passed with this
option, lvm will first convert it to a cache pool by combining it with
another LV to use for metadata. This option can be used with dm-cache.
@@ -361,11 +374,16 @@ $ lvconvert --type cache --cachevol fast \\
The size of data blocks managed by dm-cache can be specified with the
--chunksize option when caching is started. The default unit is KiB. The
-value must be a multiple of 32KiB between 32KiB and 1GiB.
+value must be a multiple of 32KiB between 32KiB and 1GiB. Cache chunks
+bigger then 512KiB shall be only used when necessary.
Using a chunk size that is too large can result in wasteful use of the
cache, in which small reads and writes cause large sections of an LV to be
-stored in the cache. However, choosing a chunk size that is too small
+stored in the cache. It can also require increasing migration threshold
+which defaults to 2048 sectors (1 MiB). Lvm2 ensures migration threshold is
+at least 8 chunks in size. This may in some cases result in very
+high bandwidth load of transfering data between the cache LV and its
+cache origin LV. However, choosing a chunk size that is too small
can result in more overhead trying to manage the numerous chunks that
become mapped into the cache. Overhead can include both excessive CPU
time searching for chunks, and excessive memory tracking chunks.
@@ -383,6 +401,35 @@ The default value is shown by:
.br
.B lvmconfig --type default allocation/cache_pool_chunk_size
+Checking migration threshold (in sectors) of running cached LV:
+.br
+.B lvs -o+kernel_cache_settings VG/LV
+
+
+.SS dm-cache migration threshold
+
+\&
+
+Migrating data between the origin and cache LV uses bandwidth.
+The user can set a throttle to prevent more than a certain amount of
+migration occurring at any one time. Currently dm-cache is not taking any
+account of normal io traffic going to the devices.
+
+User can set migration threshold via cache policy settings as
+"migration_threshold=<#sectors>" to set the maximum number
+of sectors being migrated, the default being 2048 sectors (1MiB).
+
+Command to set migration threshold to 2MiB (4096 sectors):
+.br
+.B lvcreate --cachepolicy 'migration_threshold=4096' VG/LV
+
+
+Command to display the migration threshold:
+.br
+.B lvs -o+kernel_cache_settings,cache_settings VG/LV
+.br
+.B lvs -o+chunksize VG/LV
+
.SS dm-cache cache policy
3 years, 5 months
master - cov: avoid double call of free_hints() on error path
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cca2a652d1ac2fa6767...
Commit: cca2a652d1ac2fa67677e3dca50141efa8e2c1a9
Parent: eb06832b37d6d1e3d1c5fba69c5829d76d5d27a5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 22 11:07:34 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 24 15:01:03 2020 +0200
cov: avoid double call of free_hints() on error path
Since we 'free_hints()' on return error path from call of
_read_hint_file(), avoid calling it twice in the middle of
error path process.
---
lib/label/hints.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/label/hints.c b/lib/label/hints.c
index 9546f4880..efa02f7c5 100644
--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -801,10 +801,8 @@ static int _read_hint_file(struct cmd_context *cmd, struct dm_list *hints, int *
if (fclose(fp))
stack;
- if (!ret) {
- free_hints(hints);
+ if (!ret)
return 0;
- }
if (!found)
return 1;
3 years, 5 months
master - cov: remove unused header
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=eb06832b37d6d1e3d1c...
Commit: eb06832b37d6d1e3d1c5fba69c5829d76d5d27a5
Parent: dccaab3d79c0439fff26fd4d98e7f55be5a14318
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 16 16:38:15 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 24 15:01:03 2020 +0200
cov: remove unused header
---
lib/metadata/integrity_manip.c | 1 -
lib/metadata/writecache_manip.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/lib/metadata/integrity_manip.c b/lib/metadata/integrity_manip.c
index 334452711..b622743f0 100644
--- a/lib/metadata/integrity_manip.c
+++ b/lib/metadata/integrity_manip.c
@@ -21,7 +21,6 @@
#include "lib/metadata/segtype.h"
#include "lib/activate/activate.h"
#include "lib/config/defaults.h"
-#include "lib/activate/dev_manager.h"
#define DEFAULT_TAG_SIZE 4 /* bytes */
#define DEFAULT_MODE 'J'
diff --git a/lib/metadata/writecache_manip.c b/lib/metadata/writecache_manip.c
index 7ad8c75e7..fade82ef5 100644
--- a/lib/metadata/writecache_manip.c
+++ b/lib/metadata/writecache_manip.c
@@ -19,7 +19,6 @@
#include "lib/commands/toolcontext.h"
#include "lib/display/display.h"
#include "lib/metadata/segtype.h"
-#include "lib/metadata/lv_alloc.h"
#include "lib/activate/activate.h"
#include "lib/config/defaults.h"
#include "lib/datastruct/str_list.h"
3 years, 5 months
master - cov: use 64bit arithmetic
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dccaab3d79c0439fff2...
Commit: dccaab3d79c0439fff26fd4d98e7f55be5a14318
Parent: bc39d5bec6fea787a8d8d16fa484084b7d2a7c29
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 10 23:36:06 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 24 15:01:03 2020 +0200
cov: use 64bit arithmetic
Although values of VDO block_map_cache_size, index_memory_size, slab_size
should not overflow here - use proper 64bit math.
---
lib/report/report.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/report/report.c b/lib/report/report.c
index 74ec74cf7..979cbee52 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3961,7 +3961,7 @@ static int _vdo_ ## vdo_field_name ## _disp (struct dm_report *rh, struct dm_poo
if (!seg_is_vdo_pool(seg)) \
return _field_set_value(field, "", &GET_TYPE_RESERVED_VALUE(num_undef_64)); \
\
- size = seg->vdo_params.vdo_field_name ## _mb * (1024 * 1024 >> SECTOR_SHIFT); \
+ size = seg->vdo_params.vdo_field_name ## _mb * (UINT64_C(1024) * 1024 >> SECTOR_SHIFT); \
\
return _size64_disp(rh, mem, field, &size, private);\
}
3 years, 5 months
master - pool: zero metadata
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bc39d5bec6fea787a8d...
Commit: bc39d5bec6fea787a8d8d16fa484084b7d2a7c29
Parent: edbc5a62b26806e5c4de59b5292609e955303576
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jun 24 12:11:21 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 24 15:01:03 2020 +0200
pool: zero metadata
To avoid polution of metadata with some 'garbage' content or eventualy
some leak of stale data in case user want to upload metadata somewhere,
ensure upon allocation the metadata device is fully zeroed.
Behaviour may slow down allocation of thin-pool or cache-pool a bit
so the old behaviour can be restored with lvm.conf setting:
allocation/zero_metadata=0
TODO: add zeroing for extension of metadata volume.
---
WHATS_NEW | 1 +
lib/config/config_settings.h | 5 ++++-
lib/config/defaults.h | 1 +
lib/metadata/lv_manip.c | 29 ++++++++++++++++++++++-------
lib/metadata/metadata-exported.h | 2 ++
lib/metadata/pool_manip.c | 6 ++++--
6 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index b770455fb..2e2e6d919 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.10 -
=================================
+ Zero pool metadata on allocation (disable with allocation/zero_metadata=0).
Failure in zeroing or wiping will fail command (bypass with -Zn, -Wn).
Fix running out of free buffers for async writing for larger writes.
Add integrity with raid capability.
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 2bb72ba71..531fb139d 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -626,7 +626,7 @@ cfg(allocation_cache_pool_max_chunks_CFG, "cache_pool_max_chunks", allocation_CF
"Using cache pool with more chunks may degrade cache performance.\n")
cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL, 0, NULL,
- "Thin pool metdata and data will always use different PVs.\n")
+ "Thin pool metadata and data will always use different PVs.\n")
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL, 0, NULL,
"Thin pool data chunks are zeroed before they are first used.\n"
@@ -657,6 +657,9 @@ cfg(allocation_thin_pool_chunk_size_policy_CFG, "thin_pool_chunk_size_policy", a
" 512KiB.\n"
"#\n")
+cfg(allocation_zero_metadata_CFG, "zero_metadata", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ZERO_METADATA, vsn(2, 3, 10), NULL, 0, NULL,
+ "Zero whole metadata area before use with thin or cache pool.\n")
+
cfg_runtime(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 99), 0, NULL,
"The minimal chunk size in KiB for thin pool volumes.\n"
"Larger chunk sizes may improve performance for plain thin volumes,\n"
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index be4f5ff7f..708a57554 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -129,6 +129,7 @@
#define DEFAULT_THIN_POOL_DISCARDS "passdown"
#define DEFAULT_THIN_POOL_ZERO 1
#define DEFAULT_POOL_METADATA_SPARE 1 /* thin + cache */
+#define DEFAULT_ZERO_METADATA 1 /* thin + cache */
#ifdef CACHE_CHECK_NEEDS_CHECK
# define DEFAULT_CACHE_CHECK_OPTION1 "-q"
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 8250819da..d96137aff 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7576,8 +7576,10 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
struct device *dev;
char name[PATH_MAX];
uint64_t zero_sectors;
+ int zero_metadata = wp.is_metadata ?
+ find_config_tree_bool(lv->vg->cmd, allocation_zero_metadata_CFG, NULL) : 0;
- if (!wp.do_zero && !wp.do_wipe_signatures)
+ if (!wp.do_zero && !wp.do_wipe_signatures && !wp.is_metadata)
/* nothing to do */
return 1;
@@ -7629,17 +7631,29 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
}
}
- if (wp.do_zero) {
- zero_sectors = wp.zero_sectors ? : UINT64_C(4096) >> SECTOR_SHIFT;
-
- if (zero_sectors > lv->size)
+ if (wp.do_zero || wp.is_metadata) {
+ zero_metadata = !wp.is_metadata ? 0 :
+ find_config_tree_bool(lv->vg->cmd, allocation_zero_metadata_CFG, NULL);
+ if (zero_metadata) {
+ log_debug("Metadata logical volume %s will be fully zeroed.",
+ display_lvname(lv));
zero_sectors = lv->size;
+ } else {
+ if (wp.is_metadata) /* Verbosely notify metadata will not be fully zeroed */
+ log_verbose("Metadata logical volume %s not fully zeroed and may contain stale data.",
+ display_lvname(lv));
+ zero_sectors = wp.zero_sectors ? : UINT64_C(4096) >> SECTOR_SHIFT;
+
+ if (zero_sectors > lv->size)
+ zero_sectors = lv->size;
+ }
log_verbose("Initializing %s of logical volume %s with value %d.",
display_size(lv->vg->cmd, zero_sectors),
display_lvname(lv), wp.zero_value);
- if ((wp.zero_value && !dev_set_bytes(dev, UINT64_C(0),
+ if ((!wp.is_metadata &&
+ wp.zero_value && !dev_set_bytes(dev, UINT64_C(0),
(size_t) zero_sectors << SECTOR_SHIFT,
(uint8_t)wp.zero_value)) ||
!dev_write_zeros(dev, UINT64_C(0), (size_t) zero_sectors << SECTOR_SHIFT)) {
@@ -8465,7 +8479,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
.do_zero = lp->zero,
.do_wipe_signatures = lp->wipe_signatures,
.yes = lp->yes,
- .force = lp->force
+ .force = lp->force,
+ .is_metadata = lp->is_metadata,
})) {
log_error("Aborting. Failed to wipe %s.", lp->snapshot
? "snapshot exception store" : "start of new LV");
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 0cc5f37a0..06ea757b8 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -803,6 +803,7 @@ struct wipe_params {
int do_wipe_signatures; /* should we wipe known signatures found on LV? */
int yes; /* answer yes automatically to all questions */
force_t force; /* force mode */
+ int is_metadata; /* wipe volume is metadata LV */
};
/* Zero out LV and/or wipe signatures */
@@ -955,6 +956,7 @@ struct lvcreate_params {
unsigned suppress_zero_warn : 1;
unsigned needs_lockd_init : 1;
unsigned ignore_type : 1;
+ unsigned is_metadata : 1; /* created LV will be used as metadata LV (and can be zeroed) */
const char *vg_name; /* only-used when VG is not yet opened (in /tools) */
const char *lv_name; /* all */
diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c
index bed51f12a..23b5b63ba 100644
--- a/lib/metadata/pool_manip.c
+++ b/lib/metadata/pool_manip.c
@@ -545,8 +545,8 @@ int create_pool(struct logical_volume *pool_lv,
display_lvname(pool_lv));
goto bad;
}
- /* Clear 4KB of pool metadata device. */
- if (!(r = wipe_lv(pool_lv, (struct wipe_params) { .do_zero = 1 }))) {
+ /* Clear pool metadata device. */
+ if (!(r = wipe_lv(pool_lv, (struct wipe_params) { .is_metadata = 1 }))) {
log_error("Aborting. Failed to wipe pool metadata %s.",
display_lvname(pool_lv));
}
@@ -627,6 +627,7 @@ struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
.tags = DM_LIST_HEAD_INIT(lvc.tags),
.temporary = 1,
.zero = 1,
+ .is_metadata = 1,
};
if (!(lvc.segtype = get_segtype_from_string(pool_lv->vg->cmd, SEG_TYPE_NAME_STRIPED)))
@@ -663,6 +664,7 @@ static struct logical_volume *_alloc_pool_metadata_spare(struct volume_group *vg
.tags = DM_LIST_HEAD_INIT(lp.tags),
.temporary = 1,
.zero = 1,
+ .is_metadata = 1,
};
if (!(lp.segtype = get_segtype_from_string(vg->cmd, SEG_TYPE_NAME_STRIPED)))
3 years, 5 months
master - wipe_lv: make error a fatal event
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=edbc5a62b26806e5c4d...
Commit: edbc5a62b26806e5c4de59b5292609e955303576
Parent: 6eb9eba59bf53101b5148ace3ddaf4140592495f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 23 13:56:15 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jun 24 15:01:03 2020 +0200
wipe_lv: make error a fatal event
Failure in wiping/zeroing stop the command.
If user wants to avoid command abortion he should use -Zn or -Wn
to avoid wiping.
Note: there is no easy way to distinguish which kind of failure has
happend - so it's safe to not proceed any futher.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 43 ++++++++++++++++++++++++-------------------
2 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c6dad99e2..b770455fb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.10 -
=================================
+ Failure in zeroing or wiping will fail command (bypass with -Zn, -Wn).
Fix running out of free buffers for async writing for larger writes.
Add integrity with raid capability.
Fix support for lvconvert --repair used by foreign apps (i.e. Docker).
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 1642b90a0..8250819da 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7582,14 +7582,14 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
return 1;
if (!lv_is_active(lv)) {
- log_error("Volume \"%s/%s\" is not active locally (volume_list activation filter?).",
- lv->vg->name, lv->name);
+ log_error("Volume %s is not active locally (volume_list activation filter?).",
+ display_lvname(lv));
return 0;
}
/* Wait until devices are available */
if (!sync_local_dev_names(lv->vg->cmd)) {
- log_error("Failed to sync local devices before wiping LV %s.",
+ log_error("Failed to sync local devices before wiping volume %s.",
display_lvname(lv));
return 0;
}
@@ -7613,17 +7613,20 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
}
if (!label_scan_open_rw(dev)) {
- log_error("Failed to open %s/%s for wiping and zeroing.", lv->vg->name, lv->name);
- goto out;
+ log_error("Failed to open %s for wiping and zeroing.", display_lvname(lv));
+ return 0;
}
if (wp.do_wipe_signatures) {
- log_verbose("Wiping known signatures on logical volume \"%s/%s\"",
- lv->vg->name, lv->name);
+ log_verbose("Wiping known signatures on logical volume %s.",
+ display_lvname(lv));
if (!wipe_known_signatures(lv->vg->cmd, dev, name, 0,
TYPE_DM_SNAPSHOT_COW,
- wp.yes, wp.force, NULL))
- stack;
+ wp.yes, wp.force, NULL)) {
+ log_error("Filed to wipe signatures of logical volume %s.",
+ display_lvname(lv));
+ return 0;
+ }
}
if (wp.do_zero) {
@@ -7632,21 +7635,23 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
if (zero_sectors > lv->size)
zero_sectors = lv->size;
- log_verbose("Initializing %s of logical volume \"%s/%s\" with value %d.",
+ log_verbose("Initializing %s of logical volume %s with value %d.",
display_size(lv->vg->cmd, zero_sectors),
- lv->vg->name, lv->name, wp.zero_value);
-
- if (!wp.zero_value) {
- if (!dev_write_zeros(dev, UINT64_C(0), (size_t) zero_sectors << SECTOR_SHIFT))
- stack;
- } else {
- if (!dev_set_bytes(dev, UINT64_C(0), (size_t) zero_sectors << SECTOR_SHIFT, (uint8_t)wp.zero_value))
- stack;
+ display_lvname(lv), wp.zero_value);
+
+ if ((wp.zero_value && !dev_set_bytes(dev, UINT64_C(0),
+ (size_t) zero_sectors << SECTOR_SHIFT,
+ (uint8_t)wp.zero_value)) ||
+ !dev_write_zeros(dev, UINT64_C(0), (size_t) zero_sectors << SECTOR_SHIFT)) {
+ log_error("Failed to initialize %s of logical volume %s with value %d.",
+ display_size(lv->vg->cmd, zero_sectors),
+ display_lvname(lv), wp.zero_value);
+ return 0;
}
}
label_scan_invalidate(dev);
-out:
+
lv->status &= ~LV_NOSCAN;
return 1;
3 years, 5 months