]> sourceware.org Git - lvm2.git/commitdiff
devices: redo bcache invalidation of PVs on LV
authorDavid Teigland <teigland@redhat.com>
Mon, 1 Jul 2024 16:30:51 +0000 (11:30 -0500)
committerDavid Teigland <teigland@redhat.com>
Mon, 1 Jul 2024 16:30:51 +0000 (11:30 -0500)
lib/device/dev-cache.c
lib/device/dev-cache.h
lib/label/label.c

index c89280e1f86277734781802688b86d7160f315cf..2ba3f1290d94f5e5a4a46d01d91fa114473417c8 100644 (file)
@@ -18,6 +18,7 @@
 #include "lib/misc/lib.h"
 #include "lib/device/dev-type.h"
 #include "lib/device/device_id.h"
+#include "lib/label/label.h"
 #include "lib/config/config.h"
 #include "lib/commands/toolcontext.h"
 #include "device_mapper/misc/dm-ioctl.h"
@@ -1395,6 +1396,20 @@ int dev_cache_update_dm_devs(void)
        return 1;
 }
 
+void dev_cache_dm_devs_label_invalidate(struct cmd_context *cmd)
+{
+       struct dm_active_device *dm_dev;
+       struct device *dev;
+
+       dm_list_iterate_items(dm_dev, _cache.dm_devs) {
+               if (dm_dev->uuid &&
+                  strncmp(dm_dev->uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1) == 0) {
+                       if ((dev = dev_cache_get_by_devt(cmd, dm_dev->devno)))
+                               label_scan_invalidate(dev);
+               }
+       }
+}
+
 /* Find active DM device in devs array for given major:minor */
 const struct dm_active_device *
 dev_cache_get_dm_dev_by_devno(struct cmd_context *cmd, dev_t devno)
index a68ba757ef4edacb0afc020af608731cb17fe0f5..5fba2c0da07d2fd0db351a470f6d3faa801fa2e4 100644 (file)
@@ -40,6 +40,7 @@ struct dm_list *dev_cache_get_dev_list_for_lvid(const char *lvid);
 int dev_cache_use_dm_devs_cache(void);
 int dev_cache_update_dm_devs(void);
 void dev_cache_destroy_dm_devs(void);
+void dev_cache_dm_devs_label_invalidate(struct cmd_context *cmd);
 const struct dm_active_device *
 dev_cache_get_dm_dev_by_devno(struct cmd_context *cmd, dev_t devno);
 const struct dm_active_device *
index 5e09eeff23cf84fb8b74ad5cf16de900435b0aec..66f809a960232515b2203b780cdc91e45f7b3558 100644 (file)
@@ -1670,8 +1670,12 @@ void label_scan_invalidate_lvs(struct cmd_context *cmd, struct dm_list *lvs)
 
        log_debug("Invalidating devs for any PVs on LVs.");
 
-       dm_list_iterate_items(lvl, lvs)
-               label_scan_invalidate_lv(cmd, lvl->lv);
+       if (dev_cache_use_dm_devs_cache())
+               dev_cache_dm_devs_label_invalidate(cmd);
+       else {
+               dm_list_iterate_items(lvl, lvs)
+                       label_scan_invalidate_lv(cmd, lvl->lv);
+       }
 }
 
 /*
This page took 0.040947 seconds and 5 git commands to generate.