Bug 440405 - lvconvert -m0 fails when a PV is specified and all extents on the PV are allocated
lvconvert -m0 fails when a PV is specified and all extents on the PV are allo...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: lvm2 (Show other bugs)
4.6
All Linux
medium Severity medium
: rc
: ---
Assigned To: Bryn M. Reeves
Corey Marthaler
:
Depends On:
Blocks: 443060
  Show dependency treegraph
 
Reported: 2008-04-03 08:34 EDT by Bryn M. Reeves
Modified: 2010-10-22 19:43 EDT (History)
7 users (show)

See Also:
Fixed In Version: RHBA-2008-0776
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-07-24 16:08:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Don't pass allocatable=1 to create_pv_list in lvconvert (456 bytes, patch)
2008-04-03 08:36 EDT, Bryn M. Reeves
no flags Details | Diff

  None (edit)
Description Bryn M. Reeves 2008-04-03 08:34:30 EDT
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 08:36:14 EDT
Created attachment 300237 [details]
Don't pass allocatable=1 to create_pv_list in lvconvert
Comment 8 Corey Marthaler 2008-06-30 11:51:17 EDT
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 16:08:00 EDT
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

Note You need to log in before you can comment on or make changes to this bug.