stable-2.02 - lvcreate: add extra synchronization at error path
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=238da8ddd9c7dd9e9c9...
Commit: 238da8ddd9c7dd9e9c9413564d67e8bd7055b4ec
Parent: b490cddfbcd6f4add64303fcd81751f98f086d4c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 4 18:08:59 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
lvcreate: add extra synchronization at error path
Put explict udev synchronization before we try to deactive devices.
---
lib/metadata/lv_manip.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index cbd4798ac..63ed182bd 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -8150,6 +8150,9 @@ out:
return lv;
deactivate_and_revert_new_lv:
+ if (!sync_local_dev_names(lv->vg->cmd))
+ log_error("Failed to sync local devices before reverting %s.",
+ display_lvname(lv));
if (!deactivate_lv(cmd, lv)) {
log_error("Unable to deactivate failed new LV %s. "
"Manual intervention required.", display_lvname(lv));
3 years, 6 months
stable-2.02 - tests: switch for checking version of installed tools
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b490cddfbcd6f4add64...
Commit: b490cddfbcd6f4add64303fcd81751f98f086d4c
Parent: 844037ecdf64be306310ba48f4ae593cc8fde970
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Sep 11 13:35:30 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
tests: switch for checking version of installed tools
It looks like older tools were compacting metadata more.
---
test/shell/lvextend-thin-metadata-dmeventd.sh | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/test/shell/lvextend-thin-metadata-dmeventd.sh b/test/shell/lvextend-thin-metadata-dmeventd.sh
index 2f16d48b5..5f6db994a 100644
--- a/test/shell/lvextend-thin-metadata-dmeventd.sh
+++ b/test/shell/lvextend-thin-metadata-dmeventd.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2014-2016 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2014-2020 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -19,6 +19,7 @@ export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
. lib/inittest
+
meta_percent_() {
get lv_field $vg/pool metadata_percent | cut -d. -f1
}
@@ -59,6 +60,12 @@ test -n "$LVM_TEST_THIN_RESTORE_CMD" || LVM_TEST_THIN_RESTORE_CMD=$(which thin_r
"$LVM_TEST_THIN_RESTORE_CMD" -V || skip
aux have_thin 1 10 0 || skip
+BIG_DATA=""
+case $("$LVM_TEST_THIN_RESTORE_CMD" -V) in
+ # With older version of thin-tool we got slightly more compact metadata
+ 0.[0-6]*|0.7.0*) BIG_DATA="generate_more_metadata" ;;
+esac
+
aux prepare_dmeventd
aux prepare_pvs 3 256
@@ -91,7 +98,7 @@ lvchange -an $vg/pool
# Consume more then (100% - 4MiB) out of 32MiB metadata volume (>87.5%)
# (Test for less than 4MiB free space in metadata, which is less than 25%)
DATA=7200 # Newer version of thin-pool have hidden reserve, so use lower value
-aux target_at_least dm-thin-pool 1 20 0 || DATA=7400
+test -z "$BIG_DATA" || DATA=7400
fake_metadata_ "$DATA" 2 >data
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv2"
# Swap volume with restored fake metadata
@@ -177,7 +184,7 @@ lvchange -an $vg
#
DATA=300 # Newer version of thin-pool have hidden reserve, so use lower value
-aux target_at_least dm-thin-pool 1 20 0 || DATA=350
+test -z "$BIG_DATA" || DATA=350
fake_metadata_ $DATA 2 >data
lvchange -ay $vg/$lv1
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv1"
3 years, 6 months
stable-2.02 - pvmove: check return value of top_level_lv_name()
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=844037ecdf64be30631...
Commit: 844037ecdf64be306310ba48f4ae593cc8fde970
Parent: 5b579fa79655ca7cf61ce0d7723b42f5ac741f2b
Author: Wu Guanghao <wuguanghao3(a)huawei.com>
AuthorDate: Fri Sep 11 17:40:09 2020 +0800
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
pvmove: check return value of top_level_lv_name()
The return value of top_level_lv_name() may be NULL, so we should
check return value of top_level_lv_name before calling
strcmp(lv->name, top_level_lv_name(vg, lv_name)).
Signed-off-by: Wu Guanghao <wuguanghao3(a)huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26(a)huawei.com>
---
tools/pvmove.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/pvmove.c b/tools/pvmove.c
index cecff00e8..d2776d1c9 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -342,6 +342,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
int lv_skipped = 0;
int needs_exclusive = *exclusive;
const struct logical_volume *holder;
+ const char *new_lv_name;
/* FIXME Cope with non-contiguous => splitting existing segments */
if (!(lv_mirr = lv_create_empty("pvmove%d", NULL,
@@ -379,8 +380,13 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
if (lv == lv_mirr)
continue;
- if (lv_name && strcmp(lv->name, top_level_lv_name(vg, lv_name)))
- continue;
+ if (lv_name) {
+ if (!(new_lv_name = top_level_lv_name(vg, lv_name)))
+ return_NULL;
+
+ if (strcmp(lv->name, new_lv_name))
+ continue;
+ }
if (!lv_is_on_pvs(lv, source_pvl))
continue;
3 years, 6 months
stable-2.02 - gitignore: ignore all cscope generated files
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5b579fa79655ca7cf61...
Commit: 5b579fa79655ca7cf61ce0d7723b42f5ac741f2b
Parent: 9345b9cb26061824a455eda51f67824b28cb42c3
Author: Zhao Heming <heming.zhao(a)suse.com>
AuthorDate: Thu Sep 10 23:38:07 2020 +0800
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
gitignore: ignore all cscope generated files
When using cscope to read code, it will generate below 3 files for speedup
cross-refer: cscope.files, cscope.in.out, cscope.po.out
The .gitignore only contains "/cscope.out". It a little bit messy when
executing 'git status', and other git commands.
This patch add all cscope generated files in .gitignore.
Signed-off-by: Zhao Heming <heming.zhao(a)suse.com>
---
.gitignore | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index f51bb67fc..9fc9101d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,7 +28,9 @@ make.tmpl
/config.log
/config.status
/configure.scan
-/cscope.out
+/cscope.*
+/html/
+/reports/
/tags
/tmp/
3 years, 6 months
stable-2.02 - devices: simplify md superblock checking code
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9345b9cb26061824a45...
Commit: 9345b9cb26061824a455eda51f67824b28cb42c3
Parent: 57ddaaa47dc3f730057ed77bc457c820ed51f29f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Sep 19 12:17:36 2019 -0500
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
devices: simplify md superblock checking code
---
lib/device/dev-md.c | 142 +++++++++++++++++++++++++---------------------------
1 file changed, 68 insertions(+), 74 deletions(-)
diff --git a/lib/device/dev-md.c b/lib/device/dev-md.c
index fa9547009..70154d69b 100644
--- a/lib/device/dev-md.c
+++ b/lib/device/dev-md.c
@@ -75,7 +75,7 @@ struct ddf_header {
char padding[472];
};
-static int _dev_has_ddf_magic(struct device *dev, uint64_t devsize_sectors)
+static int _dev_has_ddf_magic(struct device *dev, uint64_t devsize_sectors, uint64_t *sb_offset)
{
struct ddf_header hdr;
uint32_t crc, our_crc;
@@ -99,8 +99,7 @@ static int _dev_has_ddf_magic(struct device *dev, uint64_t devsize_sectors)
if ((cpu_to_be32(our_crc) == crc) ||
(cpu_to_le32(our_crc) == crc)) {
- log_debug_devs("Found md ddf magic at %llu crc %x %s",
- (unsigned long long)off, crc, dev_name(dev));
+ *sb_offset = off;
return 1;
} else {
log_debug_devs("Found md ddf magic at %llu wrong crc %x disk %x %s",
@@ -123,8 +122,7 @@ static int _dev_has_ddf_magic(struct device *dev, uint64_t devsize_sectors)
if ((cpu_to_be32(our_crc) == crc) ||
(cpu_to_le32(our_crc) == crc)) {
- log_debug_devs("Found md ddf magic at %llu crc %x %s",
- (unsigned long long)off, crc, dev_name(dev));
+ *sb_offset = off;
return 1;
} else {
log_debug_devs("Found md ddf magic at %llu wrong crc %x disk %x %s",
@@ -137,44 +135,17 @@ static int _dev_has_ddf_magic(struct device *dev, uint64_t devsize_sectors)
}
/*
- * Calculate the position of the superblock.
- * It is always aligned to a 4K boundary and
- * depending on minor_version, it can be:
- * 0: At least 8K, but less than 12K, from end of device
- * 1: At start of device
- * 2: 4K from start of device.
+ * _udev_dev_is_md_component() only works if
+ * external_device_info_source="udev"
+ *
+ * but
+ *
+ * udev_dev_is_md_component() in dev-type.c only works if
+ * obtain_device_list_from_udev=1
+ *
+ * and neither of those config setting matches very well
+ * with what we're doing here.
*/
-typedef enum {
- MD_MINOR_VERSION_MIN,
- MD_MINOR_V0 = MD_MINOR_VERSION_MIN,
- MD_MINOR_V1,
- MD_MINOR_V2,
- MD_MINOR_VERSION_MAX = MD_MINOR_V2
-} md_minor_version_t;
-
-static uint64_t _v1_sb_offset(uint64_t size, md_minor_version_t minor_version)
-{
- uint64_t sb_offset;
-
- switch(minor_version) {
- case MD_MINOR_V0:
- sb_offset = (size - 8 * 2) & ~(4 * 2 - 1ULL);
- break;
- case MD_MINOR_V1:
- sb_offset = 0;
- break;
- case MD_MINOR_V2:
- sb_offset = 4 * 2;
- break;
- default:
- log_warn(INTERNAL_ERROR "WARNING: Unknown minor version %d.",
- minor_version);
- return 0;
- }
- sb_offset <<= SECTOR_SHIFT;
-
- return sb_offset;
-}
#ifdef UDEV_SYNC_SUPPORT
static int _udev_dev_is_md(struct device *dev)
@@ -202,7 +173,6 @@ static int _udev_dev_is_md(struct device *dev)
*/
static int _native_dev_is_md(struct device *dev, uint64_t *offset_found, int full)
{
- md_minor_version_t minor;
uint64_t size, sb_offset;
int ret;
@@ -218,9 +188,9 @@ static int _native_dev_is_md(struct device *dev, uint64_t *offset_found, int ful
return 0;
/*
- * Old md versions locate the magic number at the end of the device.
- * Those checks can't be satisfied with the initial bcache data, and
- * would require an extra read i/o at the end of every device. Issuing
+ * Some md versions locate the magic number at the end of the device.
+ * Those checks can't be satisfied with the initial scan data, and
+ * require an extra read i/o at the end of every device. Issuing
* an extra read to every device in every command, just to check for
* the old md format is a bad tradeoff.
*
@@ -231,54 +201,78 @@ static int _native_dev_is_md(struct device *dev, uint64_t *offset_found, int ful
* and set it for commands that could possibly write to an md dev
* (pvcreate/vgcreate/vgextend).
*/
- if (!full) {
- sb_offset = 0;
- if (_dev_has_md_magic(dev, sb_offset)) {
- log_debug_devs("Found md magic number at offset 0 of %s.", dev_name(dev));
- ret = 1;
- goto out;
- }
- sb_offset = 8 << SECTOR_SHIFT;
- if (_dev_has_md_magic(dev, sb_offset)) {
- log_debug_devs("Found md magic number at offset %d of %s.", (int)sb_offset, dev_name(dev));
- ret = 1;
- goto out;
- }
+ /*
+ * md superblock version 1.1 at offset 0 from start
+ */
+
+ if (_dev_has_md_magic(dev, 0)) {
+ log_debug_devs("Found md magic number at offset 0 of %s.", dev_name(dev));
+ ret = 1;
+ goto out;
+ }
+
+ /*
+ * md superblock version 1.2 at offset 4KB from start
+ */
+ if (_dev_has_md_magic(dev, 4096)) {
+ log_debug_devs("Found md magic number at offset 4096 of %s.", dev_name(dev));
+ ret = 1;
+ goto out;
+ }
+
+ if (!full) {
ret = 0;
goto out;
}
- /* Version 0.90.0 */
- /* superblock at 64KB from end of device */
+ /*
+ * Handle superblocks at the end of the device.
+ */
+
+ /*
+ * md superblock version 0 at 64KB from end of device
+ * (after end is aligned to 64KB)
+ */
+
sb_offset = MD_NEW_SIZE_SECTORS(size) << SECTOR_SHIFT;
+
if (_dev_has_md_magic(dev, sb_offset)) {
+ log_debug_devs("Found md magic number at offset %llu of %s.", (unsigned long long)sb_offset, dev_name(dev));
ret = 1;
goto out;
}
- minor = MD_MINOR_VERSION_MIN;
+ /*
+ * md superblock version 1.0 at 8KB from end of device
+ */
- /* Version 1, try v1.0 -> v1.2 */
+ sb_offset = ((size - 8 * 2) & ~(4 * 2 - 1ULL)) << SECTOR_SHIFT;
- do {
- /* superblock at start or 4K from start */
- sb_offset = _v1_sb_offset(size, minor);
- if (_dev_has_md_magic(dev, sb_offset)) {
- ret = 1;
- goto out;
- }
- } while (++minor <= MD_MINOR_VERSION_MAX);
+ if (_dev_has_md_magic(dev, sb_offset)) {
+ log_debug_devs("Found md magic number at offset %llu of %s.", (unsigned long long)sb_offset, dev_name(dev));
+ ret = 1;
+ goto out;
+ }
+
+ /*
+ * md imsm superblock 1K from end of device
+ */
- /* superblock 1K from end of device */
if (_dev_has_imsm_magic(dev, size)) {
+ log_debug_devs("Found md imsm magic number at offset %llu of %s.", (unsigned long long)sb_offset, dev_name(dev));
+ sb_offset = 1024;
ret = 1;
goto out;
}
- /* superblock 512 bytes from end, or 128KB from end */
- if (_dev_has_ddf_magic(dev, size)) {
+ /*
+ * md ddf superblock 512 bytes from end, or 128KB from end
+ */
+
+ if (_dev_has_ddf_magic(dev, size, &sb_offset)) {
+ log_debug_devs("Found md ddf magic number at offset %llu of %s.", (unsigned long long)sb_offset, dev_name(dev));
ret = 1;
goto out;
}
3 years, 6 months
stable-2.02 - devices: detect md ddf and imsm superblocks
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=57ddaaa47dc3f730057...
Commit: 57ddaaa47dc3f730057ed77bc457c820ed51f29f
Parent: db7aef215afba518024aefea3e412f23cf7b80bd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Sep 19 11:33:59 2019 -0500
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
devices: detect md ddf and imsm superblocks
---
lib/device/dev-md.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 104 insertions(+), 1 deletion(-)
diff --git a/lib/device/dev-md.c b/lib/device/dev-md.c
index 972850726..fa9547009 100644
--- a/lib/device/dev-md.c
+++ b/lib/device/dev-md.c
@@ -16,6 +16,7 @@
#include "lib.h"
#include "dev-type.h"
#include "xlate.h"
+#include "crc.h"
#ifdef UDEV_SYNC_SUPPORT
#include <libudev.h> /* for MD detection using udev db records */
#include "dev-ext-udev-constants.h"
@@ -48,6 +49,93 @@ static int _dev_has_md_magic(struct device *dev, uint64_t sb_offset)
return 0;
}
+#define IMSM_SIGNATURE "Intel Raid ISM Cfg Sig. "
+#define IMSM_SIG_LEN (strlen(IMSM_SIGNATURE))
+
+static int _dev_has_imsm_magic(struct device *dev, uint64_t devsize_sectors)
+{
+ char imsm_signature[IMSM_SIG_LEN];
+ uint64_t off = (devsize_sectors * 512) - 1024;
+
+ if (!dev_read_bytes(dev, off, IMSM_SIG_LEN, imsm_signature))
+ return_0;
+
+ if (!memcmp(imsm_signature, IMSM_SIGNATURE, IMSM_SIG_LEN))
+ return 1;
+
+ return 0;
+}
+
+#define DDF_MAGIC 0xDE11DE11
+struct ddf_header {
+ uint32_t magic;
+ uint32_t crc;
+ char guid[24];
+ char revision[8];
+ char padding[472];
+};
+
+static int _dev_has_ddf_magic(struct device *dev, uint64_t devsize_sectors)
+{
+ struct ddf_header hdr;
+ uint32_t crc, our_crc;
+ uint64_t off;
+ uint64_t devsize_bytes = devsize_sectors * 512;
+
+ if (devsize_bytes < 0x30000)
+ return 0;
+
+ /* 512 bytes before the end of device (from libblkid) */
+ off = ((devsize_bytes / 0x200) - 1) * 0x200;
+
+ if (!dev_read_bytes(dev, off, 512, &hdr))
+ return_0;
+
+ if ((hdr.magic == cpu_to_be32(DDF_MAGIC)) ||
+ (hdr.magic == cpu_to_le32(DDF_MAGIC))) {
+ crc = hdr.crc;
+ hdr.crc = 0xffffffff;
+ our_crc = calc_crc(0, (const uint8_t *)&hdr, 512);
+
+ if ((cpu_to_be32(our_crc) == crc) ||
+ (cpu_to_le32(our_crc) == crc)) {
+ log_debug_devs("Found md ddf magic at %llu crc %x %s",
+ (unsigned long long)off, crc, dev_name(dev));
+ return 1;
+ } else {
+ log_debug_devs("Found md ddf magic at %llu wrong crc %x disk %x %s",
+ (unsigned long long)off, our_crc, crc, dev_name(dev));
+ return 0;
+ }
+ }
+
+ /* 128KB before the end of device (from libblkid) */
+ off = ((devsize_bytes / 0x200) - 257) * 0x200;
+
+ if (!dev_read_bytes(dev, off, 512, &hdr))
+ return_0;
+
+ if ((hdr.magic == cpu_to_be32(DDF_MAGIC)) ||
+ (hdr.magic == cpu_to_le32(DDF_MAGIC))) {
+ crc = hdr.crc;
+ hdr.crc = 0xffffffff;
+ our_crc = calc_crc(0, (const uint8_t *)&hdr, 512);
+
+ if ((cpu_to_be32(our_crc) == crc) ||
+ (cpu_to_le32(our_crc) == crc)) {
+ log_debug_devs("Found md ddf magic at %llu crc %x %s",
+ (unsigned long long)off, crc, dev_name(dev));
+ return 1;
+ } else {
+ log_debug_devs("Found md ddf magic at %llu wrong crc %x disk %x %s",
+ (unsigned long long)off, our_crc, crc, dev_name(dev));
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
/*
* Calculate the position of the superblock.
* It is always aligned to a 4K boundary and
@@ -162,8 +250,8 @@ static int _native_dev_is_md(struct device *dev, uint64_t *offset_found, int ful
goto out;
}
- /* Check if it is an md component device. */
/* Version 0.90.0 */
+ /* superblock at 64KB from end of device */
sb_offset = MD_NEW_SIZE_SECTORS(size) << SECTOR_SHIFT;
if (_dev_has_md_magic(dev, sb_offset)) {
ret = 1;
@@ -171,8 +259,11 @@ static int _native_dev_is_md(struct device *dev, uint64_t *offset_found, int ful
}
minor = MD_MINOR_VERSION_MIN;
+
/* Version 1, try v1.0 -> v1.2 */
+
do {
+ /* superblock at start or 4K from start */
sb_offset = _v1_sb_offset(size, minor);
if (_dev_has_md_magic(dev, sb_offset)) {
ret = 1;
@@ -180,6 +271,18 @@ static int _native_dev_is_md(struct device *dev, uint64_t *offset_found, int ful
}
} while (++minor <= MD_MINOR_VERSION_MAX);
+ /* superblock 1K from end of device */
+ if (_dev_has_imsm_magic(dev, size)) {
+ ret = 1;
+ goto out;
+ }
+
+ /* superblock 512 bytes from end, or 128KB from end */
+ if (_dev_has_ddf_magic(dev, size)) {
+ ret = 1;
+ goto out;
+ }
+
ret = 0;
out:
if (ret && offset_found)
3 years, 6 months
stable-2.02 - dev-cache: dev->bcache_fd default from 0 to -1
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=db7aef215afba518024...
Commit: db7aef215afba518024aefea3e412f23cf7b80bd
Parent: 667cfeeacfae7941b662bffede86e38d425575c5
Author: Zhao Heming <heming.zhao(a)suse.com>
AuthorDate: Mon Jun 1 12:22:15 2020 -0500
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
dev-cache: dev->bcache_fd default from 0 to -1
This fix can avoid bcache_fd will mistakenly open/close in later.
Signed-off-by: Zhao Heming <heming.zhao(a)suse.com>
---
lib/device/dev-cache.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 1e7dfdea6..3e8105be7 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -66,6 +66,7 @@ static void _dev_init(struct device *dev, int max_error_count)
dev->phys_block_size = -1;
dev->block_size = -1;
dev->fd = -1;
+ dev->bcache_fd = -1;
dev->read_ahead = -1;
dev->max_error_count = max_error_count;
3 years, 6 months
stable-2.02 - vgrename: fix error value when name exists
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=667cfeeacfae7941b66...
Commit: 667cfeeacfae7941b662bffede86e38d425575c5
Parent: d1f7c531eb20e580d02fc0950d12df34cb2fc51b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 21 09:33:56 2020 -0500
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
vgrename: fix error value when name exists
---
tools/vgrename.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/vgrename.c b/tools/vgrename.c
index f13289e53..d2dee3ddf 100644
--- a/tools/vgrename.c
+++ b/tools/vgrename.c
@@ -194,7 +194,7 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
vg_name_new = skip_dev_dir(cmd, argv[1], NULL);
if (!validate_vg_rename_params(cmd, vg_name_old, vg_name_new))
- return_0;
+ return_ECMD_FAILED;
if (!(vp.vg_name_old = dm_pool_strdup(cmd->mem, vg_name_old)))
return_ECMD_FAILED;
3 years, 6 months
stable-2.02 - tests: improve cache abort test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d1f7c531eb20e580d02...
Commit: d1f7c531eb20e580d02fc0950d12df34cb2fc51b
Parent: 4ebc8875d3f09cd446d1001361dc81af4cb8ded3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Sep 13 11:33:13 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
tests: improve cache abort test
Use bigger volume and slowdown writing to cache device.
This allows more simple to reach 'dirty' state.
Also document exactly 1 SIGINT has to fire aborting of flushing.
---
test/shell/lvconvert-cache-abort.sh | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/test/shell/lvconvert-cache-abort.sh b/test/shell/lvconvert-cache-abort.sh
index 404f44269..652c9f421 100644
--- a/test/shell/lvconvert-cache-abort.sh
+++ b/test/shell/lvconvert-cache-abort.sh
@@ -21,24 +21,28 @@ aux have_cache 1 3 0 || skip
aux prepare_vg 2
+SIZE_MB=4
+
# Data device on later delayed dev1
lvcreate -L4 -n cpool $vg "$dev1"
lvconvert -y --type cache-pool $vg/cpool "$dev2"
-lvcreate -H -L 4 -n $lv1 --chunksize 32k --cachemode writeback --cachepool $vg/cpool $vg "$dev2"
+lvcreate -H -L $SIZE_MB -n $lv1 --chunksize 32k --cachemode writeback --cachepool $vg/cpool $vg "$dev2"
#
# Ensure cache gets promoted blocks
#
-for i in $(seq 1 10) ; do
+for i in $(seq 1 3) ; do
echo 3 >/proc/sys/vm/drop_caches
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=64K count=20 conv=fdatasync || true
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=$SIZE_MB conv=fdatasync || true
echo 3 >/proc/sys/vm/drop_caches
-dd if="$DM_DEV_DIR/$vg/$lv1" of=/dev/null bs=64K count=20 || true
+dd if="$DM_DEV_DIR/$vg/$lv1" of=/dev/null bs=1M count=$SIZE_MB || true
done
+aux delay_dev "$dev2" 0 300 "$(get first_extent_sector "$dev2"):"
+dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=$SIZE_MB
+lvdisplay --maps $vg
# Delay dev to ensure we have some time to 'capture' interrupt in flush
-aux delay_dev "$dev1" 100 0 "$(get first_extent_sector "$dev1"):"
# TODO, how to make writeback cache dirty
test "$(get lv_field $vg/$lv1 cache_dirty_blocks)" -gt 0 || {
@@ -46,9 +50,6 @@ test "$(get lv_field $vg/$lv1 cache_dirty_blocks)" -gt 0 || {
skip "Cannot make a dirty writeback cache LV."
}
-sync
-dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=4k count=100 conv=fdatasync
-
LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -v --splitcache $vg/$lv1 >logconvert 2>&1 &
PID_CONVERT=$!
for i in {1..50}; do
@@ -57,10 +58,16 @@ for i in {1..50}; do
echo "Waiting for cleaner policy on $vg/$lv1"
sleep .05
done
+
+# While lvconvert updated table to 'cleaner' policy now it
+# should be running in 'Flushing' loop and just 1 KILL should
+# cause abortion of flushing
kill -INT $PID_CONVERT
-aux enable_dev "$dev1"
+aux enable_dev "$dev2"
wait
+#cat logconvert || true
+
grep -E "Flushing.*aborted" logconvert || {
cat logconvert || true
vgremove -f $vg
3 years, 6 months
stable-2.02 - tests: check in_sync prints also dm status
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4ebc8875d3f09cd446d...
Commit: 4ebc8875d3f09cd446d1001361dc81af4cb8ded3
Parent: 0881ba9e9f32144d5a538b9920367c494513d23a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 12 19:04:56 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200
tests: check in_sync prints also dm status
It's more useful to see how the progress of status checking is moving.
---
test/lib/check.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/lib/check.sh b/test/lib/check.sh
index 8637619f4..4deb78a74 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -216,7 +216,7 @@ in_sync() {
idx=6
type=${a[3]}
if [ "${a[$(( idx + 1 ))]}" != "idle" ]; then
- echo "$lvm_name ($type$snap) is not in-sync"
+ echo "$lvm_name ($type$snap) is not in-sync " "${a[@]}"
return 1
fi
;;
@@ -234,19 +234,19 @@ in_sync() {
c=${a[$idx]##*/}
if [ "$b" -eq 0 ] || [ "$b" != "$c" ]; then
- echo "$lvm_name ($type$snap) is not in-sync"
+ echo "$lvm_name ($type$snap) is not in-sync " "${a[@]}"
return 1
fi
if [[ ${a[$(( idx - 1 ))]} =~ a ]] ; then
[ "$ignore_a" = 0 ] && \
die "$lvm_name ($type$snap) in-sync, but 'a' characters in health status"
- echo "$lvm_name ($type$snap) is not in-sync"
+ echo "$lvm_name ($type$snap) is not in-sync " "${a[@]}"
[ "$ignore_a" = 1 ] && return 0
return 1
fi
- echo "$lvm_name ($type$snap) is in-sync" "${a[@]}"
+ echo "$lvm_name ($type$snap) is in-sync " "${a[@]}"
}
active() {
3 years, 6 months