61 lines
2.1 KiB
Diff
61 lines
2.1 KiB
Diff
From d1a433e2168f433f53058e5665c31ece061009af Mon Sep 17 00:00:00 2001
|
|
From: Zdenek Kabelac <zkabelac@redhat.com>
|
|
Date: Tue, 28 Jan 2025 12:45:39 +0100
|
|
Subject: [PATCH 22/24] vg_read: rescanning DM cache after taking lock
|
|
|
|
Since we started to use DM cache now also for basic checks
|
|
whether the DM devices is present in DM table, this cache
|
|
now needs to be actually refreshed when the LOCK is taken.
|
|
This hiddenly happend if there was enabled 'scan_lvs' however
|
|
still not at the right place.
|
|
|
|
Move this explicit cache update call right after the moment
|
|
vg_read grabs the lock.
|
|
|
|
TODO: in the optimal case, we should mark the 'cache invalid'
|
|
and later refresh this cache, when the first reader appears,
|
|
but since this would be large patch, do this little fix step patch
|
|
first and improve performance later.
|
|
|
|
(cherry picked from commit dd09127608be1b390cf028508d448442b6347551)
|
|
---
|
|
lib/device/dev-cache.c | 2 --
|
|
lib/metadata/metadata.c | 8 ++++++++
|
|
2 files changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
|
|
index 97d86a142..947995fb1 100644
|
|
--- a/lib/device/dev-cache.c
|
|
+++ b/lib/device/dev-cache.c
|
|
@@ -1394,8 +1394,6 @@ void dm_devs_cache_label_invalidate(struct cmd_context *cmd)
|
|
struct dm_active_device *dm_dev;
|
|
struct device *dev;
|
|
|
|
- dm_devs_cache_update();
|
|
-
|
|
dm_list_iterate_items(dm_dev, _cache.dm_devs) {
|
|
if (dm_dev->uuid &&
|
|
strncmp(dm_dev->uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1) == 0) {
|
|
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
|
|
index 511ebd8ae..14f54db23 100644
|
|
--- a/lib/metadata/metadata.c
|
|
+++ b/lib/metadata/metadata.c
|
|
@@ -5031,6 +5031,14 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
|
|
goto_bad;
|
|
}
|
|
|
|
+ /* Update DM cache after grabbing lock
|
|
+ * TODO: do a lazy-update of this cache, only when it's really used */
|
|
+ if (dm_devs_cache_use()) {
|
|
+ log_debug_cache("Rescanning DM cache.");
|
|
+ if (!dm_devs_cache_update())
|
|
+ return_0;
|
|
+ }
|
|
+
|
|
/*
|
|
* vgchange -ay (no vgname arg) will activate multiple local VGs with the same
|
|
* name, but if the vgs have the same lv name, activating those lvs will fail.
|
|
--
|
|
2.48.1
|
|
|