import lvm2-2.03.09-5.el8

This commit is contained in:
CentOS Sources 2020-11-03 06:50:34 -05:00 committed by Andrew Lukoshko
parent 66129b87c0
commit da888a430e
28 changed files with 16477 additions and 416 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/LVM2.2.03.08.tgz
SOURCES/LVM2.2.03.09.tgz

View File

@ -1 +1 @@
ed5cd9f81b22ad5d76b927711c977463879d8afd SOURCES/LVM2.2.03.08.tgz
15a90d5039a2a1e9f67611a2a6c2faa72e8996aa SOURCES/LVM2.2.03.09.tgz

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,210 @@
From f540a18fd7f5f65599a6c85c0bd3ba84e54f1cc8 Mon Sep 17 00:00:00 2001
From: Marian Csontos <mcsontos@redhat.com>
Date: Thu, 28 May 2020 18:02:16 +0200
Subject: [PATCH] Merge master up to commit be61bd6ff5c6
---
VERSION | 2 +-
VERSION_DM | 2 +-
test/shell/cache-single-usage.sh | 13 +++++++++++++
test/shell/integrity-dmeventd.sh | 8 ++++++++
test/shell/integrity-large.sh | 8 ++++++++
test/shell/integrity-misc.sh | 8 ++++++++
test/shell/integrity.sh | 8 ++++++++
test/shell/thin-foreign-repair.sh | 14 ++++++++++----
tools/lvconvert.c | 15 +++++++++++++++
9 files changed, 72 insertions(+), 6 deletions(-)
diff --git a/VERSION b/VERSION
index 00618e0..9ad7a70 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.03.09(2)-RHEL8 (2020-04-21)
+2.03.09(2)-RHEL8 (2020-05-28)
diff --git a/VERSION_DM b/VERSION_DM
index b9ec43e..bcd97de 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.171-RHEL8 (2020-04-21)
+1.02.171-RHEL8 (2020-05-28)
diff --git a/test/shell/cache-single-usage.sh b/test/shell/cache-single-usage.sh
index a885bf7..8936aa3 100644
--- a/test/shell/cache-single-usage.sh
+++ b/test/shell/cache-single-usage.sh
@@ -127,4 +127,17 @@ umount "$mount_dir"
lvchange -an $vg/$lv1
lvchange -an $vg/$lv2
+# misc tests
+
+lvremove $vg
+
+lvcreate -n $lv1 -l 2 -an $vg "$dev1"
+lvcreate -n $lv2 -l 2 -an $vg "$dev1"
+lvcreate -n $lv3 -l 2 -an $vg "$dev2"
+
+lvconvert -y --type writecache --cachevol $lv3 $vg/$lv1
+not lvconvert -y --type writecache --cachevol ${lv3}_cvol $vg/$lv2
+not lvconvert -y --type cache --cachevol ${lv3}_cvol $vg/$lv2
+not lvconvert -y --type cache --cachepool ${lv3}_cvol $vg/$lv2
+
vgremove -ff $vg
diff --git a/test/shell/integrity-dmeventd.sh b/test/shell/integrity-dmeventd.sh
index ed2436a..296f556 100644
--- a/test/shell/integrity-dmeventd.sh
+++ b/test/shell/integrity-dmeventd.sh
@@ -109,6 +109,14 @@ _wait_recalc() {
sleep 1
done
+ # TODO: There is some strange bug, first leg of RAID with integrity
+ # enabled never gets in sync. I saw this in BB, but not when executing
+ # the commands manually
+ if test -z "$sync"; then
+ echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
+ dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
+ exit
+ fi
echo "timeout waiting for recalc"
return 1
}
diff --git a/test/shell/integrity-large.sh b/test/shell/integrity-large.sh
index 7a333c1..5aba80e 100644
--- a/test/shell/integrity-large.sh
+++ b/test/shell/integrity-large.sh
@@ -95,6 +95,14 @@ _wait_recalc() {
sleep 1
done
+ # TODO: There is some strange bug, first leg of RAID with integrity
+ # enabled never gets in sync. I saw this in BB, but not when executing
+ # the commands manually
+ if test -z "$sync"; then
+ echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
+ dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
+ exit
+ fi
echo "timeout waiting for recalc"
return 1
}
diff --git a/test/shell/integrity-misc.sh b/test/shell/integrity-misc.sh
index a176f18..0d05689 100644
--- a/test/shell/integrity-misc.sh
+++ b/test/shell/integrity-misc.sh
@@ -109,6 +109,14 @@ _wait_recalc() {
sleep 1
done
+ # TODO: There is some strange bug, first leg of RAID with integrity
+ # enabled never gets in sync. I saw this in BB, but not when executing
+ # the commands manually
+ if test -z "$sync"; then
+ echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
+ dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
+ exit
+ fi
echo "timeout waiting for recalc"
return 1
}
diff --git a/test/shell/integrity.sh b/test/shell/integrity.sh
index 6baccf0..77e9430 100644
--- a/test/shell/integrity.sh
+++ b/test/shell/integrity.sh
@@ -204,6 +204,14 @@ _wait_recalc() {
sleep 1
done
+ # TODO: There is some strange bug, first leg of RAID with integrity
+ # enabled never gets in sync. I saw this in BB, but not when executing
+ # the commands manually
+ if test -z "$sync"; then
+ echo "TEST WARNING: Resync of dm-integrity device '$checklv' failed"
+ dmsetup status "$DM_DEV_DIR/mapper/${checklv/\//-}"
+ exit
+ fi
echo "timeout waiting for recalc"
return 1
}
diff --git a/test/shell/thin-foreign-repair.sh b/test/shell/thin-foreign-repair.sh
index 8b4018e..55e9f62 100644
--- a/test/shell/thin-foreign-repair.sh
+++ b/test/shell/thin-foreign-repair.sh
@@ -17,9 +17,15 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
+clean_thin_()
+{
+ aux udev_wait
+ dmsetup remove "$THIN" || { sleep .5 ; dmsetup remove "$THIN" ; }
+}
+
cleanup_mounted_and_teardown()
{
- dmsetup remove $THIN || true
+ clean_thin_ || true
vgremove -ff $vg
aux teardown
}
@@ -56,9 +62,7 @@ dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
mkfs.ext4 "$DM_DEV_DIR/mapper/$THIN"
-aux udev_wait
-
-dmsetup remove "$THIN" || { sleep .5 ; dmsetup remove "$THIN" }
+clean_thin_
lvchange -an $vg/pool
@@ -72,3 +76,5 @@ lvchange -ay $vg/pool
dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
fsck -n "$DM_DEV_DIR/mapper/$THIN"
+
+# exit calls cleanup_mounted_and_teardown
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index cf93538..8652252 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -4264,6 +4264,11 @@ static int _lvconvert_cachevol_attach_single(struct cmd_context *cmd,
goto out;
}
+ if (lv_is_cache_vol(cachevol_lv)) {
+ log_error("LV %s is already used as a cachevol.", display_lvname(cachevol_lv));
+ goto out;
+ }
+
/* Ensure the LV is not active elsewhere. */
if (!lockd_lv(cmd, lv, "ex", 0))
goto_out;
@@ -4347,6 +4352,11 @@ static int _lvconvert_cachepool_attach_single(struct cmd_context *cmd,
goto out;
}
+ if (lv_is_cache_vol(cachepool_lv)) {
+ log_error("LV %s is already used as a cachevol.", display_lvname(cachepool_lv));
+ goto out;
+ }
+
if (cachepool_lv == lv) {
log_error("Use a different LV for cache pool LV and cache LV %s.",
display_lvname(cachepool_lv));
@@ -5629,6 +5639,11 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
goto bad;
}
+ if (lv_is_cache_vol(lv_fast)) {
+ log_error("LV %s is already used as a cachevol.", display_lvname(lv_fast));
+ goto bad;
+ }
+
/*
* To permit this we need to check the block size of the fs using lv
* (recently in libblkid) so that we can use a matching writecache
--
1.8.3.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,422 @@
From 99b646d87469b5ca0e93fad6b77f51a00fbbd2b7 Mon Sep 17 00:00:00 2001
From: Marian Csontos <mcsontos@redhat.com>
Date: Wed, 12 Aug 2020 18:47:15 +0200
Subject: [PATCH] Revert "debug: missing stacktrace"
This reverts commit d0faad0db38fe733cae42d7df136d7ed4f7bcba6.
Revert "raid: no wiping when zeroing raid metadata device"
This reverts commit 9b9bf8786fb423a4430cc676301edadf2310098d.
Revert "lvconvert: more support for yes conversion"
This reverts commit b7f3667ce20b731bbda9b1d61df49abbcd1bd20e.
Revert "wipe_lv: always zero at least 4K"
This reverts commit fe78cd4082cb9af10580180d61898fcef93dc624.
Revert "tests: check pool metadata are zeroed"
This reverts commit 3f32f9811e01c8953d201c7c9b563561ad856130.
Revert "tests: failure of zeroing fails command"
This reverts commit 094d6f80ddb6d8a1c64977dfaae4073827063fe3.
Revert "make: make generate"
This reverts commit 88b92d4225b90db82047f3bac55d8059918e9c1b.
Conflicts:
man/lvconvert.8_pregen
Revert "pool: zero metadata"
This reverts commit bc39d5bec6fea787a8d8d16fa484084b7d2a7c29.
Conflicts:
WHATS_NEW
Revert "wipe_lv: make error a fatal event"
This reverts commit edbc5a62b26806e5c4de59b5292609e955303576.
Conflicts:
WHATS_NEW
build: make generate
---
WHATS_NEW | 2 -
conf/example.conf.in | 6 +--
lib/config/config_settings.h | 5 +--
lib/config/defaults.h | 1 -
lib/metadata/lv_manip.c | 78 ++++++++++++---------------------
lib/metadata/metadata-exported.h | 2 -
lib/metadata/pool_manip.c | 6 +--
test/lib/aux.sh | 1 -
test/shell/lvcreate-signature-wiping.sh | 7 ---
test/shell/lvcreate-thin.sh | 21 ---------
tools/lvconvert.c | 12 ++---
11 files changed, 36 insertions(+), 105 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ac99e97..6a098b5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -6,8 +6,6 @@ Version 2.03.10 -
warning.
Fix conversion to raid from striped lagging type.
Fix conversion to 'mirrored' mirror log with larger regionsize.
- 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.
Fix support for lvconvert --repair used by foreign apps (i.e. Docker).
diff --git a/conf/example.conf.in b/conf/example.conf.in
index d5807e6..88858fc 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -489,7 +489,7 @@ allocation {
# This configuration option does not have a default value defined.
# Configuration option allocation/thin_pool_metadata_require_separate_pvs.
- # Thin pool metadata and data will always use different PVs.
+ # Thin pool metdata and data will always use different PVs.
thin_pool_metadata_require_separate_pvs = 0
# Configuration option allocation/thin_pool_zero.
@@ -527,10 +527,6 @@ 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/lib/config/config_settings.h b/lib/config/config_settings.h
index b38ca11..dce9705 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 metadata and data will always use different PVs.\n")
+ "Thin pool metdata 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,9 +657,6 @@ 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 708a575..be4f5ff 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -129,7 +129,6 @@
#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 f0ba3f0..1642b90 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7576,22 +7576,20 @@ 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 && !wp.is_metadata)
+ if (!wp.do_zero && !wp.do_wipe_signatures)
/* nothing to do */
return 1;
if (!lv_is_active(lv)) {
- log_error("Volume %s is not active locally (volume_list activation filter?).",
- display_lvname(lv));
+ log_error("Volume \"%s/%s\" is not active locally (volume_list activation filter?).",
+ lv->vg->name, lv->name);
return 0;
}
/* Wait until devices are available */
if (!sync_local_dev_names(lv->vg->cmd)) {
- log_error("Failed to sync local devices before wiping volume %s.",
+ log_error("Failed to sync local devices before wiping LV %s.",
display_lvname(lv));
return 0;
}
@@ -7615,59 +7613,40 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
}
if (!label_scan_open_rw(dev)) {
- log_error("Failed to open %s for wiping and zeroing.", display_lvname(lv));
- return 0;
+ log_error("Failed to open %s/%s for wiping and zeroing.", lv->vg->name, lv->name);
+ goto out;
}
if (wp.do_wipe_signatures) {
- log_verbose("Wiping known signatures on logical volume %s.",
- display_lvname(lv));
+ log_verbose("Wiping known signatures on logical volume \"%s/%s\"",
+ lv->vg->name, lv->name);
if (!wipe_known_signatures(lv->vg->cmd, dev, name, 0,
TYPE_DM_SNAPSHOT_COW,
- wp.yes, wp.force, NULL)) {
- log_error("Filed to wipe signatures of logical volume %s.",
- display_lvname(lv));
- return 0;
- }
+ wp.yes, wp.force, NULL))
+ stack;
}
- 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 = UINT64_C(4096) >> SECTOR_SHIFT;
- if (wp.zero_sectors > zero_sectors)
- zero_sectors = wp.zero_sectors;
+ if (wp.do_zero) {
+ zero_sectors = wp.zero_sectors ? : UINT64_C(4096) >> SECTOR_SHIFT;
- if (zero_sectors > lv->size)
- zero_sectors = lv->size;
- }
+ if (zero_sectors > lv->size)
+ zero_sectors = lv->size;
- log_verbose("Initializing %s of logical volume %s with value %d.",
+ log_verbose("Initializing %s of logical volume \"%s/%s\" with value %d.",
display_size(lv->vg->cmd, zero_sectors),
- display_lvname(lv), wp.zero_value);
-
- 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)) {
- 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;
+ 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;
}
}
label_scan_invalidate(dev);
-
+out:
lv->status &= ~LV_NOSCAN;
return 1;
@@ -7731,10 +7710,12 @@ int activate_and_wipe_lvlist(struct dm_list *lv_list, int commit)
}
dm_list_iterate_items(lvl, lv_list) {
+ log_verbose("Wiping metadata area %s.", display_lvname(lvl->lv));
/* Wipe any know signatures */
- if (!wipe_lv(lvl->lv, (struct wipe_params) { .do_zero = 1 /* TODO: is_metadata = 1 */ })) {
+ if (!wipe_lv(lvl->lv, (struct wipe_params) { .do_wipe_signatures = 1, .do_zero = 1, .zero_sectors = 1 })) {
+ log_error("Failed to wipe %s.", display_lvname(lvl->lv));
r = 0;
- goto_out;
+ goto out;
}
}
out:
@@ -8479,8 +8460,7 @@ 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,
- .is_metadata = lp->is_metadata,
+ .force = lp->force
})) {
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 06ea757..0cc5f37 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -803,7 +803,6 @@ 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 */
@@ -956,7 +955,6 @@ 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 23b5b63..bed51f1 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 pool metadata device. */
- if (!(r = wipe_lv(pool_lv, (struct wipe_params) { .is_metadata = 1 }))) {
+ /* Clear 4KB of pool metadata device. */
+ if (!(r = wipe_lv(pool_lv, (struct wipe_params) { .do_zero = 1 }))) {
log_error("Aborting. Failed to wipe pool metadata %s.",
display_lvname(pool_lv));
}
@@ -627,7 +627,6 @@ 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)))
@@ -664,7 +663,6 @@ 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)))
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 17e7935..e40da95 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1234,7 +1234,6 @@ 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-signature-wiping.sh b/test/shell/lvcreate-signature-wiping.sh
index 18d7a2f..73fea54 100644
--- a/test/shell/lvcreate-signature-wiping.sh
+++ b/test/shell/lvcreate-signature-wiping.sh
@@ -42,13 +42,6 @@ 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
diff --git a/test/shell/lvcreate-thin.sh b/test/shell/lvcreate-thin.sh
index c073eaf..9ca7f11 100644
--- a/test/shell/lvcreate-thin.sh
+++ b/test/shell/lvcreate-thin.sh
@@ -248,25 +248,4 @@ 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
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 524ed5a..6324ed7 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3286,11 +3286,7 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
}
metadata_lv->status &= ~LV_ACTIVATION_SKIP;
- if (!wipe_lv(metadata_lv, (struct wipe_params) {
- .do_wipe_signatures = 1,
- .is_metadata = 1,
- .yes = arg_count(cmd, yes_ARG),
- .force = arg_count(cmd, force_ARG) } )) {
+ if (!wipe_lv(metadata_lv, (struct wipe_params) { .do_zero = 1 })) {
log_error("Aborting. Failed to wipe metadata lv.");
goto bad;
}
@@ -5527,8 +5523,7 @@ static int _writecache_zero(struct cmd_context *cmd, struct logical_volume *lv)
struct wipe_params wp = {
.do_wipe_signatures = 1, /* optional, to print warning if clobbering something */
.do_zero = 1, /* required for dm-writecache to work */
- .yes = arg_count(cmd, yes_ARG),
- .force = arg_count(cmd, force_ARG)
+ .zero_sectors = 1
};
int ret;
@@ -5545,8 +5540,7 @@ static int _writecache_zero(struct cmd_context *cmd, struct logical_volume *lv)
return 0;
}
- if (!(ret = wipe_lv(lv, wp)))
- stack;
+ ret = wipe_lv(lv, wp);
if (!deactivate_lv(cmd, lv)) {
log_error("Failed to deactivate LV %s for zeroing.", display_lvname(lv));
--
1.8.3.1

View File

@ -1,70 +0,0 @@
WHATS_NEW | 4 ++++
lib/activate/dev_manager.c | 14 +++++++-------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 50a0045..30f1391 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,7 @@
+Version 2.03.09 -
+====================================
+ Fix showing of a dm kernel error when uncaching a volume with cachevol.
+
Version 2.03.08 - 11th February 2020
====================================
Prevent problematic snapshots of writecache volumes.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 8569e86..c8a22fb 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -3161,8 +3161,8 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
char *dlid_meta;
char *dlid_data;
char *dlid_pool;
- uint64_t meta_len = first_seg(lv)->metadata_len;
- uint64_t data_len = first_seg(lv)->data_len;
+ uint64_t meta_size = first_seg(lv)->metadata_len;
+ uint64_t data_size = first_seg(lv)->data_len;
uint16_t udev_flags = _get_udev_flags(dm, lv, layer,
laopts->noscan, laopts->temporary,
0);
@@ -3210,12 +3210,12 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
if (dm->track_pending_delete) {
log_debug_activation("Using error for pending meta delete %s.", display_lvname(lv));
- if (!dm_tree_node_add_error_target(dnode_meta, (uint64_t)lv->vg->extent_size * meta_len))
+ if (!dm_tree_node_add_error_target(dnode_meta, meta_size))
return_0;
} else {
/* add load_segment to meta dnode: linear, size of meta area */
if (!add_linear_area_to_dtree(dnode_meta,
- meta_len,
+ meta_size,
lv->vg->extent_size,
lv->vg->cmd->use_linear_target,
lv->vg->name, lv->name))
@@ -3239,19 +3239,19 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
if (dm->track_pending_delete) {
log_debug_activation("Using error for pending data delete %s.", display_lvname(lv));
- if (!dm_tree_node_add_error_target(dnode_data, (uint64_t)lv->vg->extent_size * data_len))
+ if (!dm_tree_node_add_error_target(dnode_data, data_size))
return_0;
} else {
/* add load_segment to data dnode: linear, size of data area */
if (!add_linear_area_to_dtree(dnode_data,
- data_len,
+ data_size,
lv->vg->extent_size,
lv->vg->cmd->use_linear_target,
lv->vg->name, lv->name))
return_0;
/* add seg_area to prev load_seg: offset 0 maps to cachepool lv after meta */
- if (!dm_tree_node_add_target_area(dnode_data, NULL, dlid_pool, meta_len))
+ if (!dm_tree_node_add_target_area(dnode_data, NULL, dlid_pool, meta_size))
return_0;
}
}

View File

@ -1,36 +0,0 @@
From 54d0cb47848f2abfcbe106dc65250f612c7b1455 Mon Sep 17 00:00:00 2001
From: Marian Csontos <mcsontos@redhat.com>
Date: Wed, 18 Mar 2020 14:30:09 +0100
Subject: [PATCH] test: Can not attach writecache to active volume
---
test/shell/writecache.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/test/shell/writecache.sh b/test/shell/writecache.sh
index 0a7f694..a7a2d95 100644
--- a/test/shell/writecache.sh
+++ b/test/shell/writecache.sh
@@ -139,8 +139,10 @@ mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
cp pattern1 $mount_dir/pattern1
ls -l $mount_dir
-lvconvert --yes --type writecache --cachevol $lv2 $vg/$lv1
+# TODO BZ 1808012 - can not convert active volume to writecache:
+not lvconvert --yes --type writecache --cachevol $lv2 $vg/$lv1
+if false; then
check lv_field $vg/$lv1 segtype writecache
lvs -a $vg/${lv2}_cvol --noheadings -o segtype >out
@@ -162,6 +164,7 @@ diff pattern1 $mount_dir/pattern1.after
umount $mount_dir
lvchange -an $vg/$lv1
lvremove $vg/$lv1
+fi
vgremove -ff $vg
--
1.8.3.1

View File

@ -1,18 +0,0 @@
tools/lvconvert.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index aa2dca7..757b323 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -3104,8 +3104,9 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
return 0;
}
- /* FIXME Tidy up all these type restrictions. */
+ /* FIXME Tidy up all these type restrictions. (Use a type whitelist?) */
if (lv_is_cache_type(metadata_lv) ||
+ lv_is_writecache(metadata_lv) ||
lv_is_thin_type(metadata_lv) ||
lv_is_cow(metadata_lv) || lv_is_merging_cow(metadata_lv) ||
lv_is_origin(metadata_lv) || lv_is_merging_origin(metadata_lv) ||

View File

@ -1,16 +0,0 @@
lib/metadata/lv_manip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 3604a63..3090a93 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6638,7 +6638,7 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
return 0;
}
- if (lv_is_cache_origin(lv)) {
+ if (lv_is_cache_origin(lv) || lv_is_writecache_origin(lv)) {
if (!_lv_remove_segs_using_this_lv(cmd, lv, force, level, "cache origin"))
return_0;
/* Removal of cache LV also removes caching origin */

View File

@ -1,19 +0,0 @@
tools/lvconvert.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index cd9a3e8..aa2dca7 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5351,6 +5351,11 @@ static int _writecache_zero(struct cmd_context *cmd, struct logical_volume *lv)
};
int ret;
+ if (!(lv->status & LVM_WRITE)) {
+ log_error("Cannot initialize readonly LV %s", display_lvname(lv));
+ return 0;
+ }
+
if (test_mode())
return 1;

View File

@ -1,76 +0,0 @@
lib/misc/lvm-string.c | 1 -
lib/writecache/writecache.c | 2 +-
test/shell/writecache.sh | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c
index 0ee3403..d8b27cb 100644
--- a/lib/misc/lvm-string.c
+++ b/lib/misc/lvm-string.c
@@ -251,7 +251,6 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
*/
/* Suffixes used here MUST match lib/activate/dev_manager.c */
layer = lv_is_cache_origin(lv) ? "real" :
- lv_is_writecache_origin(lv) ? "real" :
(lv_is_cache(lv) && lv_is_pending_delete(lv)) ? "real" :
lv_is_cache_pool_data(lv) ? "cdata" :
lv_is_cache_pool_metadata(lv) ? "cmeta" :
diff --git a/lib/writecache/writecache.c b/lib/writecache/writecache.c
index 130922a..08a306e 100644
--- a/lib/writecache/writecache.c
+++ b/lib/writecache/writecache.c
@@ -260,7 +260,7 @@ static int _writecache_add_target_line(struct dev_manager *dm,
if ((pmem = lv_on_pmem(seg->writecache)) < 0)
return_0;
- if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), "real")))
+ if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), NULL)))
return_0;
if (!(fast_uuid = build_dm_uuid(mem, seg->writecache, "cvol")))
diff --git a/test/shell/writecache.sh b/test/shell/writecache.sh
index 6cd4665..0a7f694 100644
--- a/test/shell/writecache.sh
+++ b/test/shell/writecache.sh
@@ -127,5 +127,41 @@ umount $mount_dir
lvchange -an $vg/$lv1
lvchange -an $vg/$lv2
+
+# test3: attach writecache to an active LV
+
+lvchange -ay $vg/$lv1
+
+mkfs.xfs -f -s size=4096 "$DM_DEV_DIR/$vg/$lv1"
+
+mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
+
+cp pattern1 $mount_dir/pattern1
+ls -l $mount_dir
+
+lvconvert --yes --type writecache --cachevol $lv2 $vg/$lv1
+
+check lv_field $vg/$lv1 segtype writecache
+
+lvs -a $vg/${lv2}_cvol --noheadings -o segtype >out
+grep linear out
+
+cp pattern1 $mount_dir/pattern1.after
+
+diff pattern1 $mount_dir/pattern1
+diff pattern1 $mount_dir/pattern1.after
+
+umount $mount_dir
+lvchange -an $vg/$lv1
+lvchange -ay $vg/$lv1
+mount "$DM_DEV_DIR/$vg/$lv1" $mount_dir
+
+diff pattern1 $mount_dir/pattern1
+diff pattern1 $mount_dir/pattern1.after
+
+umount $mount_dir
+lvchange -an $vg/$lv1
+lvremove $vg/$lv1
+
vgremove -ff $vg

View File

@ -1,16 +0,0 @@
tools/lvconvert.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 0ddeb35..4ebda4c 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5515,7 +5515,7 @@ static int _get_writecache_settings(struct cmd_context *cmd, struct writecache_s
if (settings->high_watermark_set && settings->low_watermark_set &&
(settings->high_watermark <= settings->low_watermark)) {
- log_error("High watermark must be greater than or equal to low watermark.");
+ log_error("High watermark must be greater than low watermark.");
return 0;
}

View File

@ -1,40 +0,0 @@
tools/lvconvert.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 4ebda4c..bfaf4c0 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5599,6 +5599,16 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
goto bad;
}
+ /*
+ * To permit this we need to check the block size of the fs using lv
+ * (recently in libblkid) so that we can use a matching writecache
+ * block size. We also want to do that if the lv is inactive.
+ */
+ if (lv_is_active(lv)) {
+ log_error("LV %s must be inactive to attach writecache.", display_lvname(lv));
+ goto bad;
+ }
+
/* fast LV shouldn't generally be active by itself, but just in case. */
if (lv_info(cmd, lv_fast, 1, NULL, 0, 0)) {
log_error("LV %s must be inactive to attach.", display_lvname(lv_fast));
@@ -5639,15 +5649,6 @@ static int _lvconvert_writecache_attach_single(struct cmd_context *cmd,
memcpy(&lockd_fast_id, &lv_fast->lvid.id[1], sizeof(struct id));
}
- /*
- * TODO: use libblkid to get the sector size of lv. If it doesn't
- * match the block_size we are using for the writecache, then warn that
- * an existing file system on lv may become unmountable with the
- * writecache attached because of the changing sector size. If this
- * happens, then use --splitcache, and reattach the writecache using a
- * writecache block_size value matching the sector size of lv.
- */
-
if (!_writecache_zero(cmd, lv_fast)) {
log_error("LV %s could not be zeroed.", display_lvname(lv_fast));
return ECMD_FAILED;

View File

@ -1,102 +0,0 @@
lib/activate/dev_manager.c | 4 ++++
lib/metadata/lv.c | 2 +-
lib/metadata/writecache_manip.c | 16 ++++++++--------
lib/misc/lvm-string.c | 1 +
lib/writecache/writecache.c | 2 +-
tools/lvconvert.c | 2 ++
6 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index c8a22fb..3b99131 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -3316,6 +3316,10 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
if (!layer && lv_is_new_thin_pool(lv))
layer = lv_layer(lv);
+ /* Adds -real to the dm uuid of wcorig LV. */
+ if (!layer && lv_is_writecache_origin(lv))
+ layer = lv_layer(lv); /* "real" */
+
if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
return_0;
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index ab26b8d..17d4907 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -830,7 +830,7 @@ const char *lv_layer(const struct logical_volume *lv)
if (lv_is_vdo_pool(lv))
return "vpool";
- if (lv_is_origin(lv) || lv_is_external_origin(lv))
+ if (lv_is_origin(lv) || lv_is_external_origin(lv) || lv_is_writecache_origin(lv))
return "real";
return NULL;
diff --git a/lib/metadata/writecache_manip.c b/lib/metadata/writecache_manip.c
index 0122025..31d069e 100644
--- a/lib/metadata/writecache_manip.c
+++ b/lib/metadata/writecache_manip.c
@@ -24,15 +24,15 @@
int lv_is_writecache_origin(const struct logical_volume *lv)
{
- struct seg_list *sl;
+ struct lv_segment *seg;
- dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
- if (!sl->seg || !sl->seg->lv || !sl->seg->origin)
- continue;
- if (lv_is_writecache(sl->seg->lv) && (sl->seg->origin == lv))
- return 1;
- }
- return 0;
+ /* Make sure there's exactly one segment in segs_using_this_lv! */
+ if (dm_list_empty(&lv->segs_using_this_lv) ||
+ (dm_list_size(&lv->segs_using_this_lv) > 1))
+ return 0;
+
+ seg = get_only_segment_using_this_lv(lv);
+ return seg && lv_is_writecache(seg->lv) && !lv_is_pending_delete(seg->lv) && (seg_lv(seg, 0) == lv);
}
int lv_is_writecache_cachevol(const struct logical_volume *lv)
diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c
index d8b27cb..0ee3403 100644
--- a/lib/misc/lvm-string.c
+++ b/lib/misc/lvm-string.c
@@ -251,6 +251,7 @@ char *build_dm_uuid(struct dm_pool *mem, const struct logical_volume *lv,
*/
/* Suffixes used here MUST match lib/activate/dev_manager.c */
layer = lv_is_cache_origin(lv) ? "real" :
+ lv_is_writecache_origin(lv) ? "real" :
(lv_is_cache(lv) && lv_is_pending_delete(lv)) ? "real" :
lv_is_cache_pool_data(lv) ? "cdata" :
lv_is_cache_pool_metadata(lv) ? "cmeta" :
diff --git a/lib/writecache/writecache.c b/lib/writecache/writecache.c
index 08a306e..130922a 100644
--- a/lib/writecache/writecache.c
+++ b/lib/writecache/writecache.c
@@ -260,7 +260,7 @@ static int _writecache_add_target_line(struct dev_manager *dm,
if ((pmem = lv_on_pmem(seg->writecache)) < 0)
return_0;
- if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), NULL)))
+ if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), "real")))
return_0;
if (!(fast_uuid = build_dm_uuid(mem, seg->writecache, "cvol")))
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 757b323..0ddeb35 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5537,6 +5537,8 @@ static struct logical_volume *_lv_writecache_create(struct cmd_context *cmd,
if (!(segtype = get_segtype_from_string(cmd, SEG_TYPE_NAME_WRITECACHE)))
return_NULL;
+ lv->status |= WRITECACHE;
+
/*
* "lv_wcorig" is a new LV with new id, but with the segments from "lv".
* "lv" keeps the existing name and id, but gets a new writecache segment,

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
From 48105f492f7f8c157ba714217ae55c6fb50e76c0 Mon Sep 17 00:00:00 2001
From: Maxim Plotnikov <wgh@torlan.ru>
Date: Wed, 22 Apr 2020 00:16:29 +0300
Subject: [PATCH] Fix scripts/lvmlocks.service.in using nonexistent --lock-opt
autowait
The --lock-opt autowait was dropped back in 9ab6bdce01,
and attempting to specify it has quite an opposite effect:
no waiting is done, which makes the unit almost useless.
(cherry picked from commit a509776588a5c0c0bfc2394e4d1ed717531b0257)
---
scripts/lvmlocks.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lvmlocks.service.in b/scripts/lvmlocks.service.in
index f6a951f..a3d0bd4 100644
--- a/scripts/lvmlocks.service.in
+++ b/scripts/lvmlocks.service.in
@@ -8,7 +8,7 @@ Type=oneshot
RemainAfterExit=yes
# start lockspaces and wait for them to finish starting
-ExecStart=@SBINDIR@/lvm vgchange --lock-start --lock-opt autowait
+ExecStart=@SBINDIR@/lvm vgchange --lock-start --lock-opt auto
# stop lockspaces and wait for them to finish stopping
ExecStop=@SBINDIR@/lvmlockctl --stop-lockspaces --wait 1
--
1.8.3.1

View File

@ -0,0 +1,24 @@
From a08afc8d0d18b2547176e731852b816df76c63eb Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 15 Apr 2020 11:04:12 -0500
Subject: [PATCH 3/3] WHATS_NEW: integrity with raid
(cherry picked from commit 211eaa284c4df992916e0a523d0ff932aa790a98)
---
WHATS_NEW | 1 +
1 file changed, 1 insertion(+)
diff --git a/WHATS_NEW b/WHATS_NEW
index 89583f7..c0267b7 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.10 -
=================================
+ Add integrity with raid capability.
Fix support for lvconvert --repair used by foreign apps (i.e. Docker).
Version 2.03.09 - 26th March 2020
--
1.8.3.1

View File

@ -0,0 +1,15 @@
WHATS_NEW | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/WHATS_NEW b/WHATS_NEW
index db914c0..89583f7 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,7 @@
+Version 2.03.10 -
+=================================
+ Fix support for lvconvert --repair used by foreign apps (i.e. Docker).
+
Version 2.03.09 - 26th March 2020
=================================
Fix formating of vdopool (vdo_slab_size_mb was smaller by 2 bits).

View File

@ -0,0 +1,179 @@
WHATS_NEW_DM | 4 ++++
man/blkdeactivate.8_main | 11 +++++++++++
scripts/blkdeactivate.sh.in | 48 ++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 12bdcea..3ec9c3c 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,7 @@
+Version 1.02.173 -
+==================================
+ Add support for VDO in blkdeactivate script.
+
Version 1.02.171 - 26th March 2020
==================================
Fix dm_list interators with gcc 10 optimization (-ftree-pta).
diff --git a/man/blkdeactivate.8_main b/man/blkdeactivate.8_main
index f3c19a8..06af52e 100644
--- a/man/blkdeactivate.8_main
+++ b/man/blkdeactivate.8_main
@@ -9,6 +9,7 @@ blkdeactivate \(em utility to deactivate block devices
.RB [ -l \ \fIlvm_options\fP ]
.RB [ -m \ \fImpath_options\fP ]
.RB [ -r \ \fImdraid_options\fP ]
+.RB [ -o \ \fIvdo_options\fP ]
.RB [ -u ]
.RB [ -v ]
.RI [ device ]
@@ -70,6 +71,15 @@ Comma-separated list of MD RAID specific options:
Wait MD device's resync, recovery or reshape action to complete
before deactivation.
.RE
+
+.TP
+.BR -o ", " --vdooptions \ \fIvdo_options\fP
+Comma-separated list of VDO specific options:
+.RS
+.IP \fIconfigfile=file\fP
+Use specified VDO configuration file.
+.RE
+
.TP
.BR -u ", " --umount
Unmount a mounted device before trying to deactivate it.
@@ -120,4 +130,5 @@ of a device-mapper device fails, retry it and force removal.
.BR lvm (8),
.BR mdadm (8),
.BR multipathd (8),
+.BR vdo (8),
.BR umount (8)
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index a4b8a8f..57b3e58 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012-2020 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -38,6 +38,7 @@ MDADM="/sbin/mdadm"
MOUNTPOINT="/bin/mountpoint"
MPATHD="/sbin/multipathd"
UMOUNT="/bin/umount"
+VDO="/bin/vdo"
sbindir="@SBINDIR@"
DMSETUP="$sbindir/dmsetup"
@@ -54,6 +55,7 @@ DMSETUP_OPTS=""
LVM_OPTS=""
MDADM_OPTS=""
MPATHD_OPTS=""
+VDO_OPTS=""
LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
LSBLK_VARS="local devtype local kname local name local mnt"
@@ -124,6 +126,7 @@ usage() {
echo " -l | --lvmoptions LVM_OPTIONS Comma separated LVM specific options"
echo " -m | --mpathoptions MPATH_OPTIONS Comma separated DM-multipath specific options"
echo " -r | --mdraidoptions MDRAID_OPTIONS Comma separated MD RAID specific options"
+ echo " -o | --vdooptions VDO_OPTIONS Comma separated VDO specific options"
echo " -u | --umount Unmount the device if mounted"
echo " -v | --verbose Verbose mode (also implies -e)"
echo
@@ -138,6 +141,8 @@ usage() {
echo " wait wait for resync, recovery or reshape to complete first"
echo " MPATH_OPTIONS:"
echo " disablequeueing disable queueing on all DM-multipath devices first"
+ echo " VDO_OPTIONS:"
+ echo " configfile=file use specified VDO configuration file"
exit
}
@@ -319,6 +324,23 @@ deactivate_md () {
fi
}
+deactivate_vdo() {
+ local xname
+ xname=$(printf "%s" "$name")
+ test -b "$DEV_DIR/mapper/$xname" || return 0
+ test -z "${SKIP_DEVICE_LIST["$kname"]}" || return 1
+
+ deactivate_holders "$DEV_DIR/mapper/$xname" || return 1
+
+ echo -n " [VDO]: deactivating VDO volume $xname... "
+ if eval "$VDO" stop $VDO_OPTS --name="$xname" "$OUT" "$ERR"; then
+ echo "done"
+ else
+ echo "skipping"
+ add_device_to_skip_list
+ fi
+}
+
deactivate () {
######################################################################
# DEACTIVATION HOOKS FOR NEW DEVICE TYPES GO HERE! #
@@ -335,6 +357,8 @@ deactivate () {
######################################################################
if test "$devtype" = "lvm"; then
deactivate_lvm
+ elif test "$devtype" = "vdo"; then
+ deactivate_vdo
elif test "${kname:0:3}" = "dm-"; then
deactivate_dm
elif test "${kname:0:2}" = "md"; then
@@ -479,6 +503,20 @@ get_mpathopts() {
IFS=$ORIG_IFS
}
+get_vdoopts() {
+ ORIG_IFS=$IFS; IFS=','
+
+ for opt in $1; do
+ case "$opt" in
+ "") ;;
+ configfile=*) tmp=${opt#*=}; VDO_OPTS+="--confFile=${tmp%%,*} " ;;
+ *) echo "$opt: unknown VDO option"
+ esac
+ done
+
+ IFS=$ORIG_IFS
+}
+
set_env() {
if test "$ERRORS" -eq "1"; then
unset ERR
@@ -493,6 +531,7 @@ set_env() {
LVM_OPTS+="-vvvv"
MDADM_OPTS+="-vv"
MPATHD_OPTS+="-v 3"
+ VDO_OPTS+="--verbose "
else
OUT="1>$DEV_DIR/null"
fi
@@ -509,6 +548,12 @@ set_env() {
MDADM_AVAILABLE=0
fi
+ if test -f $VDO; then
+ VDO_AVAILABLE=1
+ else
+ VDO_AVAILABLE=0
+ fi
+
MPATHD_RUNNING=0
test "$MPATHD_DO_DISABLEQUEUEING" -eq 1 && {
if test -f "$MPATHD"; then
@@ -528,6 +573,7 @@ while test $# -ne 0; do
"-l"|"--lvmoptions") get_lvmopts "$2" ; shift ;;
"-m"|"--mpathoptions") get_mpathopts "$2" ; shift ;;
"-r"|"--mdraidoptions") get_mdraidopts "$2"; shift ;;
+ "-o"|"--vdooptions") get_vdoopts "$2"; shift ;;
"-u"|"--umount") DO_UMOUNT=1 ;;
"-v"|"--verbose") VERBOSE=1 ; ERRORS=1 ;;
"-vv") VERBOSE=1 ; ERRORS=1 ; set -x ;;

View File

@ -0,0 +1,180 @@
From 7def94164ae6c18d84e40f00db2e2b74a7662b35 Mon Sep 17 00:00:00 2001
From: Marian Csontos <mcsontos@redhat.com>
Date: Tue, 5 May 2020 10:20:18 +0200
Subject: [PATCH] build: make generate
(cherry picked from commit bcc149048440dce5fc7962f88ed523469dd39a32)
---
man/lvconvert.8_pregen | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++
man/lvcreate.8_pregen | 53 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 116 insertions(+)
diff --git a/man/lvconvert.8_pregen b/man/lvconvert.8_pregen
index b676e72..7440984 100644
--- a/man/lvconvert.8_pregen
+++ b/man/lvconvert.8_pregen
@@ -163,6 +163,18 @@ lvconvert - Change logical volume layout
.ad b
.br
.ad l
+ \fB--raidintegrity\fP \fBy\fP|\fBn\fP
+.ad b
+.br
+.ad l
+ \fB--raidintegrityblocksize\fP \fINumber\fP
+.ad b
+.br
+.ad l
+ \fB--raidintegritymode\fP \fIString\fP
+.ad b
+.br
+.ad l
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
.ad b
.br
@@ -982,6 +994,28 @@ Poll LV to continue conversion.
.br
-
+Add or remove data integrity checksums to raid images.
+.br
+.P
+\fBlvconvert\fP \fB--raidintegrity\fP \fBy\fP|\fBn\fP \fILV\fP\fI_raid\fP
+.br
+.RS 4
+.ad l
+[ \fB--raidintegritymode\fP \fIString\fP ]
+.ad b
+.br
+.ad l
+[ \fB--raidintegrityblocksize\fP \fINumber\fP ]
+.ad b
+.br
+[ COMMON_OPTIONS ]
+.RE
+.br
+.RS 4
+[ \fIPV\fP ... ]
+.RE
+-
+
Common options for command:
.
.RS 4
@@ -1405,6 +1439,35 @@ Repeat once to also suppress any prompts with answer 'no'.
.ad b
.HP
.ad l
+\fB--raidintegrity\fP \fBy\fP|\fBn\fP
+.br
+Enable or disable data integrity checksums for raid images.
+.ad b
+.HP
+.ad l
+\fB--raidintegrityblocksize\fP \fINumber\fP
+.br
+The block size to use for dm-integrity on raid images.
+The integrity block size should usually match the device
+logical block size, or the file system block size.
+It may be less than the file system block size, but not
+less than the device logical block size.
+Possible values: 512, 1024, 2048, 4096.
+.ad b
+.HP
+.ad l
+\fB--raidintegritymode\fP \fIString\fP
+.br
+Use a journal (default) or bitmap for keeping integrity checksums consistent
+in case of a crash. The bitmap areas are recalculated after a crash, so corruption
+in those areas would not be detected. A journal does not have this problem.
+The journal mode doubles writes to storage, but can improve performance for
+scattered writes packed into a single journal write.
+bitmap mode can in theory achieve full write throughput of the device,
+but would not benefit from the potential scattered write optimization.
+.ad b
+.HP
+.ad l
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
.br
Sets read ahead sector count of an LV.
diff --git a/man/lvcreate.8_pregen b/man/lvcreate.8_pregen
index a80f9f5..be8e783 100644
--- a/man/lvcreate.8_pregen
+++ b/man/lvcreate.8_pregen
@@ -187,6 +187,18 @@ lvcreate - Create a logical volume
.ad b
.br
.ad l
+ \fB--raidintegrity\fP \fBy\fP|\fBn\fP
+.ad b
+.br
+.ad l
+ \fB--raidintegrityblocksize\fP \fINumber\fP
+.ad b
+.br
+.ad l
+ \fB--raidintegritymode\fP \fIString\fP
+.ad b
+.br
+.ad l
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
.ad b
.br
@@ -425,6 +437,18 @@ Create a raid LV (a specific raid level must be used, e.g. raid1).
[ \fB--[raid]maxrecoveryrate\fP \fISize\fP[k|UNIT] ]
.ad b
.br
+.ad l
+[ \fB--raidintegrity\fP \fBy\fP|\fBn\fP ]
+.ad b
+.br
+.ad l
+[ \fB--raidintegritymode\fP \fIString\fP ]
+.ad b
+.br
+.ad l
+[ \fB--raidintegrityblocksize\fP \fINumber\fP ]
+.ad b
+.br
[ COMMON_OPTIONS ]
.RE
.br
@@ -1420,6 +1444,35 @@ Repeat once to also suppress any prompts with answer 'no'.
.ad b
.HP
.ad l
+\fB--raidintegrity\fP \fBy\fP|\fBn\fP
+.br
+Enable or disable data integrity checksums for raid images.
+.ad b
+.HP
+.ad l
+\fB--raidintegrityblocksize\fP \fINumber\fP
+.br
+The block size to use for dm-integrity on raid images.
+The integrity block size should usually match the device
+logical block size, or the file system block size.
+It may be less than the file system block size, but not
+less than the device logical block size.
+Possible values: 512, 1024, 2048, 4096.
+.ad b
+.HP
+.ad l
+\fB--raidintegritymode\fP \fIString\fP
+.br
+Use a journal (default) or bitmap for keeping integrity checksums consistent
+in case of a crash. The bitmap areas are recalculated after a crash, so corruption
+in those areas would not be detected. A journal does not have this problem.
+The journal mode doubles writes to storage, but can improve performance for
+scattered writes packed into a single journal write.
+bitmap mode can in theory achieve full write throughput of the device,
+but would not benefit from the potential scattered write optimization.
+.ad b
+.HP
+.ad l
\fB-r\fP|\fB--readahead\fP \fBauto\fP|\fBnone\fP|\fINumber\fP
.br
Sets read ahead sector count of an LV.
--
1.8.3.1

View File

@ -0,0 +1,17 @@
tools/lvconvert.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index f6d9a29..bb40930 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2388,7 +2388,8 @@ static int _lvconvert_thin_pool_repair(struct cmd_context *cmd,
goto deactivate_mlv;
}
- if (thin_dump[0]) {
+ /* Check matching transactionId when thin-pool is used by lvm2 (transactionId != 0) */
+ if (first_seg(pool_lv)->transaction_id && thin_dump[0]) {
argv[0] = thin_dump;
argv[1] = pms_path;
argv[2] = NULL;

View File

@ -0,0 +1,641 @@
From 945de675c47d891d1f181f15971d26ff959ac631 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Tue, 14 Jan 2020 14:12:20 -0600
Subject: [PATCH 1/3] move pv_list code into lib
(cherry picked from commit b6b4ad8e28eff7476cb04c4cb93312b06605b82f)
---
lib/Makefile.in | 1 +
lib/metadata/metadata-exported.h | 4 +
lib/metadata/pv_list.c | 291 +++++++++++++++++++++++++++++++++++++++
tools/toollib.c | 270 ------------------------------------
tools/toollib.h | 9 --
5 files changed, 296 insertions(+), 279 deletions(-)
create mode 100644 lib/metadata/pv_list.c
diff --git a/lib/Makefile.in b/lib/Makefile.in
index c037b41..2a064f3 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -74,6 +74,7 @@ SOURCES =\
metadata/mirror.c \
metadata/pool_manip.c \
metadata/pv.c \
+ metadata/pv_list.c \
metadata/pv_manip.c \
metadata/pv_map.c \
metadata/raid_manip.c \
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index c61c85c..35c1231 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1385,4 +1385,8 @@ int vg_is_foreign(struct volume_group *vg);
void vg_write_commit_bad_mdas(struct cmd_context *cmd, struct volume_group *vg);
+struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int argc,
+ char **argv, int allocatable_only);
+struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvsl);
+
#endif
diff --git a/lib/metadata/pv_list.c b/lib/metadata/pv_list.c
new file mode 100644
index 0000000..143b573
--- /dev/null
+++ b/lib/metadata/pv_list.c
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * 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 Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser 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
+ */
+
+#include "lib/misc/lib.h"
+#include "lib/misc/lvm-string.h"
+#include "lib/datastruct/str_list.h"
+#include "lib/device/device.h"
+#include "lib/metadata/metadata.h"
+
+/*
+ * Process physical extent range specifiers
+ */
+static int _add_pe_range(struct dm_pool *mem, const char *pvname,
+ struct dm_list *pe_ranges, uint32_t start, uint32_t count)
+{
+ struct pe_range *per;
+
+ log_debug("Adding PE range: start PE " FMTu32 " length " FMTu32 " on %s.",
+ start, count, pvname);
+
+ /* Ensure no overlap with existing areas */
+ dm_list_iterate_items(per, pe_ranges) {
+ if (((start < per->start) && (start + count - 1 >= per->start)) ||
+ ((start >= per->start) &&
+ (per->start + per->count - 1) >= start)) {
+ log_error("Overlapping PE ranges specified (" FMTu32
+ "-" FMTu32 ", " FMTu32 "-" FMTu32 ") on %s.",
+ start, start + count - 1, per->start,
+ per->start + per->count - 1, pvname);
+ return 0;
+ }
+ }
+
+ if (!(per = dm_pool_alloc(mem, sizeof(*per)))) {
+ log_error("Allocation of list failed.");
+ return 0;
+ }
+
+ per->start = start;
+ per->count = count;
+ dm_list_add(pe_ranges, &per->list);
+
+ return 1;
+}
+
+static int _xstrtouint32(const char *s, char **p, int base, uint32_t *result)
+{
+ unsigned long ul;
+
+ errno = 0;
+ ul = strtoul(s, p, base);
+
+ if (errno || *p == s || ul > UINT32_MAX)
+ return 0;
+
+ *result = ul;
+
+ return 1;
+}
+
+static int _parse_pes(struct dm_pool *mem, char *c, struct dm_list *pe_ranges,
+ const char *pvname, uint32_t size)
+{
+ char *endptr;
+ uint32_t start, end, len;
+
+ /* Default to whole PV */
+ if (!c) {
+ if (!_add_pe_range(mem, pvname, pe_ranges, UINT32_C(0), size))
+ return_0;
+ return 1;
+ }
+
+ while (*c) {
+ if (*c != ':')
+ goto error;
+
+ c++;
+
+ /* Disallow :: and :\0 */
+ if (*c == ':' || !*c)
+ goto error;
+
+ /* Default to whole range */
+ start = UINT32_C(0);
+ end = size - 1;
+
+ /* Start extent given? */
+ if (isdigit(*c)) {
+ if (!_xstrtouint32(c, &endptr, 10, &start))
+ goto error;
+ c = endptr;
+ /* Just one number given? */
+ if (!*c || *c == ':')
+ end = start;
+ }
+ /* Range? */
+ if (*c == '-') {
+ c++;
+ if (isdigit(*c)) {
+ if (!_xstrtouint32(c, &endptr, 10, &end))
+ goto error;
+ c = endptr;
+ }
+ } else if (*c == '+') { /* Length? */
+ c++;
+ if (isdigit(*c)) {
+ if (!_xstrtouint32(c, &endptr, 10, &len))
+ goto error;
+ c = endptr;
+ end = start + (len ? (len - 1) : 0);
+ }
+ }
+
+ if (*c && *c != ':')
+ goto error;
+
+ if ((start > end) || (end > size - 1)) {
+ log_error("PE range error: start extent %" PRIu32 " to "
+ "end extent %" PRIu32 ".", start, end);
+ return 0;
+ }
+
+ if (!_add_pe_range(mem, pvname, pe_ranges, start, end - start + 1))
+ return_0;
+
+ }
+
+ return 1;
+
+ error:
+ log_error("Physical extent parsing error at %s.", c);
+ return 0;
+}
+
+static int _create_pv_entry(struct dm_pool *mem, struct pv_list *pvl,
+ char *colon, int allocatable_only, struct dm_list *r)
+{
+ const char *pvname;
+ struct pv_list *new_pvl = NULL, *pvl2;
+ struct dm_list *pe_ranges;
+
+ pvname = pv_dev_name(pvl->pv);
+ if (allocatable_only && !(pvl->pv->status & ALLOCATABLE_PV)) {
+ log_warn("WARNING: Physical volume %s not allocatable.", pvname);
+ return 1;
+ }
+
+ if (allocatable_only && is_missing_pv(pvl->pv)) {
+ log_warn("WARNING: Physical volume %s is missing.", pvname);
+ return 1;
+ }
+
+ if (allocatable_only &&
+ (pvl->pv->pe_count == pvl->pv->pe_alloc_count)) {
+ log_warn("WARNING: No free extents on physical volume \"%s\".", pvname);
+ return 1;
+ }
+
+ dm_list_iterate_items(pvl2, r)
+ if (pvl->pv->dev == pvl2->pv->dev) {
+ new_pvl = pvl2;
+ break;
+ }
+
+ if (!new_pvl) {
+ if (!(new_pvl = dm_pool_alloc(mem, sizeof(*new_pvl)))) {
+ log_error("Unable to allocate physical volume list.");
+ return 0;
+ }
+
+ memcpy(new_pvl, pvl, sizeof(*new_pvl));
+
+ if (!(pe_ranges = dm_pool_alloc(mem, sizeof(*pe_ranges)))) {
+ log_error("Allocation of pe_ranges list failed.");
+ return 0;
+ }
+ dm_list_init(pe_ranges);
+ new_pvl->pe_ranges = pe_ranges;
+ dm_list_add(r, &new_pvl->list);
+ }
+
+ /* Determine selected physical extents */
+ if (!_parse_pes(mem, colon, new_pvl->pe_ranges, pv_dev_name(pvl->pv),
+ pvl->pv->pe_count))
+ return_0;
+
+ return 1;
+}
+
+struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int argc,
+ char **argv, int allocatable_only)
+{
+ struct dm_list *r;
+ struct pv_list *pvl;
+ struct dm_list tagsl, arg_pvnames;
+ char *pvname = NULL;
+ char *colon, *at_sign, *tagname;
+ int i;
+
+ /* Build up list of PVs */
+ if (!(r = dm_pool_alloc(mem, sizeof(*r)))) {
+ log_error("Allocation of list failed.");
+ return NULL;
+ }
+ dm_list_init(r);
+
+ dm_list_init(&tagsl);
+ dm_list_init(&arg_pvnames);
+
+ for (i = 0; i < argc; i++) {
+ dm_unescape_colons_and_at_signs(argv[i], &colon, &at_sign);
+
+ if (at_sign && (at_sign == argv[i])) {
+ tagname = at_sign + 1;
+ if (!validate_tag(tagname)) {
+ log_error("Skipping invalid tag %s.", tagname);
+ continue;
+ }
+ dm_list_iterate_items(pvl, &vg->pvs) {
+ if (str_list_match_item(&pvl->pv->tags,
+ tagname)) {
+ if (!_create_pv_entry(mem, pvl, NULL,
+ allocatable_only,
+ r))
+ return_NULL;
+ }
+ }
+ continue;
+ }
+
+ pvname = argv[i];
+
+ if (colon && !(pvname = dm_pool_strndup(mem, pvname,
+ (unsigned) (colon - pvname)))) {
+ log_error("Failed to clone PV name.");
+ return NULL;
+ }
+
+ if (!(pvl = find_pv_in_vg(vg, pvname))) {
+ log_error("Physical Volume \"%s\" not found in "
+ "Volume Group \"%s\".", pvname, vg->name);
+ return NULL;
+ }
+ if (!_create_pv_entry(mem, pvl, colon, allocatable_only, r))
+ return_NULL;
+ }
+
+ if (dm_list_empty(r))
+ log_error("No specified PVs have space available.");
+
+ return dm_list_empty(r) ? NULL : r;
+}
+
+struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvsl)
+{
+ struct dm_list *r;
+ struct pv_list *pvl, *new_pvl;
+
+ /* Build up list of PVs */
+ if (!(r = dm_pool_alloc(mem, sizeof(*r)))) {
+ log_error("Allocation of list failed.");
+ return NULL;
+ }
+ dm_list_init(r);
+
+ dm_list_iterate_items(pvl, pvsl) {
+ if (!(new_pvl = dm_pool_zalloc(mem, sizeof(*new_pvl)))) {
+ log_error("Unable to allocate physical volume list.");
+ return NULL;
+ }
+
+ memcpy(new_pvl, pvl, sizeof(*new_pvl));
+ dm_list_add(r, &new_pvl->list);
+ }
+
+ return r;
+}
+
diff --git a/tools/toollib.c b/tools/toollib.c
index a5304bf..6386a69 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -457,276 +457,6 @@ const char *extract_vgname(struct cmd_context *cmd, const char *lv_name)
return vg_name;
}
-/*
- * Process physical extent range specifiers
- */
-static int _add_pe_range(struct dm_pool *mem, const char *pvname,
- struct dm_list *pe_ranges, uint32_t start, uint32_t count)
-{
- struct pe_range *per;
-
- log_debug("Adding PE range: start PE " FMTu32 " length " FMTu32 " on %s.",
- start, count, pvname);
-
- /* Ensure no overlap with existing areas */
- dm_list_iterate_items(per, pe_ranges) {
- if (((start < per->start) && (start + count - 1 >= per->start)) ||
- ((start >= per->start) &&
- (per->start + per->count - 1) >= start)) {
- log_error("Overlapping PE ranges specified (" FMTu32
- "-" FMTu32 ", " FMTu32 "-" FMTu32 ") on %s.",
- start, start + count - 1, per->start,
- per->start + per->count - 1, pvname);
- return 0;
- }
- }
-
- if (!(per = dm_pool_alloc(mem, sizeof(*per)))) {
- log_error("Allocation of list failed.");
- return 0;
- }
-
- per->start = start;
- per->count = count;
- dm_list_add(pe_ranges, &per->list);
-
- return 1;
-}
-
-static int _xstrtouint32(const char *s, char **p, int base, uint32_t *result)
-{
- unsigned long ul;
-
- errno = 0;
- ul = strtoul(s, p, base);
-
- if (errno || *p == s || ul > UINT32_MAX)
- return 0;
-
- *result = ul;
-
- return 1;
-}
-
-static int _parse_pes(struct dm_pool *mem, char *c, struct dm_list *pe_ranges,
- const char *pvname, uint32_t size)
-{
- char *endptr;
- uint32_t start, end, len;
-
- /* Default to whole PV */
- if (!c) {
- if (!_add_pe_range(mem, pvname, pe_ranges, UINT32_C(0), size))
- return_0;
- return 1;
- }
-
- while (*c) {
- if (*c != ':')
- goto error;
-
- c++;
-
- /* Disallow :: and :\0 */
- if (*c == ':' || !*c)
- goto error;
-
- /* Default to whole range */
- start = UINT32_C(0);
- end = size - 1;
-
- /* Start extent given? */
- if (isdigit(*c)) {
- if (!_xstrtouint32(c, &endptr, 10, &start))
- goto error;
- c = endptr;
- /* Just one number given? */
- if (!*c || *c == ':')
- end = start;
- }
- /* Range? */
- if (*c == '-') {
- c++;
- if (isdigit(*c)) {
- if (!_xstrtouint32(c, &endptr, 10, &end))
- goto error;
- c = endptr;
- }
- } else if (*c == '+') { /* Length? */
- c++;
- if (isdigit(*c)) {
- if (!_xstrtouint32(c, &endptr, 10, &len))
- goto error;
- c = endptr;
- end = start + (len ? (len - 1) : 0);
- }
- }
-
- if (*c && *c != ':')
- goto error;
-
- if ((start > end) || (end > size - 1)) {
- log_error("PE range error: start extent %" PRIu32 " to "
- "end extent %" PRIu32 ".", start, end);
- return 0;
- }
-
- if (!_add_pe_range(mem, pvname, pe_ranges, start, end - start + 1))
- return_0;
-
- }
-
- return 1;
-
- error:
- log_error("Physical extent parsing error at %s.", c);
- return 0;
-}
-
-static int _create_pv_entry(struct dm_pool *mem, struct pv_list *pvl,
- char *colon, int allocatable_only, struct dm_list *r)
-{
- const char *pvname;
- struct pv_list *new_pvl = NULL, *pvl2;
- struct dm_list *pe_ranges;
-
- pvname = pv_dev_name(pvl->pv);
- if (allocatable_only && !(pvl->pv->status & ALLOCATABLE_PV)) {
- log_warn("WARNING: Physical volume %s not allocatable.", pvname);
- return 1;
- }
-
- if (allocatable_only && is_missing_pv(pvl->pv)) {
- log_warn("WARNING: Physical volume %s is missing.", pvname);
- return 1;
- }
-
- if (allocatable_only &&
- (pvl->pv->pe_count == pvl->pv->pe_alloc_count)) {
- log_warn("WARNING: No free extents on physical volume \"%s\".", pvname);
- return 1;
- }
-
- dm_list_iterate_items(pvl2, r)
- if (pvl->pv->dev == pvl2->pv->dev) {
- new_pvl = pvl2;
- break;
- }
-
- if (!new_pvl) {
- if (!(new_pvl = dm_pool_alloc(mem, sizeof(*new_pvl)))) {
- log_error("Unable to allocate physical volume list.");
- return 0;
- }
-
- memcpy(new_pvl, pvl, sizeof(*new_pvl));
-
- if (!(pe_ranges = dm_pool_alloc(mem, sizeof(*pe_ranges)))) {
- log_error("Allocation of pe_ranges list failed.");
- return 0;
- }
- dm_list_init(pe_ranges);
- new_pvl->pe_ranges = pe_ranges;
- dm_list_add(r, &new_pvl->list);
- }
-
- /* Determine selected physical extents */
- if (!_parse_pes(mem, colon, new_pvl->pe_ranges, pv_dev_name(pvl->pv),
- pvl->pv->pe_count))
- return_0;
-
- return 1;
-}
-
-struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int argc,
- char **argv, int allocatable_only)
-{
- struct dm_list *r;
- struct pv_list *pvl;
- struct dm_list tagsl, arg_pvnames;
- char *pvname = NULL;
- char *colon, *at_sign, *tagname;
- int i;
-
- /* Build up list of PVs */
- if (!(r = dm_pool_alloc(mem, sizeof(*r)))) {
- log_error("Allocation of list failed.");
- return NULL;
- }
- dm_list_init(r);
-
- dm_list_init(&tagsl);
- dm_list_init(&arg_pvnames);
-
- for (i = 0; i < argc; i++) {
- dm_unescape_colons_and_at_signs(argv[i], &colon, &at_sign);
-
- if (at_sign && (at_sign == argv[i])) {
- tagname = at_sign + 1;
- if (!validate_tag(tagname)) {
- log_error("Skipping invalid tag %s.", tagname);
- continue;
- }
- dm_list_iterate_items(pvl, &vg->pvs) {
- if (str_list_match_item(&pvl->pv->tags,
- tagname)) {
- if (!_create_pv_entry(mem, pvl, NULL,
- allocatable_only,
- r))
- return_NULL;
- }
- }
- continue;
- }
-
- pvname = argv[i];
-
- if (colon && !(pvname = dm_pool_strndup(mem, pvname,
- (unsigned) (colon - pvname)))) {
- log_error("Failed to clone PV name.");
- return NULL;
- }
-
- if (!(pvl = find_pv_in_vg(vg, pvname))) {
- log_error("Physical Volume \"%s\" not found in "
- "Volume Group \"%s\".", pvname, vg->name);
- return NULL;
- }
- if (!_create_pv_entry(mem, pvl, colon, allocatable_only, r))
- return_NULL;
- }
-
- if (dm_list_empty(r))
- log_error("No specified PVs have space available.");
-
- return dm_list_empty(r) ? NULL : r;
-}
-
-struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvsl)
-{
- struct dm_list *r;
- struct pv_list *pvl, *new_pvl;
-
- /* Build up list of PVs */
- if (!(r = dm_pool_alloc(mem, sizeof(*r)))) {
- log_error("Allocation of list failed.");
- return NULL;
- }
- dm_list_init(r);
-
- dm_list_iterate_items(pvl, pvsl) {
- if (!(new_pvl = dm_pool_zalloc(mem, sizeof(*new_pvl)))) {
- log_error("Unable to allocate physical volume list.");
- return NULL;
- }
-
- memcpy(new_pvl, pvl, sizeof(*new_pvl));
- dm_list_add(r, &new_pvl->list);
- }
-
- return r;
-}
-
const char _pe_size_may_not_be_negative_msg[] = "Physical extent size may not be negative.";
int vgcreate_params_set_defaults(struct cmd_context *cmd,
diff --git a/tools/toollib.h b/tools/toollib.h
index 9102f55..53a5e5b 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -182,15 +182,6 @@ void opt_array_to_str(struct cmd_context *cmd, int *opts, int count,
int pvcreate_params_from_args(struct cmd_context *cmd, struct pvcreate_params *pp);
int pvcreate_each_device(struct cmd_context *cmd, struct processing_handle *handle, struct pvcreate_params *pp);
-/*
- * Builds a list of pv's from the names in argv. Used in
- * lvcreate/extend.
- */
-struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int argc,
- char **argv, int allocatable_only);
-
-struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvs);
-
int vgcreate_params_set_defaults(struct cmd_context *cmd,
struct vgcreate_params *vp_def,
struct volume_group *vg);
--
1.8.3.1

View File

@ -0,0 +1,82 @@
test/shell/thin-foreign-repair.sh | 72 +++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
create mode 100644 test/shell/thin-foreign-repair.sh
diff --git a/test/shell/thin-foreign-repair.sh b/test/shell/thin-foreign-repair.sh
new file mode 100644
index 0000000..147a9a0
--- /dev/null
+++ b/test/shell/thin-foreign-repair.sh
@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2020 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# test foreing user of thin-pool
+
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+cleanup_mounted_and_teardown()
+{
+ dmsetup remove $THIN || true
+ vgremove -ff $vg
+ aux teardown
+}
+
+#
+# Main
+#
+aux have_thin 1 0 0 || skip
+which mkfs.ext4 || skip
+
+# Use our mkfs config file to get approximately same results
+# TODO: maybe use it for all test via some 'prepare' function
+export MKE2FS_CONFIG="$TESTOLDPWD/lib/mke2fs.conf"
+
+aux prepare_vg 2 64
+
+# Create named pool only
+lvcreate -L2 -T $vg/pool
+
+POOL="$vg-pool"
+THIN="${PREFIX}_thin"
+
+# Foreing user is using own ioctl command to create thin devices
+dmsetup message $POOL 0 "create_thin 0"
+dmsetup message $POOL 0 "set_transaction_id 0 2"
+
+# Once the transaction id has changed, lvm2 shall not be able to create thinLV
+fail lvcreate -V10 $vg/pool
+
+trap 'cleanup_mounted_and_teardown' EXIT
+
+# 20M thin device
+dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
+
+mkfs.ext4 "$DM_DEV_DIR/mapper/$THIN"
+
+dmsetup remove "$THIN"
+
+lvchange -an $vg/pool
+
+# Repair thin-pool used by 'foreing' apps (setting their own tid)
+lvconvert --repair $vg/pool 2>&1 | tee out
+
+not grep "Transaction id" out
+
+lvchange -ay $vg/pool
+
+dmsetup create "$THIN" --table "0 40960 thin $DM_DEV_DIR/mapper/$POOL 0"
+
+fsck -n "$DM_DEV_DIR/mapper/$THIN"

View File

@ -3,16 +3,16 @@
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index c5cc2e4..49d4854 100644
index 8c4a9a8..00618e0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.03.08(2) (2020-02-11)
+2.03.08(2)-RHEL8 (2020-02-11)
-2.03.09(2) (2020-03-26)
+2.03.09(2)-RHEL8 (2020-04-21)
diff --git a/VERSION_DM b/VERSION_DM
index f909625..3c2949a 100644
index 0ae62fd..b9ec43e 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.169 (2020-02-11)
+1.02.169-RHEL8 (2020-02-11)
-1.02.171 (2020-03-26)
+1.02.171-RHEL8 (2020-04-21)

View File

@ -1,3 +1,9 @@
From 6a078fe01b47fa165226a15263c8bd6350b1c307 Mon Sep 17 00:00:00 2001
From: Marian Csontos <mcsontos@redhat.com>
Date: Thu, 3 Jan 2019 13:49:08 +0100
Subject: [PATCH 2/8] lvm2: set default preferred_names
---
conf/example.conf.in | 3 ++-
lib/config/config_settings.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
@ -29,3 +35,6 @@ index 2bb72ba..dce9705 100644
"Select which path name to display for a block device.\n"
"If multiple path names exist for a block device, and LVM needs to\n"
"display a name for the device, the path names are matched against\n"
--
1.8.3.1

View File

@ -1,3 +1,9 @@
From 74f05f17ea3d1a3639a65ba337f2b7df7f4981bf Mon Sep 17 00:00:00 2001
From: Marian Csontos <mcsontos@redhat.com>
Date: Sun, 18 Aug 2019 17:31:30 +0200
Subject: [PATCH 3/8] lvm2: test: skip-problematic-tests
---
test/dbus/lvmdbustest.py | 1 +
test/shell/lvcreate-usage.sh | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
@ -37,3 +43,6 @@ index 6d46939..9e00f1c 100644
lvremove -ff $vg
#
--
1.8.3.1

View File

@ -1,4 +1,4 @@
%global device_mapper_version 1.02.169
%global device_mapper_version 1.02.171
%global enable_cache 1
%global enable_cluster 1
@ -11,6 +11,7 @@
%global enable_testsuite 1
%global enable_vdo 1
%global enable_writecache 1
%global enable_integrity 1
%global system_release_version 23
%global systemd_version 189-3
@ -56,24 +57,28 @@ Name: lvm2
%if 0%{?rhel}
Epoch: %{rhel}
%endif
Version: 2.03.08
Release: 3%{?dist}
Version: 2.03.09
Release: 5%{?dist}
License: GPLv2
URL: http://sourceware.org/lvm2
Source0: ftp://sourceware.org/pub/lvm2/releases/LVM2.%{version}.tgz
Patch0: lvm2-rhel8.patch
Patch1: lvm2-set-default-preferred_names.patch
Patch2: lvm2-test-skip-problematic-tests.patch
Patch3: lvm2-2_03_09-cachevol-stop-dm-errors-with-uncaching-cache-with-ca.patch
Patch4: lvm2-2_03_09-writecache-check-if-cachevol-is-writable.patch
Patch5: lvm2-2_03_09-thin-don-t-use-writecache-for-poolmetadata.patch
Patch6: lvm2-2_03_09-writecache-drop-real-dm-suffix.patch
Patch7: lvm2-2_03_09-writecache-working-real-dm-uuid-suffix-for-wcorig-lv.patch
Patch8: lvm2-2_03_09-writecache-fix-watermark-error-message.patch
Patch9: lvm2-2_03_09-writecache-allow-removing-wcorig-lv.patch
# BZ 1808012:
Patch10: lvm2-2_03_09-writecache-require-inactive-LV-to-attach.patch
Patch11: lvm2-2_03_09-test-Can-not-attach-writecache-to-active-volume.patch
Patch3: lvm2-2_03_10-lvconvert-no-validation-for-thin-pools-not-used-by-lvm.patch
Patch4: lvm2-2_03_10-test-repair-of-thin-pool-used-by-foreign-apps.patch
Patch5: lvm2-2_03_10-WHATS_NEWS-update.patch
Patch6: lvm2-2_03_10-blkdeactivate-add-support-for-VDO-in-blkdeactivate-script.patch
Patch7: lvm2-2_03_10-Fix-scripts-lvmlocks.service.in-using-nonexistent-lock-opt-autowait.patch
Patch8: lvm2-2_03_10-move-pv_list-code-into-lib.patch
Patch9: lvm2-2_03_10-Allow-dm-integrity-to-be-used-for-raid-images.patch
Patch10: lvm2-2_03_10-WHATS_NEW-integrity-with-raid.patch
Patch11: lvm2-2_03_10-build-make-generate.patch
Patch12: 0001-Merge-master-up-to-commit-53803821de16.patch
Patch13: 0002-Merge-master-up-to-commit-be61bd6ff5c6.patch
Patch14: 0003-Merge-master-up-to-commit-c1d136fea3d1.patch
# BZ 1868169:
Patch15: 0004-Revert-wipe_lv-changes.patch
BuildRequires: gcc
%if %{enable_testsuite}
@ -141,6 +146,10 @@ or more physical volumes and creating one or more logical volumes
%patch9 -p1 -b .backup9
%patch10 -p1 -b .backup10
%patch11 -p1 -b .backup11
%patch12 -p1 -b .backup12
%patch13 -p1 -b .backup13
%patch14 -p1 -b .backup14
%patch15 -p1 -b .backup15
%build
%global _default_pid_dir /run
@ -187,7 +196,11 @@ or more physical volumes and creating one or more logical volumes
%global configure_writecache --with-writecache=internal
%endif
%configure --with-default-dm-run-dir=%{_default_dm_run_dir} --with-default-run-dir=%{_default_run_dir} --with-default-pid-dir=%{_default_pid_dir} --with-default-locking-dir=%{_default_locking_dir} --with-usrlibdir=%{_libdir} --enable-fsadm --enable-write_install --with-user= --with-group= --with-device-uid=0 --with-device-gid=6 --with-device-mode=0660 --enable-pkgconfig --enable-cmdlib --enable-dmeventd --enable-blkid_wiping %{?configure_cluster} %{?configure_cmirror} %{?configure_udev} %{?configure_thin} %{?configure_cache} %{?configure_lvmpolld} %{?configure_lockd_dlm} %{?configure_lockd_sanlock} %{?configure_lvmdbusd} %{?configure_dmfilemapd} %{?configure_writecache} %{?configure_vdo} --disable-silent-rules
%if %{enable_integrity}
%global configure_integrity --with-integrity=internal
%endif
%configure --with-default-dm-run-dir=%{_default_dm_run_dir} --with-default-run-dir=%{_default_run_dir} --with-default-pid-dir=%{_default_pid_dir} --with-default-locking-dir=%{_default_locking_dir} --with-usrlibdir=%{_libdir} --enable-fsadm --enable-write_install --with-user= --with-group= --with-device-uid=0 --with-device-gid=6 --with-device-mode=0660 --enable-pkgconfig --enable-cmdlib --enable-dmeventd --enable-blkid_wiping %{?configure_cluster} %{?configure_cmirror} %{?configure_udev} %{?configure_thin} %{?configure_cache} %{?configure_lvmpolld} %{?configure_lockd_dlm} %{?configure_lockd_sanlock} %{?configure_lvmdbusd} %{?configure_dmfilemapd} %{?configure_writecache} %{?configure_vdo} %{?configure_integrity} --disable-silent-rules
make %{?_smp_mflags}
@ -198,7 +211,7 @@ make install_systemd_units DESTDIR=$RPM_BUILD_ROOT
make install_systemd_generators DESTDIR=$RPM_BUILD_ROOT
make install_tmpfiles_configuration DESTDIR=$RPM_BUILD_ROOT
%if %{enable_testsuite}
make -C test install DESTDIR=$RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT -C test
%endif
%post
@ -741,6 +754,24 @@ An extensive functional testsuite for LVM2.
%endif
%changelog
* Wed Aug 12 2020 Marian Csontos <mcsontos@redhat.com> - 2.03.09-5
- Revert wipe_lv changes.
* Sun Aug 09 2020 Marian Csontos <mcsontos@redhat.com> - 2.03.09-4
- Merge fixes from upstream.
* Mon Jun 29 2020 Marian Csontos <mcsontos@redhat.com> - 2.03.09-3
- Merge fixes from upstream.
* Thu May 21 2020 Marian Csontos <mcsontos@redhat.com> - 2.03.09-2
- Merge fixes from upstream.
* Fri Apr 24 2020 Marian Csontos <mcsontos@redhat.com> - 2.03.09-1
- Fix support for lvconvert --repair of pools used by third party applications.
- Fix formating of vdopool (vdo_slab_size_mb was smaller by 2 bits).
- Fix busy loop in dmeventd.
- Fix lvmlocks.service using incorrect option.
* Wed Mar 18 2020 Marian Csontos <mcsontos@redhat.com> - 2.03.08-3
- Attaching writecache require inactive LV.