Auto sync2gitlab import of lvm2-2.03.14-9.el8.src.rpm

This commit is contained in:
CentOS Sources 2023-01-25 08:09:28 +00:00
parent df0ad0f745
commit 86225d7e50
12 changed files with 1432 additions and 6 deletions

View File

@ -0,0 +1,66 @@
From 87904fbbb84c10e6f733db1c5ba447537d1cf08c Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Fri, 19 Aug 2022 13:31:22 -0500
Subject: [PATCH 1/6] devices file: fix pvcreate --uuid matching pvid entry
with no device id
pvcreate with --uuid would segfault if a devices file entry matched
the specified pvid, but the devices file entry had no device_id, which
could happen if the entry has a devname idtype.
---
lib/device/device_id.c | 7 ++++---
test/shell/devicesfile-devname.sh | 13 +++++++++++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 4d8fa5c9c..c3816a66c 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -1142,8 +1142,9 @@ id_done:
du_devname->devname);
if (du_pvid && (du_pvid->dev != dev))
- log_warn("WARNING: adding device %s with PVID %s which is already used for %s.",
- dev_name(dev), pvid, du_pvid->dev ? dev_name(du_pvid->dev) : "missing device");
+ log_warn("WARNING: adding device %s with PVID %s which is already used for %s device_id %s.",
+ dev_name(dev), pvid, du_pvid->dev ? dev_name(du_pvid->dev) : "missing device",
+ du_pvid->idname ?: "none");
if (du_devid && (du_devid->dev != dev)) {
if (!du_devid->dev) {
@@ -1189,7 +1190,7 @@ id_done:
else
check_idname = device_id_system_read(cmd, dev, du_pvid->idtype);
- if (check_idname && !strcmp(check_idname, du_pvid->idname)) {
+ if (!du_pvid->idname || (check_idname && !strcmp(check_idname, du_pvid->idname))) {
update_du = du_pvid;
dm_list_del(&update_du->list);
update_matching_kind = "PVID";
diff --git a/test/shell/devicesfile-devname.sh b/test/shell/devicesfile-devname.sh
index 338637275..211f4dbed 100644
--- a/test/shell/devicesfile-devname.sh
+++ b/test/shell/devicesfile-devname.sh
@@ -550,6 +550,19 @@ vgchange -an $vg2
vgremove -ff $vg1
vgremove -ff $vg2
+# bz 2119473
+
+aux lvmconf "devices/search_for_devnames = \"none\""
+sed -e "s|DEVNAME=$dev1|DEVNAME=.|" "$ORIG" > tmp1.devices
+sed -e "s|IDNAME=$dev1|IDNAME=.|" tmp1.devices > "$DF"
+pvs
+lvmdevices
+pvcreate -ff --yes --uuid "$PVID1" --norestorefile $dev1
+grep "$PVID1" "$DF" |tee out
+grep "DEVNAME=$dev1" out
+grep "IDNAME=$dev1" out
+aux lvmconf "devices/search_for_devnames = \"auto\""
+
# devnames change so the new devname now refers to a filtered device,
# e.g. an mpath or md component, which is not scanned
--
2.38.1

View File

@ -0,0 +1,57 @@
From 73943825501daede9963bb5d15abbc4d36febb40 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Thu, 11 Aug 2022 11:44:58 +0200
Subject: [PATCH 2/6] lvconvert: correct test support for vdo-pool
(cherry picked from commit d0697be5004af0e040b1f746e619b8075350bc46)
---
WHATS_NEW | 4 ++++
lib/metadata/vdo_manip.c | 4 +++-
tools/lvconvert.c | 4 +++-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 240234e4d..e626802ec 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,7 @@
+Version 2.03.17 -
+===============================
+ Fix lvconvert --test --type vdo-pool execution.
+
Version 2.03.14 - 20th October 2021
===================================
Device scanning is skipping directories on different filesystems.
diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c
index fa9c893cb..11a119a68 100644
--- a/lib/metadata/vdo_manip.c
+++ b/lib/metadata/vdo_manip.c
@@ -392,7 +392,9 @@ struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv,
/* Format data LV as VDO volume */
if (format) {
- if (!_format_vdo_pool_data_lv(data_lv, vtp, &vdo_logical_size)) {
+ if (test_mode()) {
+ log_verbose("Test mode: Skipping formating of VDO pool volume.");
+ } else if (!_format_vdo_pool_data_lv(data_lv, vtp, &vdo_logical_size)) {
log_error("Cannot format VDO pool volume %s.", display_lvname(data_lv));
return NULL;
}
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 3d4b24fe3..c1d373318 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -5482,7 +5482,9 @@ static int _lvconvert_to_vdopool_single(struct cmd_context *cmd,
}
if (vdo_pool_zero) {
- if (!wipe_lv(lv, (struct wipe_params) { .do_zero = 1, .do_wipe_signatures = 1,
+ if (test_mode()) {
+ log_verbose("Test mode: Skipping activation, zeroing and signature wiping.");
+ } else if (!wipe_lv(lv, (struct wipe_params) { .do_zero = 1, .do_wipe_signatures = 1,
.yes = arg_count(cmd, yes_ARG),
.force = arg_count(cmd, force_ARG)})) {
log_error("Aborting. Failed to wipe VDO data store.");
--
2.38.1

View File

@ -0,0 +1,32 @@
From 0aa45120e92fe8b0f379d00f3a031e3c53feca43 Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Wed, 24 Aug 2022 15:37:56 -0500
Subject: [PATCH 3/6] lvmdbusd: Set LVM_COMMAND_PROFILE=lvmdbusd
We need this to prevent lvm from interleaving the JSON output with errors
written to stderr.
(cherry picked from commit a5e6947d74f7b88f7f0df4328a923ad82a970634)
---
daemons/lvmdbusd/main.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index b0a82d492..eaea13ef8 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -112,8 +112,10 @@ def main():
use_session = os.getenv('LVMDBUSD_USE_SESSION', False)
- # Ensure that we get consistent output for parsing stdout/stderr
+ # Ensure that we get consistent output for parsing stdout/stderr and that we
+ # are using the lvmdbusd profile.
os.environ["LC_ALL"] = "C"
+ os.environ["LVM_COMMAND_PROFILE"] = "lvmdbusd"
cfg.args = parser.parse_args()
cfg.create_request_entry = RequestEntry
--
2.38.1

View File

@ -0,0 +1,442 @@
From f1d8c01dff3f8839355004e5fd77e9cd521e26cb Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Mon, 29 Aug 2022 15:17:36 -0500
Subject: [PATCH 1/4] vgimportdevices: change result when devices are not added
When using --all, if one VG is skipped, continue adding
other VGs, and do not return an error from the command
if some VGs are added. (A VG is skipped if it's missing PVs.)
If the command fails during devices file setup or device
scanning, then remove the devices file if it has been
newly created by the command, and exit with an error.
If devices from a named VG are not imported (e.g. the
VG is missing devices), then remove the devices file if
it has been newly created by the command, and exit with
an error.
If --all VGs are being imported, and no devices are found
to include in the devices file, then remove the devices
file if it has been newly created by the command, and
exit with an error.
---
test/shell/vgimportdevices.sh | 308 ++++++++++++++++++++++++++++++++++
tools/vgimportdevices.c | 41 +++--
2 files changed, 336 insertions(+), 13 deletions(-)
create mode 100644 test/shell/vgimportdevices.sh
diff --git a/test/shell/vgimportdevices.sh b/test/shell/vgimportdevices.sh
new file mode 100644
index 000000000..47363cec3
--- /dev/null
+++ b/test/shell/vgimportdevices.sh
@@ -0,0 +1,308 @@
+
+#!/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_description='vgimportdevices'
+
+. lib/inittest
+
+aux prepare_devs 5
+
+DFDIR="$LVM_SYSTEM_DIR/devices"
+mkdir "$DFDIR" || true
+DF="$DFDIR/system.devices"
+
+aux lvmconf 'devices/use_devicesfile = 1'
+
+not ls "$DF"
+pvcreate "$dev1"
+ls "$DF"
+grep "$dev1" "$DF"
+rm -f "$DF"
+dd if=/dev/zero of="$dev1" bs=1M count=1
+
+#
+# vgimportdevices -a with no prev df
+#
+
+# no devs found
+not vgimportdevices -a
+not ls "$DF"
+
+# one orphan pv, no vgs
+pvcreate "$dev1"
+rm -f "$DF"
+not vgimportdevices -a
+not ls "$DF"
+
+# one complete vg
+vgcreate $vg1 "$dev1"
+rm -f "$DF"
+vgimportdevices -a
+ls "$DF"
+grep "$dev1" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+rm -f "$DF"
+
+# two complete vgs
+vgcreate $vg1 "$dev1"
+vgcreate $vg2 "$dev2"
+rm -f "$DF"
+vgimportdevices -a
+ls "$DF"
+grep "$dev1" "$DF"
+grep "$dev2" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+rm -f "$DF"
+
+# one incomplete vg
+vgcreate $vg1 "$dev1" "$dev2"
+lvcreate -l1 -an $vg1
+rm -f "$DF"
+dd if=/dev/zero of="$dev1" bs=1M count=1
+not vgimportdevices -a
+not ls "$DF"
+vgs $vg1
+pvs "$dev2"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+rm -f "$DF"
+
+# three complete, one incomplete vg
+vgcreate $vg1 "$dev1"
+vgcreate $vg2 "$dev2"
+vgcreate $vg3 "$dev3"
+vgcreate $vg4 "$dev4" "$dev5"
+rm -f "$DF"
+dd if=/dev/zero of="$dev5" bs=1M count=1
+vgimportdevices -a
+ls "$DF"
+grep "$dev1" "$DF"
+grep "$dev2" "$DF"
+grep "$dev3" "$DF"
+not grep "$dev4" "$DF"
+not grep "$dev5" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+dd if=/dev/zero of="$dev3" bs=1M count=1
+dd if=/dev/zero of="$dev4" bs=1M count=1
+rm -f "$DF"
+
+
+#
+# vgimportdevices -a with existing df
+#
+
+# no devs found
+vgcreate $vg1 "$dev1"
+grep "$dev1" "$DF"
+dd if=/dev/zero of="$dev1" bs=1M count=1
+not vgimportdevices -a
+ls "$DF"
+
+# one complete vg
+vgcreate $vg1 "$dev1"
+vgimportdevices -a
+grep "$dev1" "$DF"
+vgcreate --devicesfile "" $vg2 "$dev2"
+not grep "$dev2" "$DF"
+vgimportdevices -a
+grep "$dev1" "$DF"
+grep "$dev2" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+rm -f "$DF"
+
+# two complete vgs
+vgcreate --devicesfile "" $vg1 "$dev1"
+vgcreate --devicesfile "" $vg2 "$dev2"
+rm -f "$DF"
+vgimportdevices -a
+ls "$DF"
+grep "$dev1" "$DF"
+grep "$dev2" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+rm -f "$DF"
+
+# one incomplete vg
+vgcreate $vg1 "$dev1"
+vgimportdevices -a
+grep "$dev1" "$DF"
+dd if=/dev/zero of="$dev1" bs=1M count=1
+vgcreate --devicesfile "" $vg2 "$dev2" "$dev3"
+not grep "$dev2" "$DF"
+not grep "$dev3" "$DF"
+dd if=/dev/zero of="$dev2" bs=1M count=1
+not vgimportdevices -a
+ls "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+dd if=/dev/zero of="$dev3" bs=1M count=1
+rm -f "$DF"
+
+# import the same vg again
+vgcreate --devicesfile "" $vg1 "$dev1"
+not ls "$DF"
+vgimportdevices -a
+ls "$DF"
+grep "$dev1" "$DF"
+vgimportdevices -a
+ls "$DF"
+grep "$dev1" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+rm -f "$DF"
+
+# import a series of vgs
+vgcreate --devicesfile "" $vg1 "$dev1"
+vgimportdevices -a
+grep "$dev1" "$DF"
+vgcreate --devicesfile "" $vg2 "$dev2"
+vgimportdevices -a
+grep "$dev1" "$DF"
+grep "$dev2" "$DF"
+vgcreate --devicesfile "" $vg3 "$dev3"
+vgimportdevices -a
+grep "$dev1" "$DF"
+grep "$dev2" "$DF"
+grep "$dev3" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+dd if=/dev/zero of="$dev3" bs=1M count=1
+rm -f "$DF"
+
+#
+# vgimportdevices vg with no prev df
+#
+
+# no devs found
+not vgimportdevices $vg1
+not ls "$DF"
+
+# one complete vg
+vgcreate $vg1 "$dev1"
+rm -f "$DF"
+vgimportdevices $vg1
+ls "$DF"
+grep "$dev1" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+rm -f "$DF"
+
+# two complete vgs
+vgcreate $vg1 "$dev1"
+vgcreate $vg2 "$dev2"
+rm -f "$DF"
+vgimportdevices $vg1
+ls "$DF"
+grep "$dev1" "$DF"
+vgimportdevices $vg2
+ls "$DF"
+grep "$dev2" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+rm -f "$DF"
+
+# one incomplete vg
+vgcreate $vg1 "$dev1" "$dev2"
+lvcreate -l1 -an $vg1
+rm -f "$DF"
+dd if=/dev/zero of="$dev1" bs=1M count=1
+not vgimportdevices $vg1
+not ls "$DF"
+vgs $vg1
+pvs "$dev2"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+rm -f "$DF"
+
+# three complete, one incomplete vg
+vgcreate $vg1 "$dev1"
+vgcreate $vg2 "$dev2"
+vgcreate $vg3 "$dev3"
+vgcreate $vg4 "$dev4" "$dev5"
+rm -f "$DF"
+dd if=/dev/zero of="$dev5" bs=1M count=1
+not vgimportdevices $vg4
+not ls "$DF"
+vgimportdevices $vg3
+ls "$DF"
+grep "$dev3" "$DF"
+not grep "$dev1" "$DF"
+not grep "$dev2" "$DF"
+not grep "$dev4" "$DF"
+not grep "$dev5" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+dd if=/dev/zero of="$dev3" bs=1M count=1
+dd if=/dev/zero of="$dev4" bs=1M count=1
+rm -f "$DF"
+
+#
+# vgimportdevices vg with existing df
+#
+
+# vg not found
+vgcreate $vg1 "$dev1"
+vgimportdevices -a
+grep "$dev1" "$DF"
+not vgimportdevices $vg2
+grep "$dev1" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+rm -f "$DF"
+
+# vg incomplete
+vgcreate $vg1 "$dev1"
+vgimportdevices -a
+grep "$dev1" "$DF"
+vgcreate --devicesfile "" $vg2 "$dev2" "$dev3"
+dd if=/dev/zero of="$dev2" bs=1M count=1
+not vgimportdevices $vg2
+grep "$dev1" "$DF"
+not grep "$dev2" "$DF"
+not grep "$dev3" "$DF"
+
+# reset
+dd if=/dev/zero of="$dev1" bs=1M count=1
+dd if=/dev/zero of="$dev2" bs=1M count=1
+dd if=/dev/zero of="$dev3" bs=1M count=1
+dd if=/dev/zero of="$dev4" bs=1M count=1
+rm -f "$DF"
+
diff --git a/tools/vgimportdevices.c b/tools/vgimportdevices.c
index ea205d941..9ade1b9e4 100644
--- a/tools/vgimportdevices.c
+++ b/tools/vgimportdevices.c
@@ -36,9 +36,9 @@ static int _vgimportdevices_single(struct cmd_context *cmd,
dm_list_iterate_items(pvl, &vg->pvs) {
if (is_missing_pv(pvl->pv) || !pvl->pv->dev) {
memcpy(pvid, &pvl->pv->id.uuid, ID_LEN);
- log_error("Not importing devices for VG %s with missing PV %s.",
- vg->name, pvid);
- goto bad;
+ log_print("Not importing devices for VG %s with missing PV %s.",
+ vg->name, pvid);
+ return ECMD_PROCESSED;
}
}
@@ -71,14 +71,17 @@ static int _vgimportdevices_single(struct cmd_context *cmd,
updated_pvs++;
}
+ /*
+ * Writes the device_id of each PV into the vg metadata.
+ * This is not a critial step and should not influence
+ * the result of the command.
+ */
if (updated_pvs) {
if (!vg_write(vg) || !vg_commit(vg))
- goto_bad;
+ log_print("Failed to write device ids in VG metadata.");
}
return ECMD_PROCESSED;
-bad:
- return ECMD_FAILED;
}
/*
@@ -114,6 +117,7 @@ int vgimportdevices(struct cmd_context *cmd, int argc, char **argv)
{
struct vgimportdevices_params vp = { 0 };
struct processing_handle *handle;
+ int created_file = 0;
int ret = ECMD_FAILED;
if (arg_is_set(cmd, foreign_ARG))
@@ -139,9 +143,12 @@ int vgimportdevices(struct cmd_context *cmd, int argc, char **argv)
log_error("Devices file not enabled.");
return ECMD_FAILED;
}
- if (!devices_file_exists(cmd) && !devices_file_touch(cmd)) {
- log_error("Failed to create devices file.");
- return ECMD_FAILED;
+ if (!devices_file_exists(cmd)) {
+ if (!devices_file_touch(cmd)) {
+ log_error("Failed to create devices file.");
+ return ECMD_FAILED;
+ }
+ created_file = 1;
}
/*
@@ -195,22 +202,30 @@ int vgimportdevices(struct cmd_context *cmd, int argc, char **argv)
*/
ret = process_each_vg(cmd, argc, argv, NULL, NULL, READ_FOR_UPDATE,
0, handle, _vgimportdevices_single);
- if (ret == ECMD_FAILED)
- goto out;
+ if (ret == ECMD_FAILED) {
+ /*
+ * Error from setting up devices file or label_scan,
+ * _vgimportdevices_single does not return an error.
+ */
+ goto_out;
+ }
if (!vp.added_devices) {
- log_print("No devices to add.");
+ log_error("No devices to add.");
+ ret = ECMD_FAILED;
goto out;
}
if (!device_ids_write(cmd)) {
- log_print("Failed to update devices file.");
+ log_error("Failed to write the devices file.");
ret = ECMD_FAILED;
goto out;
}
log_print("Added %u devices to devices file.", vp.added_devices);
out:
+ if ((ret == ECMD_FAILED) && created_file)
+ unlink(cmd->devices_file_path);
destroy_processing_handle(cmd, handle);
return ret;
}
--
2.38.1

View File

@ -0,0 +1,76 @@
From 0b9d9963b8f15a6f12a0149a62809fa9b846c5c5 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Tue, 30 Aug 2022 14:40:48 -0500
Subject: [PATCH 2/4] vgimportdevices: fix locking when creating devices file
Take the devices file lock before creating a new devices file.
(Was missed by the change to preemptively create the devices
file prior to setup_devices(), which was done to improve the
error path.)
---
lib/device/dev-cache.c | 7 +++----
lib/device/device_id.c | 1 +
tools/vgimportdevices.c | 10 ++++++++--
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 65e1cb138..0c9aaf785 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1956,10 +1956,9 @@ static int _setup_devices(struct cmd_context *cmd, int no_file_match)
if (!file_exists) {
/*
- * pvcreate/vgcreate/vgimportdevices/lvmdevices-add create
- * a new devices file here if it doesn't exist.
- * They have the create_edit_devices_file flag set.
- * First they create/lock-ex the devices file lockfile.
+ * pvcreate/vgcreate create a new devices file here if it
+ * doesn't exist. They have create_edit_devices_file=1.
+ * First create/lock-ex the devices file lockfile.
* Other commands will not use a devices file if none exists.
*/
lock_mode = LOCK_EX;
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index c3816a66c..780e08404 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -2429,6 +2429,7 @@ static int _lock_devices_file(struct cmd_context *cmd, int mode, int nonblock, i
if (_devices_file_locked == mode) {
/* can happen when a command holds an ex lock and does an update in device_ids_validate */
+ /* can happen when vgimportdevices calls this directly, followed later by setup_devices */
if (held)
*held = 1;
return 1;
diff --git a/tools/vgimportdevices.c b/tools/vgimportdevices.c
index 9ade1b9e4..23c2718ff 100644
--- a/tools/vgimportdevices.c
+++ b/tools/vgimportdevices.c
@@ -132,8 +132,10 @@ int vgimportdevices(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
/*
- * Prepare devices file preemptively because the error path for this
- * case from process_each is not as clean.
+ * Prepare/create devices file preemptively because the error path for
+ * this case from process_each/setup_devices is not as clean.
+ * This means that when setup_devices is called, it the devices
+ * file steps will be redundant, and need to handle being repeated.
*/
if (!setup_devices_file(cmd)) {
log_error("Failed to set up devices file.");
@@ -143,6 +145,10 @@ int vgimportdevices(struct cmd_context *cmd, int argc, char **argv)
log_error("Devices file not enabled.");
return ECMD_FAILED;
}
+ if (!lock_devices_file(cmd, LOCK_EX)) {
+ log_error("Failed to lock the devices file.");
+ return ECMD_FAILED;
+ }
if (!devices_file_exists(cmd)) {
if (!devices_file_touch(cmd)) {
log_error("Failed to create devices file.");
--
2.38.1

View File

@ -0,0 +1,132 @@
From 7db3a53d8a3aa7401337fb9aaf00f19cf4407e70 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 30 Mar 2022 14:16:11 +0200
Subject: [PATCH 3/4] thin: fix message processing on thin-pool extension
When thin-pool had queued some delete message on extension operation
such message has been 'lost' and thin-pool kernel metadata has been
left with a thin volume that no longer existed for lvm2 metadata.
(cherry picked from commit 09371131469f7398c597a5fb30dc565859253cc2)
---
WHATS_NEW | 4 ++
lib/metadata/lv_manip.c | 2 +-
test/shell/lvextend-thin-adddel.sh | 78 ++++++++++++++++++++++++++++++
3 files changed, 83 insertions(+), 1 deletion(-)
create mode 100644 test/shell/lvextend-thin-adddel.sh
diff --git a/WHATS_NEW b/WHATS_NEW
index e626802ec..bffd24648 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -2,6 +2,10 @@ Version 2.03.17 -
===============================
Fix lvconvert --test --type vdo-pool execution.
+Version 2.03.16 -
+====================================
+ Fix lossing of delete message on thin-pool extension.
+
Version 2.03.14 - 20th October 2021
===================================
Device scanning is skipping directories on different filesystems.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 003748d6f..9523e3e66 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6179,7 +6179,7 @@ int lv_resize(struct logical_volume *lv,
if (lv_is_thin_pool(lock_lv)) {
/* Update lvm pool metadata (drop messages). */
- if (!update_pool_lv(lock_lv, 0))
+ if (!update_pool_lv(lock_lv, 1))
goto_bad;
}
diff --git a/test/shell/lvextend-thin-adddel.sh b/test/shell/lvextend-thin-adddel.sh
new file mode 100644
index 000000000..59b1bfa41
--- /dev/null
+++ b/test/shell/lvextend-thin-adddel.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2022 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
+
+#
+# Play with thin-pool and thin removal and creation in corner cases
+#
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+aux have_thin 1 0 0 || skip
+
+test -n "$LVM_TEST_THIN_RESTORE_CMD" || LVM_TEST_THIN_RESTORE_CMD=$(which thin_restore) || skip
+"$LVM_TEST_THIN_RESTORE_CMD" -V || skip
+
+aux have_thin 1 10 0 || skip
+
+aux prepare_vg 2
+
+lvcreate -V10 -n $lv1 -L10 -T $vg/pool
+lvcreate -V10 -n $lv2 $vg/pool
+
+# Forcibly 'error' _tmeta thin-pool metadata device
+not dmsetup remove -f $vg-pool_tmeta
+
+# Now try to schedule removal of thin volume id 1
+# that will fail with errored meta device
+not lvremove -y $vg/$lv1
+
+# Check we have queued 'message'
+vgcfgbackup -f out0 $vg
+grep "message1" out0
+
+vgchange -an $vg || true
+
+not dmsetup table ${vg}-pool-tpool
+
+# Reactivate thin-pool
+vgchange -ay $vg
+
+# Check message is still queued there
+vgcfgbackup -f out1 $vg
+grep "message1" out1
+
+lvchange -an $vg
+
+lvextend -L+10 $vg/pool
+
+# Messages should be now processed and gone
+vgcfgbackup -f out2 $vg
+not grep "message1" out2
+
+lvchange -an $vg
+
+lvchange -y -ay $vg/pool_tmeta
+
+# Kernel metadata must not see dev_id 1 either
+thin_dump $DM_DEV_DIR/$vg/pool_tmeta | tee meta
+not grep 'dev_id="1"' meta
+
+lvremove -ff $vg
+
+lvs -a $vg
+
+vgremove -ff $vg
--
2.38.1

View File

@ -0,0 +1,52 @@
From b56e8fc94d4d2b6d384148e3f74c54f4e1d816e6 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 15 Aug 2022 13:14:03 +0200
Subject: [PATCH 4/4] vdo: fix --vdosettings parser
Parser was incorrectly parsing vdo_use_features - move the skip
of 'use_' prefix into internal loop which handles skipping of '_'.
(cherry picked from commit bba96e8680ef7fa567d6361c269c0bfc05ce3d2c)
---
tools/toollib.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 210b3dca5..d9a1a92ec 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1198,13 +1198,11 @@ out:
*/
static int _compare_vdo_option(const char *b1, const char *b2)
{
+ int use_skipped = 0;
+
if (strncasecmp(b1, "vdo", 3) == 0) // skip vdo prefix
b1 += 3;
- if ((tolower(*b1) != tolower(*b2)) &&
- (strncmp(b2, "use_", 4) == 0))
- b2 += 4; // try again with skipped prefix 'use_'
-
while (*b1 && *b2) {
if (tolower(*b1) == tolower(*b2)) {
++b1;
@@ -1216,8 +1214,14 @@ static int _compare_vdo_option(const char *b1, const char *b2)
++b1; // skip to next char
else if (*b2 == '_')
++b2; // skip to next char
- else
+ else {
+ if (!use_skipped++ && (strncmp(b2, "use_", 4) == 0)) {
+ b2 += 4; // try again with skipped prefix 'use_'
+ continue;
+ }
+
break; // mismatch
+ }
}
return (*b1 || *b2) ? 0 : 1;
--
2.38.1

View File

@ -1,6 +1,6 @@
From 13b8c209f39ab018f34b3ccd369590a89fe71a57 Mon Sep 17 00:00:00 2001
From 71354c39350b482ca8cf0fd9dcaf025b1d55b7d1 Mon Sep 17 00:00:00 2001
From: Marian Csontos <mcsontos@redhat.com>
Date: Wed, 15 Jun 2022 19:58:18 +0200
Date: Thu, 8 Dec 2022 14:32:23 +0100
Subject: [PATCH] make: generate
---
@ -917,5 +917,5 @@ index 065c8b52a..99938a4e3 100644
.
.HP
--
2.34.3
2.38.1

View File

@ -0,0 +1,90 @@
From d0b5614d43ac41ee24a480a6272f256b1a242873 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 4 Jul 2022 16:08:30 +0200
Subject: [PATCH 1/3] vdo: use single validator
Add era lenght validation into dm_vdo_validate_target_params()
and reuse this validator also for _check_lv_segment().
(cherry picked from commit 8ca2b1bc213188037ecedfbf76de53de871c7f5b)
---
device_mapper/vdo/vdo_target.c | 9 ++++++++-
lib/metadata/merge.c | 37 ++--------------------------------
2 files changed, 10 insertions(+), 36 deletions(-)
diff --git a/device_mapper/vdo/vdo_target.c b/device_mapper/vdo/vdo_target.c
index 2ffd29145..0e5abd162 100644
--- a/device_mapper/vdo/vdo_target.c
+++ b/device_mapper/vdo/vdo_target.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -38,6 +38,13 @@ bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp,
valid = false;
}
+ if ((vtp->block_map_era_length < DM_VDO_BLOCK_MAP_ERA_LENGTH_MINIMUM) ||
+ (vtp->block_map_era_length > DM_VDO_BLOCK_MAP_ERA_LENGTH_MAXIMUM)) {
+ log_error("VDO block map era length %u out of range.",
+ vtp->block_map_era_length);
+ valid = false;
+ }
+
if ((vtp->index_memory_size_mb < DM_VDO_INDEX_MEMORY_SIZE_MINIMUM_MB) ||
(vtp->index_memory_size_mb > DM_VDO_INDEX_MEMORY_SIZE_MAXIMUM_MB)) {
log_error("VDO index memory size %u out of range.",
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 8eff74297..5209f51b5 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -545,41 +545,8 @@ static void _check_lv_segment(struct logical_volume *lv, struct lv_segment *seg,
seg_error("is missing a VDO pool data LV");
} else if (!lv_is_vdo_pool_data(seg_lv(seg, 0)))
seg_error("is not VDO pool data LV");
- if ((seg->vdo_params.minimum_io_size != (512 >> SECTOR_SHIFT)) &&
- (seg->vdo_params.minimum_io_size != (4096 >> SECTOR_SHIFT)))
- seg_error("sets unsupported VDO minimum io size");
- if ((seg->vdo_params.block_map_cache_size_mb < DM_VDO_BLOCK_MAP_CACHE_SIZE_MINIMUM_MB) ||
- (seg->vdo_params.block_map_cache_size_mb > DM_VDO_BLOCK_MAP_CACHE_SIZE_MAXIMUM_MB))
- seg_error("sets unsupported VDO block map cache size");
- if ((seg->vdo_params.block_map_era_length < DM_VDO_BLOCK_MAP_ERA_LENGTH_MINIMUM) ||
- (seg->vdo_params.block_map_era_length > DM_VDO_BLOCK_MAP_ERA_LENGTH_MAXIMUM))
- seg_error("sets unsupported VDO block map era length");
- if ((seg->vdo_params.index_memory_size_mb < DM_VDO_INDEX_MEMORY_SIZE_MINIMUM_MB) ||
- (seg->vdo_params.index_memory_size_mb > DM_VDO_INDEX_MEMORY_SIZE_MAXIMUM_MB))
- seg_error("sets unsupported VDO index memory size");
- if ((seg->vdo_params.slab_size_mb < DM_VDO_SLAB_SIZE_MINIMUM_MB) ||
- (seg->vdo_params.slab_size_mb > DM_VDO_SLAB_SIZE_MAXIMUM_MB))
- seg_error("sets unsupported VDO slab size");
- if ((seg->vdo_params.max_discard < DM_VDO_MAX_DISCARD_MINIMUM) ||
- (seg->vdo_params.max_discard > DM_VDO_MAX_DISCARD_MAXIMUM))
- seg_error("sets unsupported VDO max discard");
- if (seg->vdo_params.ack_threads > DM_VDO_ACK_THREADS_MAXIMUM)
- seg_error("sets unsupported VDO ack threads");
- if ((seg->vdo_params.bio_threads < DM_VDO_BIO_THREADS_MINIMUM) ||
- (seg->vdo_params.bio_threads > DM_VDO_BIO_THREADS_MAXIMUM))
- seg_error("sets unsupported VDO bio threads");
- if ((seg->vdo_params.bio_rotation < DM_VDO_BIO_ROTATION_MINIMUM) ||
- (seg->vdo_params.bio_rotation > DM_VDO_BIO_ROTATION_MAXIMUM))
- seg_error("sets unsupported VDO bio rotation");
- if ((seg->vdo_params.cpu_threads < DM_VDO_CPU_THREADS_MINIMUM) ||
- (seg->vdo_params.cpu_threads > DM_VDO_CPU_THREADS_MAXIMUM))
- seg_error("sets unsupported VDO cpu threads");
- if (seg->vdo_params.hash_zone_threads > DM_VDO_HASH_ZONE_THREADS_MAXIMUM)
- seg_error("sets unsupported VDO hash zone threads");
- if (seg->vdo_params.logical_threads > DM_VDO_LOGICAL_THREADS_MAXIMUM)
- seg_error("sets unsupported VDO logical threads");
- if (seg->vdo_params.physical_threads > DM_VDO_PHYSICAL_THREADS_MAXIMUM)
- seg_error("sets unsupported VDO physical threads");
+ if (!dm_vdo_validate_target_params(&seg->vdo_params, 0))
+ seg_error("sets invalid VDO parameter(s)");
} else { /* !VDO pool */
if (seg->vdo_pool_header_size)
seg_error("sets vdo_pool_header_size");
--
2.38.1

View File

@ -0,0 +1,295 @@
From b16082b05639d4321cbf699d3309fe24a8bc71fa Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Fri, 24 Jun 2022 15:54:08 +0200
Subject: [PATCH 2/3] vdo: use defines also for configuration defines
Keep single source for most of values printed in lvm.conf
(still needs some conversion)
Correct max for logical threads to 60
(we may refuse some older configuration which might eventually
user higher numbers - but so far let's assume no user have ever set this
as it's been non-trivial and if would complicate code unnecessarily.)
Accept maximum of 4PiB for virtual size of VDO LV
(lvm2 will drop 'header borders to 0 for this case').
(cherry picked from commit b5c8e591ed9ee30b67e79d60705d3c0bb8509a2a)
---
conf/example.conf.in | 9 +++---
device_mapper/vdo/vdo_limits.h | 55 ++++++++++++++++++----------------
device_mapper/vdo/vdo_target.c | 11 +++----
lib/config/config_settings.h | 32 +++++++++++++-------
4 files changed, 60 insertions(+), 47 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index a78ed7333..897622b9d 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -625,13 +625,12 @@ allocation {
# Enables or disables whether VDO volume should tag its latency-critical
# writes with the REQ_SYNC flag. Some device mapper targets such as dm-raid5
# process writes with this flag at a higher priority.
- # Default is enabled.
# This configuration option has an automatic default value.
# vdo_use_metadata_hints = 1
# Configuration option allocation/vdo_minimum_io_size.
# The minimum IO size for VDO volume to accept, in bytes.
- # Valid values are 512 or 4096. The recommended and default value is 4096.
+ # Valid values are 512 or 4096. The recommended value is 4096.
# This configuration option has an automatic default value.
# vdo_minimum_io_size = 4096
@@ -684,7 +683,7 @@ allocation {
# Configuration option allocation/vdo_bio_threads.
# Specifies the number of threads to use for submitting I/O
# operations to the storage device of VDO volume.
- # The value must be in range [1..100]
+ # The value must be in range [1..100].
# Each additional thread after the first will use an additional 18MiB of RAM,
# plus 1.12 MiB of RAM per megabyte of configured read cache size.
# This configuration option has an automatic default value.
@@ -698,7 +697,7 @@ allocation {
# Configuration option allocation/vdo_cpu_threads.
# Specifies the number of threads to use for CPU-intensive work such as
- # hashing or compression for VDO volume. The value must be in range [1..100]
+ # hashing or compression for VDO volume. The value must be in range [1..100].
# This configuration option has an automatic default value.
# vdo_cpu_threads = 2
@@ -716,7 +715,7 @@ allocation {
# processing based on the hash value computed from the block data.
# A logical thread count of 9 or more will require explicitly specifying
# a sufficiently large block map cache size, as well.
- # The value must be in range [0..100].
+ # The value must be in range [0..60].
# vdo_hash_zone_threads, vdo_logical_threads and vdo_physical_threads must be
# either all zero or all non-zero.
# This configuration option has an automatic default value.
diff --git a/device_mapper/vdo/vdo_limits.h b/device_mapper/vdo/vdo_limits.h
index e145100b1..db365ace2 100644
--- a/device_mapper/vdo/vdo_limits.h
+++ b/device_mapper/vdo/vdo_limits.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2018-2022 Red Hat, Inc. All rights reserved.
*
* This file is part of the device-mapper userspace tools.
*
@@ -15,49 +15,52 @@
#ifndef DEVICE_MAPPER_VDO_LIMITS_H
#define DEVICE_MAPPER_VDO_LIMITS_H
+#ifndef SECTOR_SHIFT
+#define SECTOR_SHIFT 9L
+#endif
+
#define DM_VDO_BLOCK_SIZE UINT64_C(8) // 4KiB in sectors
+#define DM_VDO_BLOCK_SIZE_KB (DM_VDO_BLOCK_SIZE << SECTOR_SHIFT)
#define DM_VDO_BLOCK_MAP_CACHE_SIZE_MINIMUM_MB (128) // 128MiB
#define DM_VDO_BLOCK_MAP_CACHE_SIZE_MAXIMUM_MB (16 * 1024 * 1024 - 1) // 16TiB - 1
#define DM_VDO_BLOCK_MAP_CACHE_SIZE_MINIMUM_PER_LOGICAL_THREAD (4096 * DM_VDO_BLOCK_SIZE_KB)
-#define DM_VDO_BLOCK_MAP_ERA_LENGTH_MINIMUM (1)
-#define DM_VDO_BLOCK_MAP_ERA_LENGTH_MAXIMUM (16380)
+#define DM_VDO_BLOCK_MAP_ERA_LENGTH_MINIMUM 1
+#define DM_VDO_BLOCK_MAP_ERA_LENGTH_MAXIMUM 16380
-#define DM_VDO_INDEX_MEMORY_SIZE_MINIMUM_MB (256) // 0.25 GiB
+#define DM_VDO_INDEX_MEMORY_SIZE_MINIMUM_MB 256 // 0.25 GiB
#define DM_VDO_INDEX_MEMORY_SIZE_MAXIMUM_MB (1024 * 1024 * 1024) // 1TiB
-//#define DM_VDO_READ_CACHE_SIZE_MINIMUM_MB (0)
-#define DM_VDO_READ_CACHE_SIZE_MAXIMUM_MB (16 * 1024 * 1024 - 1) // 16TiB - 1
-
-#define DM_VDO_SLAB_SIZE_MINIMUM_MB (128) // 128MiB
+#define DM_VDO_SLAB_SIZE_MINIMUM_MB 128 // 128MiB
#define DM_VDO_SLAB_SIZE_MAXIMUM_MB (32 * 1024) // 32GiB
+#define DM_VDO_SLABS_MAXIMUM 8192
-//#define DM_VDO_LOGICAL_SIZE_MINIMUM_MB (0)
-#define DM_VDO_LOGICAL_SIZE_MAXIMUM_MB (UINT64_C(4) * 1024 * 1024 * 1024) // 4PiB
+#define DM_VDO_LOGICAL_SIZE_MAXIMUM (UINT64_C(4) * 1024 * 1024 * 1024 * 1024 * 1024 >> SECTOR_SHIFT) // 4PiB
+#define DM_VDO_PHYSICAL_SIZE_MAXIMUM (UINT64_C(64) * DM_VDO_BLOCK_SIZE_KB * 1024 * 1024 * 1024 >> SECTOR_SHIFT) // 256TiB
-//#define DM_VDO_ACK_THREADS_MINIMUM (0)
-#define DM_VDO_ACK_THREADS_MAXIMUM (100)
+#define DM_VDO_ACK_THREADS_MINIMUM 0
+#define DM_VDO_ACK_THREADS_MAXIMUM 100
-#define DM_VDO_BIO_THREADS_MINIMUM (1)
-#define DM_VDO_BIO_THREADS_MAXIMUM (100)
+#define DM_VDO_BIO_THREADS_MINIMUM 1
+#define DM_VDO_BIO_THREADS_MAXIMUM 100
-#define DM_VDO_BIO_ROTATION_MINIMUM (1)
-#define DM_VDO_BIO_ROTATION_MAXIMUM (1024)
+#define DM_VDO_BIO_ROTATION_MINIMUM 1
+#define DM_VDO_BIO_ROTATION_MAXIMUM 1024
-#define DM_VDO_CPU_THREADS_MINIMUM (1)
-#define DM_VDO_CPU_THREADS_MAXIMUM (100)
+#define DM_VDO_CPU_THREADS_MINIMUM 1
+#define DM_VDO_CPU_THREADS_MAXIMUM 100
-//#define DM_VDO_HASH_ZONE_THREADS_MINIMUM (0)
-#define DM_VDO_HASH_ZONE_THREADS_MAXIMUM (100)
+#define DM_VDO_HASH_ZONE_THREADS_MINIMUM 0
+#define DM_VDO_HASH_ZONE_THREADS_MAXIMUM 100
-//#define DM_VDO_LOGICAL_THREADS_MINIMUM (0)
-#define DM_VDO_LOGICAL_THREADS_MAXIMUM (100)
+#define DM_VDO_LOGICAL_THREADS_MINIMUM 0
+#define DM_VDO_LOGICAL_THREADS_MAXIMUM 60
-//#define DM_VDO_PHYSICAL_THREADS_MINIMUM (0)
-#define DM_VDO_PHYSICAL_THREADS_MAXIMUM (16)
+#define DM_VDO_PHYSICAL_THREADS_MINIMUM 0
+#define DM_VDO_PHYSICAL_THREADS_MAXIMUM 16
-#define DM_VDO_MAX_DISCARD_MINIMUM (1)
-#define DM_VDO_MAX_DISCARD_MAXIMUM (UINT32_MAX / 4096)
+#define DM_VDO_MAX_DISCARD_MINIMUM 1
+#define DM_VDO_MAX_DISCARD_MAXIMUM (UINT32_MAX / (uint32_t)(DM_VDO_BLOCK_SIZE_KB))
#endif // DEVICE_MAPPER_VDO_LIMITS_H
diff --git a/device_mapper/vdo/vdo_target.c b/device_mapper/vdo/vdo_target.c
index 0e5abd162..3ebe0592e 100644
--- a/device_mapper/vdo/vdo_target.c
+++ b/device_mapper/vdo/vdo_target.c
@@ -18,14 +18,15 @@
#include "vdo_limits.h"
#include "target.h"
+/* validate vdo target parameters and 'vdo_size' in sectors */
bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp,
uint64_t vdo_size)
{
bool valid = true;
/* 512 or 4096 bytes only ATM */
- if ((vtp->minimum_io_size != 1) &&
- (vtp->minimum_io_size != 8)) {
+ if ((vtp->minimum_io_size != (512 >> SECTOR_SHIFT)) &&
+ (vtp->minimum_io_size != (4096 >> SECTOR_SHIFT))) {
log_error("VDO minimum io size %u is unsupported.",
vtp->minimum_io_size);
valid = false;
@@ -127,10 +128,10 @@ bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp,
valid = false;
}
- if (vdo_size >= (DM_VDO_LOGICAL_SIZE_MAXIMUM_MB * UINT64_C(1024 * 2))) {
+ if (vdo_size > DM_VDO_LOGICAL_SIZE_MAXIMUM) {
log_error("VDO logical size is by " FMTu64 "KiB bigger then limit " FMTu64 "TiB.",
- (vdo_size - (DM_VDO_LOGICAL_SIZE_MAXIMUM_MB * UINT64_C(1024 * 2))) / 2,
- DM_VDO_LOGICAL_SIZE_MAXIMUM_MB / UINT64_C(1024) / UINT64_C(1024));
+ (vdo_size - DM_VDO_LOGICAL_SIZE_MAXIMUM) / 2,
+ DM_VDO_LOGICAL_SIZE_MAXIMUM / (UINT64_C(1024) * 1024 * 1024 * 1024 >> SECTOR_SHIFT));
valid = false;
}
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index d280e7adb..2c91e8bb6 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -118,6 +118,7 @@
* the previous default value was set (uncommented) in lvm.conf.
*/
#include "lib/config/defaults.h"
+#include "device_mapper/vdo/vdo_limits.h"
cfg_section(root_CFG_SECTION, "(root)", root_CFG_SECTION, 0, vsn(0, 0, 0), 0, NULL, NULL)
@@ -708,12 +709,11 @@ cfg(allocation_vdo_use_deduplication_CFG, "vdo_use_deduplication", allocation_CF
cfg(allocation_vdo_use_metadata_hints_CFG, "vdo_use_metadata_hints", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_USE_METADATA_HINTS, VDO_1ST_VSN, NULL, 0, NULL,
"Enables or disables whether VDO volume should tag its latency-critical\n"
"writes with the REQ_SYNC flag. Some device mapper targets such as dm-raid5\n"
- "process writes with this flag at a higher priority.\n"
- "Default is enabled.\n")
+ "process writes with this flag at a higher priority.\n")
cfg(allocation_vdo_minimum_io_size_CFG, "vdo_minimum_io_size", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_MINIMUM_IO_SIZE, VDO_1ST_VSN, NULL, 0, NULL,
"The minimum IO size for VDO volume to accept, in bytes.\n"
- "Valid values are 512 or 4096. The recommended and default value is 4096.\n")
+ "Valid values are 512 or 4096. The recommended value is 4096.\n")
cfg(allocation_vdo_block_map_cache_size_mb_CFG, "vdo_block_map_cache_size_mb", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_BLOCK_MAP_CACHE_SIZE_MB, VDO_1ST_VSN, NULL, 0, NULL,
"Specifies the amount of memory in MiB allocated for caching block map\n"
@@ -726,7 +726,8 @@ cfg(allocation_vdo_block_map_era_length_CFG, "vdo_block_map_period", allocation_
"The speed with which the block map cache writes out modified block map pages.\n"
"A smaller era length is likely to reduce the amount time spent rebuilding,\n"
"at the cost of increased block map writes during normal operation.\n"
- "The maximum and recommended value is 16380; the minimum value is 1.\n")
+ "The maximum and recommended value is " DM_TO_STRING(DM_VDO_BLOCK_MAP_ERA_LENGTH_MAXIMUM)
+ "; the minimum value is " DM_TO_STRING(DM_VDO_BLOCK_MAP_ERA_LENGTH_MINIMUM) ".\n")
cfg(allocation_vdo_check_point_frequency_CFG, "vdo_check_point_frequency", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_CHECK_POINT_FREQUENCY, VDO_1ST_VSN, NULL, 0, NULL,
"The default check point frequency for VDO volume.\n")
@@ -748,27 +749,34 @@ cfg(allocation_vdo_slab_size_mb_CFG, "vdo_slab_size_mb", allocation_CFG_SECTION,
cfg(allocation_vdo_ack_threads_CFG, "vdo_ack_threads", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_ACK_THREADS, VDO_1ST_VSN, NULL, 0, NULL,
"Specifies the number of threads to use for acknowledging\n"
"completion of requested VDO I/O operations.\n"
- "The value must be at in range [0..100].\n")
+ "The value must be at in range [" DM_TO_STRING(DM_VDO_ACK_THREADS_MINIMUM) ".."
+ DM_TO_STRING(DM_VDO_ACK_THREADS_MAXIMUM) "].\n")
cfg(allocation_vdo_bio_threads_CFG, "vdo_bio_threads", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_BIO_THREADS, VDO_1ST_VSN, NULL, 0, NULL,
"Specifies the number of threads to use for submitting I/O\n"
"operations to the storage device of VDO volume.\n"
- "The value must be in range [1..100]\n"
+ "The value must be in range [" DM_TO_STRING(DM_VDO_BIO_THREADS_MINIMUM) ".."
+ DM_TO_STRING(DM_VDO_BIO_THREADS_MAXIMUM) "].\n"
"Each additional thread after the first will use an additional 18MiB of RAM,\n"
"plus 1.12 MiB of RAM per megabyte of configured read cache size.\n")
cfg(allocation_vdo_bio_rotation_CFG, "vdo_bio_rotation", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_BIO_ROTATION, VDO_1ST_VSN, NULL, 0, NULL,
"Specifies the number of I/O operations to enqueue for each bio-submission\n"
- "thread before directing work to the next. The value must be in range [1..1024].\n")
+ "thread before directing work to the next. The value must be in range ["
+ DM_TO_STRING(DM_VDO_BIO_ROTATION_MINIMUM) ".."
+ DM_TO_STRING(DM_VDO_BIO_ROTATION_MAXIMUM) "].\n")
cfg(allocation_vdo_cpu_threads_CFG, "vdo_cpu_threads", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_CPU_THREADS, VDO_1ST_VSN, NULL, 0, NULL,
"Specifies the number of threads to use for CPU-intensive work such as\n"
- "hashing or compression for VDO volume. The value must be in range [1..100]\n")
+ "hashing or compression for VDO volume. The value must be in range ["
+ DM_TO_STRING(DM_VDO_CPU_THREADS_MINIMUM) ".."
+ DM_TO_STRING(DM_VDO_CPU_THREADS_MAXIMUM) "].\n")
cfg(allocation_vdo_hash_zone_threads_CFG, "vdo_hash_zone_threads", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_VDO_HASH_ZONE_THREADS, VDO_1ST_VSN, NULL, 0, NULL,
"Specifies the number of threads across which to subdivide parts of the VDO\n"
"processing based on the hash value computed from the block data.\n"
- "The value must be at in range [0..100].\n"
+ "The value must be at in range [" DM_TO_STRING(DM_VDO_HASH_ZONE_THREADS_MINIMUM) ".."
+ DM_TO_STRING(DM_VDO_HASH_ZONE_THREADS_MAXIMUM) "].\n"
"vdo_hash_zone_threads, vdo_logical_threads and vdo_physical_threads must be\n"
"either all zero or all non-zero.\n")
@@ -777,7 +785,8 @@ cfg(allocation_vdo_logical_threads_CFG, "vdo_logical_threads", allocation_CFG_SE
"processing based on the hash value computed from the block data.\n"
"A logical thread count of 9 or more will require explicitly specifying\n"
"a sufficiently large block map cache size, as well.\n"
- "The value must be in range [0..100].\n"
+ "The value must be in range [" DM_TO_STRING(DM_VDO_LOGICAL_THREADS_MINIMUM) ".."
+ DM_TO_STRING(DM_VDO_LOGICAL_THREADS_MAXIMUM) "].\n"
"vdo_hash_zone_threads, vdo_logical_threads and vdo_physical_threads must be\n"
"either all zero or all non-zero.\n")
@@ -785,7 +794,8 @@ cfg(allocation_vdo_physical_threads_CFG, "vdo_physical_threads", allocation_CFG_
"Specifies the number of threads across which to subdivide parts of the VDO\n"
"processing based on physical block addresses.\n"
"Each additional thread after the first will use an additional 10MiB of RAM.\n"
- "The value must be in range [0..16].\n"
+ "The value must be in range [" DM_TO_STRING(DM_VDO_PHYSICAL_THREADS_MINIMUM) ".."
+ DM_TO_STRING(DM_VDO_PHYSICAL_THREADS_MAXIMUM) "].\n"
"vdo_hash_zone_threads, vdo_logical_threads and vdo_physical_threads must be\n"
"either all zero or all non-zero.\n")
--
2.38.1

View File

@ -0,0 +1,144 @@
From cce56ebaa6b67d53b0430d5b52b957e194c9527d Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Sat, 9 Jul 2022 21:28:40 +0200
Subject: [PATCH 3/3] vdo: report supported range in error path
(cherry picked from commit 9f3eff002cc229d3c22dfd7db6da69dadc0bd460)
---
device_mapper/vdo/vdo_target.c | 63 ++++++++++++++++++++++++----------
1 file changed, 45 insertions(+), 18 deletions(-)
diff --git a/device_mapper/vdo/vdo_target.c b/device_mapper/vdo/vdo_target.c
index 3ebe0592e..ab3fff26a 100644
--- a/device_mapper/vdo/vdo_target.c
+++ b/device_mapper/vdo/vdo_target.c
@@ -27,81 +27,108 @@ bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp,
/* 512 or 4096 bytes only ATM */
if ((vtp->minimum_io_size != (512 >> SECTOR_SHIFT)) &&
(vtp->minimum_io_size != (4096 >> SECTOR_SHIFT))) {
- log_error("VDO minimum io size %u is unsupported.",
+ log_error("VDO minimum io size %u is unsupported [512, 4096].",
vtp->minimum_io_size);
valid = false;
}
if ((vtp->block_map_cache_size_mb < DM_VDO_BLOCK_MAP_CACHE_SIZE_MINIMUM_MB) ||
(vtp->block_map_cache_size_mb > DM_VDO_BLOCK_MAP_CACHE_SIZE_MAXIMUM_MB)) {
- log_error("VDO block map cache size %u out of range.",
- vtp->block_map_cache_size_mb);
+ log_error("VDO block map cache size %u MiB is out of range [%u..%u].",
+ vtp->block_map_cache_size_mb,
+ DM_VDO_BLOCK_MAP_CACHE_SIZE_MINIMUM_MB,
+ DM_VDO_BLOCK_MAP_CACHE_SIZE_MAXIMUM_MB);
valid = false;
}
if ((vtp->block_map_era_length < DM_VDO_BLOCK_MAP_ERA_LENGTH_MINIMUM) ||
(vtp->block_map_era_length > DM_VDO_BLOCK_MAP_ERA_LENGTH_MAXIMUM)) {
- log_error("VDO block map era length %u out of range.",
- vtp->block_map_era_length);
+ log_error("VDO block map era length %u is out of range [%u..%u].",
+ vtp->block_map_era_length,
+ DM_VDO_BLOCK_MAP_ERA_LENGTH_MINIMUM,
+ DM_VDO_BLOCK_MAP_ERA_LENGTH_MAXIMUM);
valid = false;
}
if ((vtp->index_memory_size_mb < DM_VDO_INDEX_MEMORY_SIZE_MINIMUM_MB) ||
(vtp->index_memory_size_mb > DM_VDO_INDEX_MEMORY_SIZE_MAXIMUM_MB)) {
- log_error("VDO index memory size %u out of range.",
- vtp->index_memory_size_mb);
+ log_error("VDO index memory size %u MiB is out of range [%u..%u].",
+ vtp->index_memory_size_mb,
+ DM_VDO_INDEX_MEMORY_SIZE_MINIMUM_MB,
+ DM_VDO_INDEX_MEMORY_SIZE_MAXIMUM_MB);
valid = false;
}
if ((vtp->slab_size_mb < DM_VDO_SLAB_SIZE_MINIMUM_MB) ||
(vtp->slab_size_mb > DM_VDO_SLAB_SIZE_MAXIMUM_MB)) {
- log_error("VDO slab size %u out of range.",
- vtp->slab_size_mb);
+ log_error("VDO slab size %u MiB is out of range [%u..%u].",
+ vtp->slab_size_mb,
+ DM_VDO_SLAB_SIZE_MINIMUM_MB,
+ DM_VDO_SLAB_SIZE_MAXIMUM_MB);
valid = false;
}
if ((vtp->max_discard < DM_VDO_MAX_DISCARD_MINIMUM) ||
(vtp->max_discard > DM_VDO_MAX_DISCARD_MAXIMUM)) {
- log_error("VDO max discard %u out of range.",
- vtp->max_discard);
+ log_error("VDO max discard %u is out of range [%u..%u].",
+ vtp->max_discard,
+ DM_VDO_MAX_DISCARD_MINIMUM,
+ DM_VDO_MAX_DISCARD_MAXIMUM);
valid = false;
}
if (vtp->ack_threads > DM_VDO_ACK_THREADS_MAXIMUM) {
- log_error("VDO ack threads %u out of range.", vtp->ack_threads);
+ log_error("VDO ack threads %u is out of range [0..%u].",
+ vtp->ack_threads,
+ DM_VDO_ACK_THREADS_MAXIMUM);
valid = false;
}
if ((vtp->bio_threads < DM_VDO_BIO_THREADS_MINIMUM) ||
(vtp->bio_threads > DM_VDO_BIO_THREADS_MAXIMUM)) {
- log_error("VDO bio threads %u out of range.", vtp->bio_threads);
+ log_error("VDO bio threads %u is out of range [%u..%u].",
+ vtp->bio_threads,
+ DM_VDO_BIO_THREADS_MINIMUM,
+ DM_VDO_BIO_THREADS_MAXIMUM);
valid = false;
}
if ((vtp->bio_rotation < DM_VDO_BIO_ROTATION_MINIMUM) ||
(vtp->bio_rotation > DM_VDO_BIO_ROTATION_MAXIMUM)) {
- log_error("VDO bio rotation %u out of range.", vtp->bio_rotation);
+ log_error("VDO bio rotation %u is out of range [%u..%u].",
+ vtp->bio_rotation,
+ DM_VDO_BIO_ROTATION_MINIMUM,
+ DM_VDO_BIO_ROTATION_MAXIMUM);
valid = false;
}
if ((vtp->cpu_threads < DM_VDO_CPU_THREADS_MINIMUM) ||
(vtp->cpu_threads > DM_VDO_CPU_THREADS_MAXIMUM)) {
- log_error("VDO cpu threads %u out of range.", vtp->cpu_threads);
+ log_error("VDO cpu threads %u is out of range [%u..%u].",
+ vtp->cpu_threads,
+ DM_VDO_CPU_THREADS_MINIMUM,
+ DM_VDO_CPU_THREADS_MAXIMUM);
valid = false;
}
if (vtp->hash_zone_threads > DM_VDO_HASH_ZONE_THREADS_MAXIMUM) {
- log_error("VDO hash zone threads %u out of range.", vtp->hash_zone_threads);
+ log_error("VDO hash zone threads %u is out of range [0..%u].",
+ vtp->hash_zone_threads,
+ DM_VDO_HASH_ZONE_THREADS_MAXIMUM);
valid = false;
}
if (vtp->logical_threads > DM_VDO_LOGICAL_THREADS_MAXIMUM) {
- log_error("VDO logical threads %u out of range.", vtp->logical_threads);
+ log_error("VDO logical threads %u is out of range [0..%u].",
+ vtp->logical_threads,
+ DM_VDO_LOGICAL_THREADS_MAXIMUM);
valid = false;
}
if (vtp->physical_threads > DM_VDO_PHYSICAL_THREADS_MAXIMUM) {
- log_error("VDO physical threads %u out of range.", vtp->physical_threads);
+ log_error("VDO physical threads %u is out of range [0..%u].",
+ vtp->physical_threads,
+ DM_VDO_PHYSICAL_THREADS_MAXIMUM);
valid = false;
}
--
2.38.1

View File

@ -68,7 +68,7 @@ Version: 2.03.14
%if 0%{?from_snapshot}
Release: 0.1.20210426git%{shortcommit}%{?dist}%{?rel_suffix}
%else
Release: 6%{?dist}%{?rel_suffix}
Release: 9%{?dist}%{?rel_suffix}
%endif
License: GPLv2
URL: http://sourceware.org/lvm2
@ -133,11 +133,28 @@ Patch52: 0051-filter-mpath-handle-other-wwid-types-in-blacklist.patch
Patch53: 0052-vdo-fix-conversion-of-vdo_slab_size_mb.patch
Patch54: 0053-filter-mpath-get-wwids-from-sysfs-vpd_pg83.patch
Patch55: 0054-build-Fix-make-rpm-with-VERSION_DM-without-dash.patch
Patch56: 0055-make-generate.patch
# BZ 2090949:
Patch57: 0056-exit-with-error-when-devicesfile-name-doesn-t-exist.patch
# BZ 2111137:
Patch58: 0057-apply-multipath_component_detection-0-to-duplicate-P.patch
# BZ 2121237:
Patch59: 0058-devices-file-fix-pvcreate-uuid-matching-pvid-entry-w.patch
# BZ 2061800:
Patch60: 0059-lvconvert-correct-test-support-for-vdo-pool.patch
# BZ 2022135:
Patch61: 0060-lvmdbusd-Set-LVM_COMMAND_PROFILE-lvmdbusd.patch
# BZ 2139512:
Patch62: 0061-vgimportdevices-change-result-when-devices-are-not-a.patch
Patch63: 0062-vgimportdevices-fix-locking-when-creating-devices-fi.patch
# BZ 2054032:
Patch64: 0063-thin-fix-message-processing-on-thin-pool-extension.patch
# BZ 2108254:
Patch65: 0064-vdo-fix-vdosettings-parser.patch
Patch66: 0065-make-generate.patch
# BZ 2108239:
Patch67: 0066-vdo-use-single-validator.patch
Patch68: 0067-vdo-use-defines-also-for-configuration-defines.patch
Patch69: 0068-vdo-report-supported-range-in-error-path.patch
BuildRequires: gcc
%if %{enable_testsuite}
@ -253,9 +270,19 @@ or more physical volumes and creating one or more logical volumes
%patch53 -p1 -b .backup53
%patch54 -p1 -b .backup54
%patch55 -p1 -b .backup55
%patch56 -p1 -b .backup56
%patch57 -p1 -b .backup57
%patch58 -p1 -b .backup58
%patch59 -p1 -b .backup59
%patch60 -p1 -b .backup60
%patch61 -p1 -b .backup61
%patch62 -p1 -b .backup62
%patch63 -p1 -b .backup63
%patch64 -p1 -b .backup64
%patch65 -p1 -b .backup65
%patch66 -p1 -b .backup66
%patch67 -p1 -b .backup67
%patch68 -p1 -b .backup68
%patch69 -p1 -b .backup69
%build
%global _default_pid_dir /run
@ -874,6 +901,19 @@ An extensive functional testsuite for LVM2.
%endif
%changelog
* Thu Dec 08 2022 Marian Csontos <mcsontos@redhat.com> - 2.03.14-9
- Fix handling of invalid values passed to vdo_block_map_era_length.
* Thu Dec 08 2022 Marian Csontos <mcsontos@redhat.com> - 2.03.14-8
- Fix [vdo_]use_compression options.
- Fix vgimportdevices operating on incomplete VGs fails when nothing to import.
- Fix message processing on thin-pool extension leaving devices behind.
* Mon Nov 28 2022 Marian Csontos <mcsontos@redhat.com> - 2.03.14-7
- Fix lvm crash when recreating PV with UUID of a missing PV.
- Fix lvconvert --type vdo-pool with --test should not write signature.
- Use correect profile in lvmdbusd preventing messages in JSON output.
* Fri Jul 29 2022 Marian Csontos <mcsontos@redhat.com> - 2.03.14-6
- Fix effect of setting multipath_component_detection to 0.