Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 4 product line. The current stable release is 4.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 440405

Summary: lvconvert -m0 fails when a PV is specified and all extents on the PV are allocated
Product: Red Hat Enterprise Linux 4 Reporter: Bryn M. Reeves <bmr>
Component: lvm2Assignee: Bryn M. Reeves <bmr>
Status: CLOSED ERRATA QA Contact: Corey Marthaler <cmarthal>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.6CC: agk, dwysocha, edamato, heinzm, jbrassow, mbroz, prockai
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0776 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-07-24 20:08:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 443060    
Attachments:
Description Flags
Don't pass allocatable=1 to create_pv_list in lvconvert none

Description Bryn M. Reeves 2008-04-03 12:34:30 UTC
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.

Comment 1 Bryn M. Reeves 2008-04-03 12:36:14 UTC
Created attachment 300237 [details]
Don't pass allocatable=1 to create_pv_list in lvconvert

Comment 8 Corey Marthaler 2008-06-30 15:51:17 UTC
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.

Comment 10 errata-xmlrpc 2008-07-24 20:08:00 UTC
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