diff --git a/WHATS_NEW b/WHATS_NEW index 4310dd1d4..b77d4043c 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.107 - ================================== + Fix crash when reporting of empty labels on pvs. Use retry_deactivation also when cleaning orphan devices. Prompt when setting the VG cluster attr if the cluster is not setup. Allow --yes to skip prompt in vgextend (worked only with -f). diff --git a/lib/report/report.c b/lib/report/report.c index 681e80c9a..6b32beea6 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -1274,19 +1274,35 @@ int report_object(void *handle, struct volume_group *vg, struct lv_segment *seg, struct pv_segment *pvseg, struct label *label) { - struct lvm_report_object obj; + struct device dummy_device = { .dev = 0 }; + struct label dummy_label = { .dev = &dummy_device }; + struct lvm_report_object obj = { + .vg = vg, + .lv = lv, + .pv = pv, + .seg = seg, + .pvseg = pvseg, + .label = label ? : (pv ? pv_label(pv) : NULL) + }; + + /* FIXME workaround for pv_label going through cache; remove once struct + * physical_volume gains a proper "label" pointer */ + if (!obj.label) { + if (pv) { + if (pv->fmt) + dummy_label.labeller = pv->fmt->labeller; + if (pv->dev) + dummy_label.dev = pv->dev; + else + memcpy(dummy_device.pvid, &pv->id, ID_LEN); + } + obj.label = &dummy_label; + } /* The two format fields might as well match. */ if (!vg && pv) _dummy_fid.fmt = pv->fmt; - obj.vg = vg; - obj.lv = lv; - obj.pv = pv; - obj.seg = seg; - obj.pvseg = pvseg; - obj.label = label ? label : (pv ? pv_label(pv) : NULL); - return dm_report_object(handle, &obj); } diff --git a/tools/reporter.c b/tools/reporter.c index b4a0c0b1d..b20b8ed9c 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -140,9 +140,6 @@ static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg, const char *vg_name = NULL; struct volume_group *old_vg = vg; char uuid[64] __attribute__((aligned(8))); - struct label *label; - struct label dummy_label = { .dev = 0 }; - struct device dummy_device = { .dev = 0 }; if (is_pv(pv) && !is_orphan(pv) && !vg) { vg_name = pv_vg_name(pv); @@ -180,22 +177,7 @@ static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg, pv = pvl->pv; } - /* FIXME workaround for pv_label going through cache; remove once struct - * physical_volume gains a proper "label" pointer */ - if (!(label = pv_label(pv))) { - if (pv->fmt) - dummy_label.labeller = pv->fmt->labeller; - - if (pv->dev) - dummy_label.dev = pv->dev; - else { - dummy_label.dev = &dummy_device; - memcpy(dummy_device.pvid, &pv->id, ID_LEN); - } - label = &dummy_label; - } - - if (!report_object(handle, vg, NULL, pv, NULL, NULL, label)) { + if (!report_object(handle, vg, NULL, pv, NULL, NULL, NULL)) { stack; ret = ECMD_FAILED; }