1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-03 17:50:03 +03:00

devices: redo bcache invalidation of PVs on LV

This commit is contained in:
David Teigland 2024-07-01 11:30:51 -05:00
parent 5551e4a1e9
commit 8b4701d7c4
3 changed files with 22 additions and 2 deletions

View 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)

View 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 *

View 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);
}
}
/*