diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c index 58c645660..0bc22448f 100644 --- a/lib/format_text/import_vsn1.c +++ b/lib/format_text/import_vsn1.c @@ -1318,6 +1318,12 @@ static struct volume_group *_read_vg(struct cmd_context *cmd, vg->pv_names = NULL; /* PV names are no longer valid outside of _read_vg() */ } + if (0 && vg->lv_names) { + /* TODO: update also rename function to keep lv_names always valid and usable */ + radix_tree_destroy(vg->lv_names); + vg->lv_names = NULL; + } + /* * Finished. */ diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index ab15fda44..608d1cc9b 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -1671,6 +1671,11 @@ struct logical_volume *find_lv_in_vg_by_lvid(const struct volume_group *vg, struct logical_volume *find_lv(const struct volume_group *vg, const char *lv_name) { + if (!vg->lv_names) { + struct lv_list *lvl = find_lv_in_vg(vg, lv_name); + return lvl ? lvl->lv : NULL; + } + return radix_tree_lookup_ptr(vg->lv_names, lv_name, strlen(lv_name)); }