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
77 lines
3.0 KiB
Diff
77 lines
3.0 KiB
Diff
From 0eebd9d7802c724ee71b6ebb80940ea6007f9c7a Mon Sep 17 00:00:00 2001
|
|
From: David Teigland <teigland@redhat.com>
|
|
Date: Tue, 30 Aug 2022 14:40:48 -0500
|
|
Subject: [PATCH] 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 193eb7585f45..85f9b499af4d 100644
|
|
--- a/lib/device/dev-cache.c
|
|
+++ b/lib/device/dev-cache.c
|
|
@@ -1937,10 +1937,9 @@ int setup_devices(struct cmd_context *cmd)
|
|
|
|
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 6c70f110c820..a0a6265336ed 100644
|
|
--- a/lib/device/device_id.c
|
|
+++ b/lib/device/device_id.c
|
|
@@ -2468,6 +2468,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 9ade1b9e4b21..23c2718ffe0f 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.26.2
|
|
|