819badda28
- Update lvm2 from LVM2.2.03.15 to LVM2.2.03.16 *** WHATS_NEW for 2.03.16 *** Version 2.03.16 - 18th May 2022 =============================== Fix segfault when handling selection with historical LVs. Add support --vdosettings with lvcreate, lvconvert, lvchange. Filtering multipath devices respects blacklist setting from multipath configuration. lvmdevices support for removing by device id using --deviceidtype and --deldev. Display writecache block size with lvs -o writecache_block_size. Improve cachesettings description in man lvmcache. Fix lossing of delete message on thin-pool extension. - Drop patches that have been merged into upstream - 0001-post-release.patch - 0002-asan-fix-some-reports-from-libasan.patch - 0003-make-generate.patch - 0004-tests-udev-pvscan-vgchange-fix-service-wait.patch - 0005-devices-file-do-not-clear-PVID-of-unread-devices.patch - 0006-tests-skip-vgchange-pvs-online.sh-on-rhel5.patch - 0007-dev_manager-fix-dm_task_get_device_list.patch - 0008-dev_manager-failing-status-is-not-internal-error.patch - 0009-clang-add-extra-check.patch - 0010-clang-possible-better-compilation-with-musl-c.patch - 0011-dev_manager-do-not-query-for-open_count.patch - 0012-dev_manager-use-list-info-for-preset-devs.patch - 0013-man-lvmcache-add-more-writecache-cachesettings-info.patch - 0014-man-update-cachesettings-option-description.patch - 0015-man-lvmcache-mention-writecache-memory-usage.patch - 0016-writecache-display-block-size-from-lvs.patch - 0017-devices-simplify-dev_cache_get_by_devt.patch - 0018-devices-drop-incorrect-paths-from-aliases-list.patch - 0019-devices-initial-use-of-existing-option.patch - 0020-devices-fix-dev_name-assumptions.patch - 0021-devices-use-dev-cache-aliases-handling-from-label-sc.patch - 0022-devices-only-close-PVs-on-LVs-when-scan_lvs-is-enabl.patch - 0023-writecache-check-memory-usage.patch - 0024-pvscan-don-t-use-udev-for-external-device-info.patch - 0025-vgchange-monitor-don-t-use-udev-info.patch - Add upstream patch - 0001-devices-file-move-clean-up-after-command-is-run.patch - 0002-devices-file-fail-if-devicesfile-filename-doesn-t-ex.patch - 0003-filter-mpath-handle-other-wwid-types-in-blacklist.patch - 0004-filter-mpath-get-wwids-from-sysfs-vpd_pg83.patch - 0005-pvdisplay-restore-reportformat-option.patch - 0006-exit-with-error-when-devicesfile-name-doesn-t-exist.patch - 0007-report-fix-pe_start-column-type-from-NUM-to-SIZ.patch - 0008-_vg_read_raw_area-fix-segfault-caused-by-using-null-.patch - 0009-mm-remove-libaio-from-being-skipped.patch - 0010-dmsetup-check-also-for-ouf-of-range-value.patch - 0011-devices-drop-double-from-sysfs-path.patch - 0012-devices-file-fix-pvcreate-uuid-matching-pvid-entry-w.patch - 0013-vgimportdevices-change-result-when-devices-are-not-a.patch - 0014-vgimportdevices-fix-locking-when-creating-devices-fi.patch - update lvm2.spec - indent some lines for easy read - remove config item '--enable-cmirrord' - add new man lvm_import_vdo.8 - add new man dmfilemapd.8 OBS-URL: https://build.opensuse.org/request/show/1000764 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=312
247 lines
7.5 KiB
Diff
247 lines
7.5 KiB
Diff
From 92b4fcf57f3c6d212d06b72b097e1a06e6efb84b Mon Sep 17 00:00:00 2001
|
|
From: David Teigland <teigland@redhat.com>
|
|
Date: Tue, 5 Jul 2022 17:08:00 -0500
|
|
Subject: [PATCH] exit with error when --devicesfile name doesn't exist
|
|
|
|
---
|
|
lib/cache/lvmcache.c | 3 ++-
|
|
lib/label/label.c | 4 ++--
|
|
test/shell/devicesfile-basic.sh | 1 +
|
|
tools/pvcreate.c | 3 ++-
|
|
tools/pvremove.c | 3 ++-
|
|
tools/pvscan.c | 3 ++-
|
|
tools/toollib.c | 27 +++++++++++++++++++++------
|
|
tools/vgcfgrestore.c | 5 ++++-
|
|
tools/vgcreate.c | 5 ++++-
|
|
tools/vgextend.c | 3 ++-
|
|
tools/vgmerge.c | 3 ++-
|
|
tools/vgsplit.c | 3 ++-
|
|
12 files changed, 46 insertions(+), 17 deletions(-)
|
|
|
|
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
|
|
index 22edcfd849e3..a1c4a61c82fa 100644
|
|
--- a/lib/cache/lvmcache.c
|
|
+++ b/lib/cache/lvmcache.c
|
|
@@ -1612,7 +1612,8 @@ int lvmcache_label_scan(struct cmd_context *cmd)
|
|
* with infos/vginfos based on reading headers from
|
|
* each device, and a vg summary from each mda.
|
|
*/
|
|
- label_scan(cmd);
|
|
+ if (!label_scan(cmd))
|
|
+ return_0;
|
|
|
|
/*
|
|
* When devnames are used as device ids (which is dispreferred),
|
|
diff --git a/lib/label/label.c b/lib/label/label.c
|
|
index 711edb6f4085..f845abb9640f 100644
|
|
--- a/lib/label/label.c
|
|
+++ b/lib/label/label.c
|
|
@@ -801,7 +801,7 @@ static int _setup_bcache(void)
|
|
}
|
|
|
|
if (!(scan_bcache = bcache_create(BCACHE_BLOCK_SIZE_IN_SECTORS, cache_blocks, ioe))) {
|
|
- log_error("Failed to create bcache with %d cache blocks.", cache_blocks);
|
|
+ log_error("Failed to set up io layer with %d blocks.", cache_blocks);
|
|
return 0;
|
|
}
|
|
|
|
@@ -1292,7 +1292,7 @@ int label_scan(struct cmd_context *cmd)
|
|
* data to invalidate.)
|
|
*/
|
|
if (!(iter = dev_iter_create(NULL, 0))) {
|
|
- log_error("Scanning failed to get devices.");
|
|
+ log_error("Failed to get device list.");
|
|
return 0;
|
|
}
|
|
while ((dev = dev_iter_get(cmd, iter))) {
|
|
diff --git a/test/shell/devicesfile-basic.sh b/test/shell/devicesfile-basic.sh
|
|
index 77fe265a0c54..715c579b394c 100644
|
|
--- a/test/shell/devicesfile-basic.sh
|
|
+++ b/test/shell/devicesfile-basic.sh
|
|
@@ -107,6 +107,7 @@ not vgs --devicesfile test.devices $vg2
|
|
# misspelled override name fails
|
|
not vgs --devicesfile doesnotexist $vg1
|
|
not vgs --devicesfile doesnotexist $vg2
|
|
+not vgs --devicesfile doesnotexist
|
|
|
|
# devicesfile and devices cannot be used together
|
|
not vgs --devicesfile test.devices --devices "$dev1","$dev1" $vg1
|
|
diff --git a/tools/pvcreate.c b/tools/pvcreate.c
|
|
index 71eb060a37ae..a1ef0e9e1941 100644
|
|
--- a/tools/pvcreate.c
|
|
+++ b/tools/pvcreate.c
|
|
@@ -144,7 +144,8 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
|
|
|
|
cmd->create_edit_devices_file = 1;
|
|
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!lvmcache_label_scan(cmd))
|
|
+ return_ECMD_FAILED;
|
|
|
|
if (!(handle = init_processing_handle(cmd, NULL))) {
|
|
log_error("Failed to initialize processing handle.");
|
|
diff --git a/tools/pvremove.c b/tools/pvremove.c
|
|
index 2dfdbd016826..5c39ee0c7904 100644
|
|
--- a/tools/pvremove.c
|
|
+++ b/tools/pvremove.c
|
|
@@ -45,7 +45,8 @@ int pvremove(struct cmd_context *cmd, int argc, char **argv)
|
|
|
|
clear_hint_file(cmd);
|
|
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!lvmcache_label_scan(cmd))
|
|
+ return_ECMD_FAILED;
|
|
|
|
/* When forcibly clearing a PV we don't care about a VG lock. */
|
|
if (pp.force == DONT_PROMPT_OVERRIDE)
|
|
diff --git a/tools/pvscan.c b/tools/pvscan.c
|
|
index 1e47d754ab7e..72c3279c3179 100644
|
|
--- a/tools/pvscan.c
|
|
+++ b/tools/pvscan.c
|
|
@@ -1407,7 +1407,8 @@ static int _pvscan_cache_all(struct cmd_context *cmd, int argc, char **argv,
|
|
* which we want 'pvscan --cache' to do, and that uses
|
|
* info from lvmcache, e.g. duplicate pv info.
|
|
*/
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!lvmcache_label_scan(cmd))
|
|
+ return_0;
|
|
|
|
cmd->pvscan_recreate_hints = 0;
|
|
cmd->use_hints = 0;
|
|
diff --git a/tools/toollib.c b/tools/toollib.c
|
|
index d77092d894d2..544791808f6c 100644
|
|
--- a/tools/toollib.c
|
|
+++ b/tools/toollib.c
|
|
@@ -1655,7 +1655,10 @@ int process_each_label(struct cmd_context *cmd, int argc, char **argv,
|
|
|
|
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_LABEL);
|
|
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!lvmcache_label_scan(cmd)) {
|
|
+ ret_max = ECMD_FAILED;
|
|
+ goto_out;
|
|
+ }
|
|
|
|
if (argc) {
|
|
for (; opt < argc; opt++) {
|
|
@@ -2435,8 +2438,13 @@ int process_each_vg(struct cmd_context *cmd,
|
|
* Scan all devices to populate lvmcache with initial
|
|
* list of PVs and VGs.
|
|
*/
|
|
- if (!(read_flags & PROCESS_SKIP_SCAN))
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!(read_flags & PROCESS_SKIP_SCAN)) {
|
|
+ if (!lvmcache_label_scan(cmd)) {
|
|
+ ret_max = ECMD_FAILED;
|
|
+ goto_out;
|
|
+ }
|
|
+ }
|
|
+
|
|
|
|
/*
|
|
* A list of all VGs on the system is needed when:
|
|
@@ -3987,7 +3995,10 @@ int process_each_lv(struct cmd_context *cmd,
|
|
* Scan all devices to populate lvmcache with initial
|
|
* list of PVs and VGs.
|
|
*/
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!lvmcache_label_scan(cmd)) {
|
|
+ ret_max = ECMD_FAILED;
|
|
+ goto_out;
|
|
+ }
|
|
|
|
/*
|
|
* A list of all VGs on the system is needed when:
|
|
@@ -4623,8 +4634,12 @@ int process_each_pv(struct cmd_context *cmd,
|
|
goto_out;
|
|
}
|
|
|
|
- if (!(read_flags & PROCESS_SKIP_SCAN))
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!(read_flags & PROCESS_SKIP_SCAN)) {
|
|
+ if (!lvmcache_label_scan(cmd)) {
|
|
+ ret_max = ECMD_FAILED;
|
|
+ goto_out;
|
|
+ }
|
|
+ }
|
|
|
|
if (!lvmcache_get_vgnameids(cmd, &all_vgnameids, only_this_vgname, 1)) {
|
|
ret_max = ret;
|
|
diff --git a/tools/vgcfgrestore.c b/tools/vgcfgrestore.c
|
|
index e49313d144e8..9fcba89d44d5 100644
|
|
--- a/tools/vgcfgrestore.c
|
|
+++ b/tools/vgcfgrestore.c
|
|
@@ -132,7 +132,10 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
|
|
|
|
clear_hint_file(cmd);
|
|
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!lvmcache_label_scan(cmd)) {
|
|
+ unlock_vg(cmd, NULL, vg_name);
|
|
+ return_ECMD_FAILED;
|
|
+ }
|
|
|
|
cmd->handles_unknown_segments = 1;
|
|
|
|
diff --git a/tools/vgcreate.c b/tools/vgcreate.c
|
|
index dde3f1eac279..14608777fd59 100644
|
|
--- a/tools/vgcreate.c
|
|
+++ b/tools/vgcreate.c
|
|
@@ -84,7 +84,10 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
|
|
|
|
cmd->create_edit_devices_file = 1;
|
|
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!lvmcache_label_scan(cmd)) {
|
|
+ unlock_vg(cmd, NULL, vp_new.vg_name);
|
|
+ return_ECMD_FAILED;
|
|
+ }
|
|
|
|
if (lvmcache_vginfo_from_vgname(vp_new.vg_name, NULL)) {
|
|
unlock_vg(cmd, NULL, vp_new.vg_name);
|
|
diff --git a/tools/vgextend.c b/tools/vgextend.c
|
|
index 0856b4c78d25..fecd6bdd5b4f 100644
|
|
--- a/tools/vgextend.c
|
|
+++ b/tools/vgextend.c
|
|
@@ -160,7 +160,8 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
|
|
|
|
cmd->edit_devices_file = 1;
|
|
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!lvmcache_label_scan(cmd))
|
|
+ return_ECMD_FAILED;
|
|
|
|
if (!(handle = init_processing_handle(cmd, NULL))) {
|
|
log_error("Failed to initialize processing handle.");
|
|
diff --git a/tools/vgmerge.c b/tools/vgmerge.c
|
|
index 08615cd62305..4ed4a8f0b752 100644
|
|
--- a/tools/vgmerge.c
|
|
+++ b/tools/vgmerge.c
|
|
@@ -72,7 +72,8 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
|
|
return ECMD_FAILED;
|
|
}
|
|
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!lvmcache_label_scan(cmd))
|
|
+ return_ECMD_FAILED;
|
|
|
|
if (strcmp(vg_name_to, vg_name_from) > 0)
|
|
lock_vg_from_first = 1;
|
|
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
|
|
index 5f113b3635e2..c7f4b8af4db1 100644
|
|
--- a/tools/vgsplit.c
|
|
+++ b/tools/vgsplit.c
|
|
@@ -559,7 +559,8 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
|
|
return ECMD_FAILED;
|
|
}
|
|
|
|
- lvmcache_label_scan(cmd);
|
|
+ if (!lvmcache_label_scan(cmd))
|
|
+ return_ECMD_FAILED;
|
|
|
|
if (!(vginfo_to = lvmcache_vginfo_from_vgname(vg_name_to, NULL))) {
|
|
if (!validate_name(vg_name_to)) {
|
|
--
|
|
2.26.2
|
|
|