Description of problem: When converting a mirrored LV to linear using "lvconvert -m0", if the PV to remove is specified on the command line and that PV is completely allocated, lvconvert fails with "No free extents on physical volume". Version-Release number of selected component (if applicable): lvm2-2.02.27-2.el4, upstream CVS How reproducible: 100% Steps to Reproduce: 1. lvcreate -l <PV SIZE> -n l0 -m1 mvg0 /dev/pv0 /dev/pv1 /dev/pv2:0 2. lvconvert -m0 mvg0/l0 /dev/pv0 Actual results: # lvconvert -m0 mvg0/m0 /dev/pv0 No free extents on physical volume "/dev/pv0" No specified PVs have space available Expected results: # lvconvert -m0 mvg0/m0 /dev/pv0 Logical volume m0 converted. Additional info: Looked into this with Marco and we found that this is happening here: The problem is caused by this check in _create_pv_entry() function ./tools/toollib.c:_create_pv_entry(): if (allocatable_only && (pvl->pv->pe_count == pvl->pv->pe_alloc_count)) { log_err("No free extents on physical volume "%s"", pvname); return 1; } Since converting to a linear volume does not require any new extent allocations this check is invalid. Forcing allocatable=0 in the debugger allows the command to complete without error and produces the expected result. Marco checked with Nick who couldn't see a problem with making this change - patch from Marco attached.
Created attachment 300237 [details] Don't pass allocatable=1 to create_pv_list in lvconvert
Fix verified in lvm2-2.02.37-3.el4. [root@taft-03 dev]# lvcreate -L 135.66G -n mirror -m 1 taft /dev/sdb1 /dev/sdc1 /dev/sdd1:0 Rounding up size to full physical extent 135.66 GB Logical volume "mirror" created [root@taft-03 dev]# lvconvert -m 0 taft/mirror /dev/sdb1 Logical volume mirror converted.
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-2008-0776.html