Bug 734193

Summary: divisibility issues when attempting to create striped mirrors
Product: Red Hat Enterprise Linux 6 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Petr Rockai <prockai>
Status: CLOSED ERRATA QA Contact: Corey Marthaler <cmarthal>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: agk, coughlan, dwysocha, heinzm, jbrassow, mbroz, prajnoha, prockai, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.87-3.el6 Doc Type: Bug Fix
Doc Text:
When using striped mirrors, an improper and too restrictive divisibility requirements for extent count took effect. This might have ended up with a failure to create a striped mirror despite it was correct and possible. The condition that was checked counted in mirror and stripe count though only stripe count alone was satisfactory.
Story Points: ---
Clone Of:
: 749650 (view as bug list) Environment:
Last Closed: 2011-12-06 17:02:50 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: 743047, 749650    

Description Corey Marthaler 2011-08-29 17:07:26 UTC
Description of problem:
It appears the issue here is either the create should be rounding up to create what's "close" to what's asked for, or the number given needs to actually be divisible by 8, not 4. 

### The following create attempts fail even though there are divisible by 4.
[root@taft-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_1 -L 100M helter_skelter /dev/sdg1:0-1000 /dev/sde1:0-1000 /dev/sdf1:0-1000 /dev/sdd1:0-1000 /dev/sdb1:0-150
  Using default stripesize 64.00 KiB
  Rounding size (25 extents) up to stripe boundary size (26 extents)
  Number of extents requested (26) needs to be divisible by 4.

[root@taft-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_1 -L 200M helter_skelter /dev/sdg1:0-1000 /dev/sde1:0-1000 /dev/sdf1:0-1000 /dev/sdd1:0-1000 /dev/sdb1:0-150
  Using default stripesize 64.00 KiB
  Number of extents requested (50) needs to be divisible by 4.

[root@taft-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_1 -L 500M helter_skelter /dev/sdg1:0-1000 /dev/sde1:0-1000 /dev/sdf1:0-1000 /dev/sdd1:0-1000 /dev/sdb1:0-150
  Using default stripesize 64.00 KiB
  Rounding size (125 extents) up to stripe boundary size (126 extents)
  Number of extents requested (126) needs to be divisible by 4.

[root@taft-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_1 -L 600M helter_skelter /dev/sdg1:0-1000 /dev/sde1:0-1000 /dev/sdf1:0-1000 /dev/sdd1:0-1000 /dev/sdb1:0-150
  Using default stripesize 64.00 KiB
  Number of extents requested (150) needs to be divisible by 4.

[root@taft-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_1 -L 1000M helter_skelter /dev/sdg1:0-1000 /dev/sde1:0-1000 /dev/sdf1:0-1000 /dev/sdd1:0-1000 /dev/sdb1:0-150
  Using default stripesize 64.00 KiB
  Number of extents requested (250) needs to be divisible by 4.



### The following create attempts pass because they are divisible by 8.
[root@taft-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_1 -L 300M helter_skelter /dev/sdg1:0-1000 /dev/sde1:0-1000 /dev/sdf1:0-1000 /dev/sdd1:0-1000 /dev/sdb1:0-150
  Using default stripesize 64.00 KiB
  Rounding size (75 extents) up to stripe boundary size (76 extents)
  Logical volume "striped_secondary_2legs_1" created

[root@taft-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_1 -L 400M helter_skelter /dev/sdg1:0-1000 /dev/sde1:0-1000 /dev/sdf1:0-1000 /dev/sdd1:0-1000 /dev/sdb1:0-150
  Using default stripesize 64.00 KiB
  Logical volume "striped_secondary_2legs_1" created

[root@taft-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_1 -L 800M helter_skelter /dev/sdg1:0-1000 /dev/sde1:0-1000 /dev/sdf1:0-1000 /dev/sdd1:0-1000 /dev/sdb1:0-150
  Using default stripesize 64.00 KiB
  Logical volume "striped_secondary_2legs_1" created

[root@taft-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_1 -L 1200M helter_skelter /dev/sdg1:0-1000 /dev/sde1:0-1000 /dev/sdf1:0-1000 /dev/sdd1:0-1000 /dev/sdb1:0-150
  Using default stripesize 64.00 KiB
  Logical volume "striped_secondary_2legs_1" created



Version-Release number of selected component (if applicable):
2.6.32-191.el6.x86_64

lvm2-2.02.87-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
lvm2-libs-2.02.87-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
lvm2-cluster-2.02.87-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
udev-147-2.37.el6    BUILT: Wed Aug 10 07:48:15 CDT 2011
device-mapper-1.02.66-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
device-mapper-libs-1.02.66-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
device-mapper-event-1.02.66-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
device-mapper-event-libs-1.02.66-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011
cmirror-2.02.87-1.el6    BUILT: Fri Aug 12 06:11:57 CDT 2011


How reproducible:
Every time when not divisible by 8.

Comment 1 Petr Rockai 2011-09-13 14:17:23 UTC
In all the cases where the command fails (26, 50, 126, 150, 250) the number of extents is *not* divisible by 4, i.e. the request is rejected correctly. You apparently have 4M extents, i.e. a 100M volume would be 25 extents, which LVM tries to round to 26, which is however still not divisible by 4 (26/4 = 6.5) and fails. The nearest 4-divisible number is 28, resulting in a 112M volume (if I am reading your case correctly). As far as I can tell, it is sufficient to require 2-divisible number, i.e. 26 should pass, but the allocation code incorrectly accounts for the mirrors in addition to stripes.

Comment 4 Corey Marthaler 2011-09-28 20:22:52 UTC
All the divisibility cases failing in the original report no longer fail in the latest rpms.

2.6.32-198.el6.x86_64

lvm2-2.02.87-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
lvm2-libs-2.02.87-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
lvm2-cluster-2.02.87-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
udev-147-2.38.el6    BUILT: Fri Sep  9 16:25:50 CDT 2011
device-mapper-1.02.66-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
device-mapper-libs-1.02.66-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
device-mapper-event-1.02.66-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
device-mapper-event-libs-1.02.66-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011
cmirror-2.02.87-3.el6    BUILT: Wed Sep 21 09:54:55 CDT 2011


 [root@grant-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_1 -L 100M helter_skelter /dev/sdb1:0-1000 /dev/sdb2:0-1000 /dev/sdb3:0-1000 /dev/sdb5:0-1000 /dev/sdb6:0-150
  Using default stripesize 64.00 KiB
  Rounding size (25 extents) up to stripe boundary size (26 extents)
  Logical volume "striped_secondary_2legs_1" created

[root@grant-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_2 -L 200M helter_skelter /dev/sdb1:0-1000 /dev/sdb2:0-1000 /dev/sdb3:0-1000 /dev/sdb5:0-1000 /dev/sdb6:0-150
  Using default stripesize 64.00 KiB
  Logical volume "striped_secondary_2legs_2" created

[root@grant-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_3 -L 500M helter_skelter /dev/sdb1:0-1000 /dev/sdb2:0-1000 /dev/sdb3:0-1000 /dev/sdb5:0-1000 /dev/sdb6:0-150
  Using default stripesize 64.00 KiB
  Rounding size (125 extents) up to stripe boundary size (126 extents)
  Logical volume "striped_secondary_2legs_3" created

[root@grant-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_4 -L 600M helter_skelter /dev/sdb1:0-1000 /dev/sdb2:0-1000 /dev/sdb3:0-1000 /dev/sdb5:0-1000 /dev/sdb6:0-150
  Using default stripesize 64.00 KiB
  Logical volume "striped_secondary_2legs_4" created

[root@grant-01 ~]# lvcreate -m 1 -i 2 -n striped_secondary_2legs_5 -L 1000M helter_skelter /dev/sdb1:0-1000 /dev/sdb2:0-1000 /dev/sdb3:0-1000 /dev/sdb5:0-1000 /dev/sdb6:0-150
  Using default stripesize 64.00 KiB
  Logical volume "striped_secondary_2legs_5" created

Comment 5 Petr Rockai 2011-10-02 14:24:06 UTC
Two things here: The divisibility error was correct in that the divisibility that was requested was not met. It was not correct in that it was needlessly strict: it is sufficient to demand 2-divisibility (instead of 4-divisibility) in these cases. I have fixed the latter issue, meaning that the errors are gone because we no longer demand (superfluous) 4-divisibility.

Comment 6 Corey Marthaler 2011-10-04 20:34:07 UTC
Marking verified based on comment #4 and comment #5.

Comment 7 Peter Rajnoha 2011-10-27 08:58:25 UTC
    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.
    
    New Contents:
When using striped mirrors, an improper and too restrictive divisibility requirements for extent count took effect. This might have ended up with a failure to create a striped mirror despite it was correct and possible. The condition that was checked counted in mirror and stripe count though only stripe count alone was satisfactory.

Comment 8 errata-xmlrpc 2011-12-06 17:02:50 UTC
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.

http://rhn.redhat.com/errata/RHBA-2011-1522.html