Description of problem:
When vgreduce is executed with 'vg' which could not be read,
tool takes a lock for such vg, but since it fails already internally
during vg_read, lock is unlocked inside error path already.
However vgreduce runs it's own unlock in error path as well,
giving out error message:
# vgreduce nvg /dev/loop1
Volume group "nvg" not found
Internal error: Attempt to unlock unlocked VG nvg.
Patch needs to test for success of vg_read and only in case
of success it may unlock vg later.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. vgreduce some-non-existant-vg /dev/loop0
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
Previously, the vgreduce command failed with an internal error "Attempt to unlock unlocked VG" when it was executed with a non-existent VG. This was caused by improperly trying to unlock the VG at command exit which was not locked at that time since locking resources were cleaned up before during handling the error scenario itself. The fix provides a proper check so only locked VGs are unlocked at vgreduce command exit.
[root@hayes-01 ~]# vgreduce fake /dev/etherd/e1.1p1
Volume group "fake" not found
lvm2-2.02.95-7.el6 BUILT: Wed May 2 05:14:03 CDT 2012
lvm2-libs-2.02.95-7.el6 BUILT: Wed May 2 05:14:03 CDT 2012
lvm2-cluster-2.02.95-7.el6 BUILT: Wed May 2 05:14:03 CDT 2012
udev-147-2.40.el6 BUILT: Fri Sep 23 07:51:13 CDT 2011
device-mapper-1.02.74-7.el6 BUILT: Wed May 2 05:14:03 CDT 2012
device-mapper-libs-1.02.74-7.el6 BUILT: Wed May 2 05:14:03 CDT 2012
device-mapper-event-1.02.74-7.el6 BUILT: Wed May 2 05:14:03 CDT 2012
device-mapper-event-libs-1.02.74-7.el6 BUILT: Wed May 2 05:14:03 CDT 2012
cmirror-2.02.95-7.el6 BUILT: Wed May 2 05:14:03 CDT 2012
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.