Description of problem:
Some lvm2 commands tries to repair inconsistent metadata (vgchange, vgconvert, vgscan).
Current code incorectly releases old volume group metadata twice from memory, causeing commands segfault of glibc warnings:
# vgscan
Reading all physical volumes. This may take a while...
Volume group "vg_test" inconsistent
WARNING: Inconsistent metadata found for VG vg_test - updating to use version 3
Removing PV /dev/mapper/x (1nxHIW-2Thk-9mS4-2TzO-zHlB-Hsy2-CZsjE7) that no longer belongs to VG vg_test
Found volume group "vg_test" using metadata type lvm2
Segmentation fault
OR
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "vg_rhel4" using metadata type lvm2
Found volume group "myvg" using metadata type lvm2
Volume group "vg_test" inconsistent
WARNING: Inconsistent metadata found for VG vg_test - updating to use version 4
Removing PV /dev/mapper/x (T5Fj1R-fvs6-9UZG-oaix-Fmtz-WybW-bhyJ37) that no longer belongs to VG vg_test
Found volume group "vg_test" using metadata type lvm2
*** glibc detected *** vgscan: double free or corruption (out): 0x006d54c0 ***
======= Backtrace: =========
/lib/libc.so.6[0x5fd0f1]
/lib/libc.so.6(cfree+0x90)[0x600bc0]
/lib/libdevmapper.so.1.02(dm_pool_destroy+0x22)[0x4a6da2]
vgscan(vg_release+0x34)[0x80a1624]
vgscan[0x806bc1b]
vgscan(process_each_vg+0x12c)[0x806c83c]
vgscan(vgscan+0x12c)[0x807389c]
vgscan(lvm_run_command+0xf18)[0x805f3d8]
vgscan(lvm2_main+0x4ca)[0x805fa2a]
vgscan(main+0x32)[0x8075422]
/lib/libc.so.6(__libc_start_main+0xdc [0x5a9e8c]
vgscan[0x80528c1]
...
Version-Release number of selected component (if applicable):
# rpm -q lvm2
lvm2-2.02.46-3.el5
This is regression, patch (in review) is available.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
http://rhn.redhat.com/errata/RHBA-2009-1393.html