diff --git a/WHATS_NEW b/WHATS_NEW index 6f43437ba..1870801c4 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.119 - ================================== + Set correct vgid when updating cache when writing PV metadata. More efficient clvmd singlenode locking emulation. Don't skip invalidation of cached orphans if vg write lck is held (2.02.118). Log relevant PV tags when using cling allocation. diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index 27b429265..6f8c95085 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -1544,6 +1544,7 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid, .vgstatus = vgstatus, }; + /* N.B. vgid is not NUL-terminated when called from _text_pv_write */ if (vgid) strncpy((char *)&vgsummary.vgid, vgid, sizeof(vgsummary.vgid)); diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index bdac7f9ca..8e5578cc5 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -1318,7 +1318,7 @@ static int _write_single_mda(struct metadata_area *mda, void *baton) return 1; } -/* Only for orphans */ +/* Only for orphans - FIXME That's not true any more */ static int _text_pv_write(const struct format_type *fmt, struct physical_volume *pv) { struct format_instance *fid = pv->fid; @@ -1332,7 +1332,8 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume /* Add a new cache entry with PV info or update existing one. */ if (!(info = lvmcache_add(fmt->labeller, (const char *) &pv->id, - pv->dev, pv->vg_name, NULL, 0))) + pv->dev, pv->vg_name, + is_orphan_vg(pv->vg_name) ? pv->vg_name : pv->vg ? &pv->vg->id : NULL, 0))) return_0; label = lvmcache_get_label(info);