main - lvchange: fix lvchange refresh failed for dm suspend or resume failed
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=47bcb446b83f9aa4fca...
Commit: 47bcb446b83f9aa4fca74301fda109a8bf670fbb
Parent: e5c0562654b8449f91c423e92e9b78d4ce986dc3
Author: Yi Wang <wang.yi59(a)zte.com.cn>
AuthorDate: Fri Aug 13 13:49:13 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Aug 16 09:45:40 2021 -0500
lvchange: fix lvchange refresh failed for dm suspend or resume failed
When multiple lvchange refresh processes executed at the same time,
suspend/resume ioctl on the same dm, some of these commands will be failed
for dm aready change status, and ioctl will return EINVAL in _do_dm_ioctl function.
to avoid this problem, add READ_FOR_ACTIVATE flags in lvchange refresh process,
it will hold LCK_WRITE lock and avoid suspend/resume dm at the same time.
Signed-off-by: Long YunJian <long.yunjian(a)zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59(a)zte.com.cn>
---
tools/lvchange.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index d4c40df47..0525bc53c 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -1622,7 +1622,7 @@ int lvchange_refresh_cmd(struct cmd_context *cmd, int argc, char **argv)
cmd->lockd_vg_default_sh = 1;
cmd->ignore_device_name_mismatch = 1;
- return process_each_lv(cmd, argc, argv, NULL, NULL, 0,
+ return process_each_lv(cmd, argc, argv, NULL, NULL, READ_FOR_ACTIVATE,
NULL, &_lvchange_refresh_check, &_lvchange_refresh_single);
}
2 years, 8 months
main - toolcontext.h: use bit field in struct
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e5c0562654b8449f91c...
Commit: e5c0562654b8449f91c423e92e9b78d4ce986dc3
Parent: 59209ef04944e8f8fac2836be1d875a080c58a9e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Aug 12 15:51:43 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 12 15:51:43 2021 -0500
toolcontext.h: use bit field in struct
Two recent additions should have used a bit instead
of an entire int.
---
lib/commands/toolcontext.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 0911b05f1..1a1785bfe 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -193,8 +193,8 @@ struct cmd_context {
unsigned run_by_dmeventd:1; /* command is being run by dmeventd */
unsigned sysinit:1; /* --sysinit is used */
unsigned check_devs_used:1; /* check devs used by LVs */
- unsigned print_device_id_not_found; /* print devices file entries not found */
- unsigned ignore_device_name_mismatch; /* skip updating devices file names */
+ unsigned print_device_id_not_found:1; /* print devices file entries not found */
+ unsigned ignore_device_name_mismatch:1; /* skip updating devices file names */
/*
* Devices and filtering.
2 years, 8 months
v2_03_13 annotated tag has been created
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=91a82455813bebce094...
Commit: 91a82455813bebce0949cb681369f370ce3105d5
Parent: 0000000000000000000000000000000000000000
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: 2021-08-11 15:36 +0000
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: 2021-08-11 15:36 +0000
annotated tag: v2_03_13 has been created
at 91a82455813bebce0949cb681369f370ce3105d5 (tag)
tagging 67a853f3376059dc7022b544b7b6dae6a5e262d3 (commit)
replaces v2_03_12
Test Release 2.03.13
WARNING: This release is intended mainly for testing.
Less reliance on udev:
- Users suffering from udev timeouts are sometimes recommended to change the
obtain_device_list_from_udev configuration option to 0. This is now default
and /dev is read instead of udev.
- Use of multipath wwids file to quick check if device is multipath.
See devices/external_device_info_source, devices/obtain_device_list_from_udev,
and devices/multipath_wwids_file help in lvm.conf
Other changes worth highlighting:
- Refactoring of archive() and backup() internal calls.
- New vdoimport tool to convert VDO volumes to LVs (requires updated kernel and
vdo tools.)
And many fixes, improvements, and clean ups.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAABAgAGBQJhE+6bAAoJELkRJDHlCQOf18MQAPrVDEvyF5dj6q/agq9+Za2B
LS3xlfZjrbUip16W9TJ2JBHiLSNe4U+CLC30XMy/CH9lWQ5zkuP5dpUiRt6YDrL8
5WWGqQpR7wSj1noNyElBcObOzGhKBpQtGx4IoiKrbaZYxOgDm3j0oo5IH6uxNy3e
Ku2x0CvYZYbO0q1fOTXv67YzIUQrheEMr2sn+/4g9MkozAddsfRQYphKsHEkXuVH
YHWadDxYHSGvNNb4dPVXDKIPtFFMwaX5QzTPjW0QEtjGSh4JKtW0dknHY0y78R2G
ePvSO9g9W/msF5wGR4agHhVOJqPuEQ8HdHAlqQXyZEiJbfD2WpdfZ91oBT8Xl59S
8B3WpM58L/f4QCLbwR39F4ntfoWw1k9IZ4bnoktgOYcX+kVSgSl7IskrFrk4qchZ
rzaqvcNjdcyH4GLEJdW9pfiSBhGkChql0wkgp1qOJalMOQVDaJtH7oocxyK1U7VA
Ra+TI4NyMYCbM5stcrZiIa24Cqo49i+hfrEKj0nRIU2kuSAWFJPocDuil/1BYZ8c
kMlIILoE3qODXXdxV9HQ2xxEHGsoA8RC5/uwwRXWv6VrFXbbn/p1VZSyg4Vlocjq
PNGglK6f5ALjZq9q+FmK3cLU4EGHwnU+YlDbW3+FFmSiMgs9Fr5faGPfWt/EqscX
I2UcqsgeWk9pJKR+rMk6
=nu52
-----END PGP SIGNATURE-----
David Teigland (36):
enable command syntax for thin and writecache
lvremove: fix removing thin pool with writecache on data
writecache: fix lv_on_pmem
writecache: don't pvmove device used by writecache
pvchange: fix file locking deadlock
fix empty mem pool leak
tests: writecache-blocksize add dm-cache tests
tests: rename test
tests: add writecache-cache-blocksize-2
devices: don't use deleted loop backing file for device id
man/help: fix common option listing
lvmdevices: add deviceidtype option
tests: add some LVM_TEST_LOCK_TYPE_IDM
tests: fix skip in stress_single_thread.sh
coverity cleanups
lvconvert: allow writecache with other thinpool command syntax
device_id: handle scsi_debug wwid
writecache: use block size 4096 when no fs is found
device_id: handle qemu wwid
tests: skip tests that require blkid BLOCK_SIZE
scan: don't hold bcache block during scan
scan: retry reading metadata on error
scan: move metadata vgname check
pvscan: skip indexing devices used by LVs
skip indexing devices used by LVs in more commands
devices: rework libudev usage
filter-usable: remove udev dev size check
fix multipath component detection for multiple holders
pvscan: do nothing for device removal and event_activation=0
pvscan: narrow the previous commit slightly
writecache: fix missing sync_dev_names when attaching cache
writecache: use block size 512 for thin pool data
cov: lvmlockd path copy
devices file: limit warnings about devices file entries not found
devices file: avoid updating entry dev names in some cases
pvscan: only match devices file for command args
Heming Zhao (1):
toolcontext: fix double free (core dumped) issue
Leo Yan (26):
lvmlockd: idm: Introduce new locking scheme
lvmlockd: idm: Hook Seagate IDM wrapper APIs
lib: locking: Add new type "idm"
lib: locking: Parse PV list for IDM locking
tools: Add support for "idm" lock type
configure: Add macro LOCKDIDM_SUPPORT
tests: Enable the testing for IDM locking scheme
tests: Support multiple backing devices
tests: Cleanup idm context when prepare devices
tests: Add checking for lvmlockd log
tests: stress: Add single thread stress testing
tests: stress: Add multi-threads stress testing for VG/LV
tests: stress: Add multi-threads stress testing for PV/VG/LV
tests: Support idm failure injection
tests: Add testing for lvmlockd failure
tests: idm: Add testing for the fabric failure
tests: idm: Add testing for the fabric failure and timeout
tests: idm: Add testing for the fabric's half brain failure
tests: idm: Add testing for IDM lock manager failure
tests: multi-hosts: Add VG testing
tests: multi-hosts: Add LV testing
tests: multi-hosts: Test lease timeout with LV exclusive mode
tests: multi-hosts: Test lease timeout with LV shareable mode
lvmlockd: Fix the compilation warning
tests: stress: Change to use $SHARED for vgcreate
tests: Fix building for IDM program
Marian Csontos (4):
post-release
spec: Add vdoimport man page
WHATS_NEW: update
pre-release
Tony Asleson (4):
lvmdbusd: Don't setup search key unless needed
lvmdbusd: Defer dbus object removal
lvmdbusd: Handle arbitrary amounts stdout & stderr
lvmdbusd: Wrap json.load in try/except
Wu Guanghao (1):
pvck: add lock_global() before clean_hint_file()
Zdenek Kabelac (32):
vdo: fix preload of kvdo
archiving: take archive automatically
backup: automatically store data on vg_unlock
archive: avoid abuse of internal flag
config_settings: typo fix
lvconvert: fix vdo virtual size when specified
vdo: rename variable vdo_pool_zero
vdo: support vdo_pool_header_size
make: generate
WHATS_NEW: update
configure: updates
vdo: add vdoimport support
man: vdoimport page
thin: fix component detection of external origin
vgremove: remove forgotten pmspare
vgsplit: add support for option --poolmetadataspare
test
vgmerge: remove one of merge pmspare LVs
vgmerge: support option --poolmetadataspare
tests: extend vgmerge testing
cov: pvck fix memleak
pvck: ensure buffer is 0 terminated
cov: memleak dir descriptor
cov: remove unneeded includes
cov: add internal error for missing arg
cov: ensure bufffe size is at least 5
cov: guard index
cov: dev-mpath: check config_wwids_file
cov: raid: no more checks with missing areas
cov: add explicit check for vg existence
cov: add initilizer
debug: stack tracing on error path
root (1):
make: generate
2 years, 8 months
main - post-release
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=59209ef04944e8f8fac...
Commit: 59209ef04944e8f8fac2836be1d875a080c58a9e
Parent: 67a853f3376059dc7022b544b7b6dae6a5e262d3
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed Aug 11 17:15:51 2021 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Aug 11 17:15:51 2021 +0200
post-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 3 +++
WHATS_NEW_DM | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index 56a6ec205..b421d79ee 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.03.13(2) (2021-08-11)
+2.03.14(2)-git (2021-08-11)
diff --git a/VERSION_DM b/VERSION_DM
index 41ddd0a09..b8c51d0b6 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.179 (2021-08-11)
+1.02.181-git (2021-08-11)
diff --git a/WHATS_NEW b/WHATS_NEW
index d5c966919..09ee395b5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,6 @@
+Version 2.03.14 -
+==================================
+
Version 2.03.13 - 11th August 2021
==================================
Changes in udev support:
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 236a3b360..68920d888 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.181 -
+===================================
+
Version 1.02.179 - 11th August 2021
===================================
2 years, 8 months
main - pre-release
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=67a853f3376059dc702...
Commit: 67a853f3376059dc7022b544b7b6dae6a5e262d3
Parent: 7dfaf5dc1348e8c06cdc9b1ec23b70c6aad5f30f
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed Aug 11 17:14:26 2021 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Aug 11 17:14:26 2021 +0200
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 4 ++--
WHATS_NEW_DM | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/VERSION b/VERSION
index 6e36bd169..56a6ec205 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.03.13(2)-git (2021-05-07)
+2.03.13(2) (2021-08-11)
diff --git a/VERSION_DM b/VERSION_DM
index df334e09b..41ddd0a09 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.179-git (2021-05-07)
+1.02.179 (2021-08-11)
diff --git a/WHATS_NEW b/WHATS_NEW
index 72060b40a..d5c966919 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,5 @@
-Version 2.03.13 -
-===============================
+Version 2.03.13 - 11th August 2021
+==================================
Changes in udev support:
- obtain_device_list_from_udev defaults to 0.
- see devices/external_device_info_source,
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 9de74dfe2..236a3b360 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,5 @@
-Version 1.02.179 -
-================================
+Version 1.02.179 - 11th August 2021
+===================================
Version 1.02.177 - 07th May 2021
================================
2 years, 8 months
main - WHATS_NEW: update
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7dfaf5dc1348e8c06cd...
Commit: 7dfaf5dc1348e8c06cdc9b1ec23b70c6aad5f30f
Parent: b328cfee5288c14e771404821baa646b5f378a3c
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Tue Aug 10 14:19:24 2021 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Tue Aug 10 14:19:24 2021 +0200
WHATS_NEW: update
---
WHATS_NEW | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/WHATS_NEW b/WHATS_NEW
index 4fcd9f3c5..72060b40a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,11 +1,20 @@
Version 2.03.13 -
===============================
+ Changes in udev support:
+ - obtain_device_list_from_udev defaults to 0.
+ - see devices/external_device_info_source,
+ devices/obtain_device_list_from_udev, and devices/multipath_wwids_file help
+ in lvm.conf
+ Fix devices file handling of loop with deleted backing file.
+ Fix devices file handling of scsi_debug WWIDs.
+ Fix many static analysis issues.
Support --poolmetadataspare with vgsplit and vgmerge.
Fix detection of active components of external origin volume.
Add vdoimport tool to support conversion of VDO volumes.
Support configurable allocation/vdo_pool_header_size.
Fix handling of lvconvert --type vdo-pool --virtualsize.
Simplified handling of archive() and backup() internal calls.
+ Add 'idm' locking type for IDM lock manager.
Fix load of kvdo target when it is not present in memory (2.03.12).
Version 2.03.12 - 07th May 2021
2 years, 8 months
main - make: generate
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b328cfee5288c14e771...
Commit: b328cfee5288c14e771404821baa646b5f378a3c
Parent: d0ab5bf7f98da83cd5d7ec393554dff309482cf4
Author: root <root(a)bot-frawhide-x86-64.lab.eng.brq.redhat.com>
AuthorDate: Thu Aug 5 21:38:43 2021 +0200
Committer: root <root(a)bot-frawhide-x86-64.lab.eng.brq.redhat.com>
CommitterDate: Thu Aug 5 21:38:43 2021 +0200
make: generate
---
conf/example.conf.in | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 50cf6f42b..2dc6dd9e6 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -67,25 +67,13 @@ devices {
# setting applies only to the udev-managed device directory; other
# directories will be scanned fully. LVM needs to be compiled with
# udev support for this setting to apply.
- obtain_device_list_from_udev = 1
+ obtain_device_list_from_udev = 0
# Configuration option devices/external_device_info_source.
- # Select an external device information source.
- # Some information may already be available in the system and LVM can
- # use this information to determine the exact type or use of devices it
- # processes. Using an existing external device information source can
- # speed up device processing as LVM does not need to run its own native
- # routines to acquire this information. For example, this information
- # is used to drive LVM filtering like MD component detection, multipath
- # component detection, partition detection and others.
- #
- # Accepted values:
- # none
- # No external device information source is used.
- # udev
- # Reuse existing udev database records. Applicable only if LVM is
- # compiled with udev support.
- #
+ # Enable device information from udev.
+ # If set to "udev", lvm will supplement its own native device information
+ # with information from libudev. This can potentially improve the detection
+ # of MD component devices and multipath component devices.
external_device_info_source = "none"
# Configuration option devices/hints.
@@ -232,6 +220,12 @@ devices {
# Ignore devices that are components of DM multipath devices.
multipath_component_detection = 1
+ # Configuration option devices/multipath_wwids_file.
+ # The path to the multipath wwids file used for multipath component detection.
+ # Set this to an empty string to disable the use of the multipath wwids file.
+ # This configuration option has an automatic default value.
+ # multipath_wwids_file = "/etc/multipath/wwids"
+
# Configuration option devices/md_component_detection.
# Enable detection and exclusion of MD component devices.
# An MD component device is a block device that MD uses as part
2 years, 8 months
main - pvscan: only match devices file for command args
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d0ab5bf7f98da83cd5d...
Commit: d0ab5bf7f98da83cd5d7ec393554dff309482cf4
Parent: 87714a1384def2ea107d7dbc264eff44c2025865
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Aug 4 12:04:03 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 5 13:20:26 2021 -0500
pvscan: only match devices file for command args
Avoid matching all devices with the devices file to
avoid delays during startup.
---
lib/device/dev-cache.c | 19 ++++++++++++++++++-
lib/device/dev-cache.h | 1 +
lib/device/device_id.c | 4 ++--
tools/pvscan.c | 46 ++++++++++++++++++++++++++++++++++++++++++++--
4 files changed, 65 insertions(+), 5 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index b1d477ebb..4727ea652 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1829,7 +1829,7 @@ int setup_devices_file(struct cmd_context *cmd)
* Add all system devices to dev-cache, and attempt to
* match all devices_file entries to dev-cache entries.
*/
-int setup_devices(struct cmd_context *cmd)
+static int _setup_devices(struct cmd_context *cmd, int no_file_match)
{
int file_exists;
int lock_mode = 0;
@@ -1956,6 +1956,13 @@ int setup_devices(struct cmd_context *cmd)
*/
dev_cache_scan(cmd);
+ /*
+ * The caller uses "no_file_match" if it wants to match specific devs
+ * itself, instead of matching everything in device_ids_match.
+ */
+ if (no_file_match && cmd->enable_devices_file)
+ return 1;
+
/*
* Match entries from cmd->use_devices with device structs in dev-cache.
*/
@@ -1964,6 +1971,16 @@ int setup_devices(struct cmd_context *cmd)
return 1;
}
+int setup_devices(struct cmd_context *cmd)
+{
+ return _setup_devices(cmd, 0);
+}
+
+int setup_devices_no_file_match(struct cmd_context *cmd)
+{
+ return _setup_devices(cmd, 1);
+}
+
/*
* The alternative to setup_devices() when the command is interested
* in using only one PV.
diff --git a/lib/device/dev-cache.h b/lib/device/dev-cache.h
index 30ef1cdbe..635dc4fc9 100644
--- a/lib/device/dev-cache.h
+++ b/lib/device/dev-cache.h
@@ -77,6 +77,7 @@ int get_dm_uuid_from_sysfs(char *buf, size_t buf_size, int major, int minor);
int setup_devices_file(struct cmd_context *cmd);
int setup_devices(struct cmd_context *cmd);
+int setup_devices_no_file_match(struct cmd_context *cmd);
int setup_device(struct cmd_context *cmd, const char *devname);
#endif
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 6f61cf3f1..429164062 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -1324,7 +1324,7 @@ static int _match_du_to_dev(struct cmd_context *cmd, struct dev_use *du, struct
du->dev = dev;
dev->id = id;
dev->flags |= DEV_MATCHED_USE_ID;
- log_debug("compare match %s %s to %s",
+ log_debug("Match device_id %s %s to %s",
idtype_to_str(du->idtype), du->idname, dev_name(dev));
return 1;
} else {
@@ -1370,7 +1370,7 @@ static int _match_du_to_dev(struct cmd_context *cmd, struct dev_use *du, struct
du->dev = dev;
dev->id = id;
dev->flags |= DEV_MATCHED_USE_ID;
- log_debug("compare match %s %s to %s",
+ log_debug("Match device_id %s %s to %s",
idtype_to_str(du->idtype), du->idname, dev_name(dev));
return 1;
}
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 1c84b8407..229989051 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -926,6 +926,14 @@ static int _pvscan_aa_quick(struct cmd_context *cmd, struct pvscan_aa_params *pp
return ECMD_FAILED;
}
+ /*
+ * The list of devs do not need to be filtered or checked
+ * against the devices file because a dev is only returned
+ * that has a pv online file, and a dev will only have a
+ * pv online file if it's been processed by a previous
+ * pvscan, which did the filtering and devices file check.
+ */
+
/*
* Lock the VG before scanning so we don't need to
* rescan in _vg_read. (The lock_vol and the
@@ -1060,9 +1068,25 @@ static int _pvscan_aa(struct cmd_context *cmd, struct pvscan_aa_params *pp,
*/
if (!saved_vg || (dm_list_size(vgnames) > 1) || no_quick) {
uint32_t read_flags = READ_FOR_ACTIVATE;
+
+ log_debug("autoactivate slow");
+
+ /*
+ * PROCESS_SKIP_SCAN: we have already done lvmcache_label_scan
+ * so tell process_each to skip it.
+ */
if (do_all)
read_flags |= PROCESS_SKIP_SCAN;
- log_debug("autoactivate slow");
+
+ /*
+ * When the command is processing specific devs (not all), it
+ * has done setup_devices_no_file_match() to avoid matching ids
+ * fo all devs unnecessarily, but now that we're falling back
+ * to process_each_vg() we need to complete the id matching.
+ */
+ if (!do_all)
+ device_ids_match(cmd);
+
ret = process_each_vg(cmd, 0, NULL, NULL, vgnames, read_flags, 0, handle, _pvscan_aa_single);
}
@@ -1442,7 +1466,12 @@ static int _pvscan_cache_args(struct cmd_context *cmd, int argc, char **argv,
cmd->pvscan_cache_single = 1;
- if (!setup_devices(cmd)) {
+ /*
+ * "no_file_match" means that when the devices file is used,
+ * setup_devices will skip matching devs to devices file entries.
+ * Specific devs must be matched later with device_ids_match_dev().
+ */
+ if (!setup_devices_no_file_match(cmd)) {
log_error("Failed to set up devices.");
return 0;
}
@@ -1500,6 +1529,19 @@ static int _pvscan_cache_args(struct cmd_context *cmd, int argc, char **argv,
log_debug("pvscan_cache_args: filter devs nodata");
+ /*
+ * Match dev args with the devices file because
+ * setup_devices_no_file_match() was used above which skipped checking
+ * the devices file. If a match fails here do not exclude it, that
+ * will be done below by passes_filter() which runs filter-deviceid.
+ * The relax_deviceid_filter case needs to be able to work around
+ * unmatching devs.
+ */
+ if (cmd->enable_devices_file) {
+ dm_list_iterate_items_safe(devl, devl2, &pvscan_devs)
+ device_ids_match_dev(cmd, devl->dev);
+ }
+
if (cmd->enable_devices_file && device_ids_use_devname(cmd)) {
relax_deviceid_filter = 1;
cmd->filter_deviceid_skip = 1;
2 years, 8 months
main - devices file: avoid updating entry dev names in some cases
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=87714a1384def2ea107...
Commit: 87714a1384def2ea107d7dbc264eff44c2025865
Parent: d3d6a0e820ff930a5a7c137e7bbeb0225e251df7
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jul 27 16:56:20 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 5 13:20:26 2021 -0500
devices file: avoid updating entry dev names in some cases
Avoid thrashing changes to devices file device names by
some commands that are run during startup when devnames
are still being set up.
---
lib/commands/toolcontext.h | 1 +
lib/device/device_id.c | 9 +++++++++
tools/lvchange.c | 3 +++
tools/pvscan.c | 2 ++
tools/vgchange.c | 3 +++
5 files changed, 18 insertions(+)
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 4dbc75cfc..0911b05f1 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -194,6 +194,7 @@ struct cmd_context {
unsigned sysinit:1; /* --sysinit is used */
unsigned check_devs_used:1; /* check devs used by LVs */
unsigned print_device_id_not_found; /* print devices file entries not found */
+ unsigned ignore_device_name_mismatch; /* skip updating devices file names */
/*
* Devices and filtering.
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 6ac646a16..6f61cf3f1 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -1639,6 +1639,15 @@ void device_ids_validate(struct cmd_context *cmd, struct dm_list *scanned_devs,
}
}
+ /*
+ * Avoid thrashing changes to the devices file during
+ * startup due to device names that are still being
+ * established. Commands that may run during startup
+ * should set this flag.
+ */
+ if (cmd->ignore_device_name_mismatch)
+ continue;
+
if (!du->devname || strcmp(dev_name(du->dev), du->devname)) {
log_warn("Device %s has updated name (devices file %s)",
dev_name(du->dev), du->devname ?: "none");
diff --git a/tools/lvchange.c b/tools/lvchange.c
index bfd464d5c..d4c40df47 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -1535,6 +1535,7 @@ int lvchange_activate_cmd(struct cmd_context *cmd, int argc, char **argv)
init_background_polling(arg_is_set(cmd, sysinit_ARG) ? 0 : arg_int_value(cmd, poll_ARG, DEFAULT_BACKGROUND_POLLING));
cmd->handles_missing_pvs = 1;
cmd->lockd_vg_default_sh = 1;
+ cmd->ignore_device_name_mismatch = 1;
/*
* Include foreign VGs that contain active LVs.
@@ -1619,6 +1620,7 @@ int lvchange_refresh_cmd(struct cmd_context *cmd, int argc, char **argv)
init_background_polling(arg_is_set(cmd, sysinit_ARG) ? 0 : arg_int_value(cmd, poll_ARG, DEFAULT_BACKGROUND_POLLING));
cmd->handles_missing_pvs = 1;
cmd->lockd_vg_default_sh = 1;
+ cmd->ignore_device_name_mismatch = 1;
return process_each_lv(cmd, argc, argv, NULL, NULL, 0,
NULL, &_lvchange_refresh_check, &_lvchange_refresh_single);
@@ -1792,6 +1794,7 @@ int lvchange_monitor_poll_cmd(struct cmd_context *cmd, int argc, char **argv)
{
init_background_polling(arg_is_set(cmd, sysinit_ARG) ? 0 : arg_int_value(cmd, poll_ARG, DEFAULT_BACKGROUND_POLLING));
cmd->handles_missing_pvs = 1;
+ cmd->ignore_device_name_mismatch = 1;
return process_each_lv(cmd, argc, argv, NULL, NULL, 0,
NULL, &_lvchange_monitor_poll_check, &_lvchange_monitor_poll_single);
}
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 46d0786bc..1c84b8407 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -1622,6 +1622,8 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
cmd->print_device_id_not_found = 0;
+ cmd->ignore_device_name_mismatch = 1;
+
event_activation = find_config_tree_bool(cmd, global_event_activation_CFG, NULL);
if (do_activate && !event_activation) {
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 22038ba9b..d2d5f9dd2 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -799,6 +799,9 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
if (!update || !update_partial_unsafe)
cmd->handles_missing_pvs = 1;
+ if (noupdate)
+ cmd->ignore_device_name_mismatch = 1;
+
/*
* Include foreign VGs that contain active LVs.
* That shouldn't happen in general, but if it does by some
2 years, 8 months
main - devices file: limit warnings about devices file entries not found
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d3d6a0e820ff930a5a7...
Commit: d3d6a0e820ff930a5a7c137e7bbeb0225e251df7
Parent: bf6dfc248a1de0250eebe8229cae40d55c247ddd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jul 27 15:28:34 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 5 13:20:26 2021 -0500
devices file: limit warnings about devices file entries not found
All commands were printing a warning if a devices file
entry was not found. Limit this to commands that report/display
lvm state.
---
lib/commands/toolcontext.h | 1 +
lib/device/device_id.c | 3 +++
tools/command.c | 1 +
tools/commands.h | 24 ++++++++++++------------
tools/lvmcmdline.c | 2 ++
tools/pvscan.c | 2 ++
tools/tools.h | 2 ++
7 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 34808ce46..4dbc75cfc 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -193,6 +193,7 @@ struct cmd_context {
unsigned run_by_dmeventd:1; /* command is being run by dmeventd */
unsigned sysinit:1; /* --sysinit is used */
unsigned check_devs_used:1; /* check devs used by LVs */
+ unsigned print_device_id_not_found; /* print devices file entries not found */
/*
* Devices and filtering.
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index baba48c05..6ac646a16 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -1511,6 +1511,9 @@ void device_ids_match(struct cmd_context *cmd)
dev_iter_destroy(iter);
}
+ if (!cmd->print_device_id_not_found)
+ return;
+
/*
* Look for entries in devices file for which we found no device.
*/
diff --git a/tools/command.c b/tools/command.c
index b987e49b0..0d37de7f6 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -142,6 +142,7 @@ static inline int dumptype_arg(struct cmd_context *cmd __attribute__((unused)),
#define ALLOW_HINTS 0x00004000
#define ALLOW_EXPORTED 0x00008000
#define CHECK_DEVS_USED 0x00010000
+#define DEVICE_ID_NOT_FOUND 0x00020000
/* create foo_CMD enums for command def ID's in command-lines.in */
diff --git a/tools/commands.h b/tools/commands.h
index a38d2b4f5..4de335a95 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -31,7 +31,7 @@ xx(formats,
xx(fullreport,
"Display full report",
- PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | ALLOW_HINTS | ALLOW_EXPORTED | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | ALLOW_HINTS | ALLOW_EXPORTED | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
xx(help,
"Display help for commands",
@@ -55,7 +55,7 @@ xx(lvcreate,
xx(lvdisplay,
"Display information about a logical volume",
- PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
xx(lvextend,
"Add space to a logical volume",
@@ -71,11 +71,11 @@ xx(lvmconfig,
xx(lvmdevices,
"Manage the devices file",
- 0)
+ DEVICE_ID_NOT_FOUND)
xx(lvmdiskscan,
"List devices that may be used as physical volumes",
- PERMITTED_READ_ONLY | ENABLE_ALL_DEVS | ALLOW_EXPORTED | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | ENABLE_ALL_DEVS | ALLOW_EXPORTED | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
xx(lvmsadc,
"Collect activity data",
@@ -107,11 +107,11 @@ xx(lvresize,
xx(lvs,
"Display information about logical volumes",
- PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
xx(lvscan,
"List all logical volumes in all volume groups",
- PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
xx(pvchange,
"Change attributes of physical volume(s)",
@@ -131,7 +131,7 @@ xx(pvdata,
xx(pvdisplay,
"Display various attributes of physical volume(s)",
- PERMITTED_READ_ONLY | ENABLE_ALL_DEVS | ENABLE_DUPLICATE_DEVS | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | ALLOW_EXPORTED | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | ENABLE_ALL_DEVS | ENABLE_DUPLICATE_DEVS | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | ALLOW_EXPORTED | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
/* ALL_VGS_IS_DEFAULT is for polldaemon to find pvmoves in-progress using process_each_vg. */
@@ -149,11 +149,11 @@ xx(pvresize,
xx(pvs,
"Display information about physical volumes",
- PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | ENABLE_ALL_DEVS | ENABLE_DUPLICATE_DEVS | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | ALLOW_EXPORTED | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | ENABLE_ALL_DEVS | ENABLE_DUPLICATE_DEVS | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | ALLOW_EXPORTED | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
xx(pvscan,
"List all physical volumes",
- PERMITTED_READ_ONLY | LOCKD_VG_SH | ALLOW_EXPORTED | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | LOCKD_VG_SH | ALLOW_EXPORTED | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
xx(segtypes,
"List available segment types",
@@ -197,7 +197,7 @@ xx(vgcreate,
xx(vgdisplay,
"Display volume group information",
- PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | ALLOW_EXPORTED | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | ALLOW_EXPORTED | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
xx(vgexport,
"Unregister volume group(s) from the system",
@@ -241,11 +241,11 @@ xx(vgrename,
xx(vgs,
"Display information about volume groups",
- PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | ALLOW_EXPORTED | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | CAN_USE_ONE_SCAN | ALLOW_HINTS | ALLOW_EXPORTED | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
xx(vgscan,
"Search for all volume groups",
- PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | ALLOW_EXPORTED | CHECK_DEVS_USED)
+ PERMITTED_READ_ONLY | ALL_VGS_IS_DEFAULT | LOCKD_VG_SH | ALLOW_EXPORTED | CHECK_DEVS_USED | DEVICE_ID_NOT_FOUND)
xx(vgsplit,
"Move physical volumes into a new or existing volume group",
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 134697aa3..4b63d48e3 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -2475,6 +2475,8 @@ static int _get_current_settings(struct cmd_context *cmd)
cmd->check_devs_used = (cmd->cname->flags & CHECK_DEVS_USED) ? 1 : 0;
+ cmd->print_device_id_not_found = (cmd->cname->flags & DEVICE_ID_NOT_FOUND) ? 1 : 0;
+
/*
* enable_hints is set to 1 if any commands are using hints.
* use_hints is set to 1 if this command should use the hints.
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 6787c4cfc..46d0786bc 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -1620,6 +1620,8 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
cmd->check_devs_used = 0;
+ cmd->print_device_id_not_found = 0;
+
event_activation = find_config_tree_bool(cmd, global_event_activation_CFG, NULL);
if (do_activate && !event_activation) {
diff --git a/tools/tools.h b/tools/tools.h
index d4d3b9866..708a78d1c 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -141,6 +141,8 @@ struct arg_value_group_list {
#define ALLOW_EXPORTED 0x00008000
/* Command checks and reports warning if devs used by LV are incorrect. */
#define CHECK_DEVS_USED 0x00010000
+/* Command prints devices file entries that were not found. */
+#define DEVICE_ID_NOT_FOUND 0x00020000
void usage(const char *name);
2 years, 8 months