Bug 737125

Summary: unable to create mirror on 1K extent size VG due to dirty region log being too small
Product: Red Hat Enterprise Linux 6 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Jonathan Earl Brassow <jbrassow>
Status: CLOSED ERRATA QA Contact: Corey Marthaler <cmarthal>
Severity: high Docs Contact:
Priority: high    
Version: 6.2CC: agk, dwysocha, heinzm, jbrassow, mbroz, prajnoha, prockai, thornber, zkabelac
Target Milestone: rcKeywords: Regression, TestBlocker
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.87-3.el6 Doc Type: Bug Fix
Doc Text:
Do not document.
Story Points: ---
Clone Of:
: 750613 (view as bug list) Environment:
Last Closed: 2011-12-06 17:03:08 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, 750613    

Description Corey Marthaler 2011-09-09 16:53:26 UTC
Description of problem:
This is a regression of the following test case:

SCENARIO - [create_mirror_on_1Kextent_vg]
Create a mirror on a VG with an extent size of only 1K
Recreating PVs/VG with smaller (1K) extent size
grant-01: pvcreate --setphysicalvolumesize 1G /dev/sdb1 /dev/sdb2 /dev/sdb3 /dev/sdc1 /dev/sdc2 /dev/sdc3
  Writing physical volume data to disk "/dev/sdb1"
  Writing physical volume data to disk "/dev/sdb2"
  Writing physical volume data to disk "/dev/sdb3"
  Writing physical volume data to disk "/dev/sdc1"
  Writing physical volume data to disk "/dev/sdc2"
  Writing physical volume data to disk "/dev/sdc3"
grant-01: vgcreate -s 1K mirror_sanity /dev/sdb1 /dev/sdb2 /dev/sdb3 /dev/sdc1 /dev/sdc2 /dev/sdc3
grant-01: lvcreate -m 1 -n mirror_on_1Kextent_vg -L 20M mirror_sanity
  device-mapper: reload ioctl failed: Invalid argument
  Failed to activate new LV.
couldn't create mirror on 1K extent VG

device-mapper: dirty region log: log device 253:3 too small: need 1536 bytes
device-mapper: table: 253:6: mirror: Error creating mirror dirty log
device-mapper: ioctl: error adding target to table

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

lvm2-2.02.87-2.el6    BUILT: Fri Sep  9 09:35:36 CDT 2011
lvm2-libs-2.02.87-2.el6    BUILT: Fri Sep  9 09:35:36 CDT 2011
lvm2-cluster-2.02.87-2.el6    BUILT: Fri Sep  9 09:35:36 CDT 2011
udev-147-2.37.el6    BUILT: Wed Aug 10 07:48:15 CDT 2011
device-mapper-1.02.66-2.el6    BUILT: Fri Sep  9 09:35:36 CDT 2011
device-mapper-libs-1.02.66-2.el6    BUILT: Fri Sep  9 09:35:36 CDT 2011
device-mapper-event-1.02.66-2.el6    BUILT: Fri Sep  9 09:35:36 CDT 2011
device-mapper-event-libs-1.02.66-2.el6    BUILT: Fri Sep  9 09:35:36 CDT 2011
cmirror-2.02.87-2.el6    BUILT: Fri Sep  9 09:35:36 CDT 2011


How reproducible:
Everytime

Comment 1 Jonathan Earl Brassow 2011-09-12 22:10:27 UTC
_alloc_init calculates the number of necessary log extents via 'mirror_log_extents'.  'mirror_log_extents' takes 3 arguments: region_size, pe_size, and size of the mirror LV.  Unfortunately, _alloc_init is guessing at the mirror size by using 'ah->new_extents / ah->area_multiple' - the number of extents that the mirror images have.  However, this is /always/ wrong when allocating the log separately.  Further, the log is always allocated separately unless we are up-converting the mirror at the same time.  It was by luck alone that a default value of '1' reflects what we want in most cases.

In order to get a decent value computed, we need to pass in the 'lv' argument to allocate_extents.  This would normally imply a desire for cling/contiguous allocation to the given LV, but since we are not allocating any parallel extents and only log extents, it works fine.

Comment 2 Jonathan Earl Brassow 2011-09-13 14:38:55 UTC
BEFORE:
[root@bp-01 LVM2]# vgs -o name,vg_extent_size vg
  VG   Ext  
  vg   1.00k
[root@bp-01 LVM2]# lvcreate -m1 -L 20M -n lv vg
  device-mapper: reload ioctl failed: Invalid argument
  Failed to activate new LV.


AFTER:
[root@bp-01 LVM2]# vgs -o name,vg_extent_size vg
  VG   Ext  
  vg   1.00k
[root@bp-01 LVM2]# lvcreate -m1 -L 20M -n lv vg
  Logical volume "lv" created
[root@bp-01 LVM2]# lvs -a vg
  LV            VG   Attr     LSize  Poo Origin Snap%  Move Log     Copy%  Convert
  lv            vg   mwi-a-m- 20.00m                        lv_mlog 100.00        
  [lv_mimage_0] vg   iwi-aom- 20.00m                                              
  [lv_mimage_1] vg   iwi-aom- 20.00m                                              
  [lv_mlog]     vg   lwi-aom-  2.00k                                              

Fix checked in upstream in Version 2.02.89.

Comment 3 Jonathan Earl Brassow 2011-09-13 18:44:42 UTC
git commit IDs:
bfd774a20a22f8224a8bc3b507c4564fe6f54fc6 -- original
2d8a2f35c77fdeef1dbe0ef791db8530d07826eb -- follow-up correction

Comment 4 Corey Marthaler 2011-09-14 17:19:27 UTC
I was unable to reproduce this issue with the latest scratch built rpms.

2.6.32-195.el6.x86_64

lvm2-2.02.87-2.1.el6    BUILT: Wed Sep 14 09:44:16 CDT 2011
lvm2-libs-2.02.87-2.1.el6    BUILT: Wed Sep 14 09:44:16 CDT 2011
lvm2-cluster-2.02.87-2.1.el6    BUILT: Wed Sep 14 09:44:16 CDT 2011
udev-147-2.38.el6    BUILT: Fri Sep  9 16:25:50 CDT 2011
device-mapper-1.02.66-2.1.el6    BUILT: Wed Sep 14 09:44:16 CDT 2011
device-mapper-libs-1.02.66-2.1.el6    BUILT: Wed Sep 14 09:44:16 CDT 2011
device-mapper-event-1.02.66-2.1.el6    BUILT: Wed Sep 14 09:44:16 CDT 2011
device-mapper-event-libs-1.02.66-2.1.el6    BUILT: Wed Sep 14 09:44:16 CDT 2011
cmirror-2.02.87-2.1.el6    BUILT: Wed Sep 14 09:44:16 CDT 2011


[root@taft-01 ~]# pvcreate --setphysicalvolumesize 1G /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1
  Writing physical volume data to disk "/dev/sdb1"
  Physical volume "/dev/sdb1" successfully created
  Writing physical volume data to disk "/dev/sdc1"
  Physical volume "/dev/sdc1" successfully created
  Writing physical volume data to disk "/dev/sdd1"
  Physical volume "/dev/sdd1" successfully created
  Writing physical volume data to disk "/dev/sde1"
  Physical volume "/dev/sde1" successfully created
  Writing physical volume data to disk "/dev/sdf1"
  Physical volume "/dev/sdf1" successfully created
  Writing physical volume data to disk "/dev/sdg1"
  Physical volume "/dev/sdg1" successfully created
[root@taft-01 ~]# vgcreate -s 1K mirror_sanity  /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1 /dev/sdg1
  Volume group "mirror_sanity" successfully created
[root@taft-01 ~]# lvcreate -m 1 -n mirror_on_1Kextent_vg -L 20M mirror_sanity
  Logical volume "mirror_on_1Kextent_vg" created

Comment 6 Corey Marthaler 2011-09-26 22:06:01 UTC
Fix verified in the latest official 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


SCENARIO - [create_mirror_on_1Kextent_vg]
Create a mirror on a VG with an extent size of only 1K
Recreating PVs/VG with smaller (1K) extent size

taft-01: pvcreate --setphysicalvolumesize 1G /dev/sdd1 /dev/sdd2 /dev/sde1 /dev/sde2 /dev/sdf1 /dev/sdf2 /dev/sdg1 /dev/sdg2 /dev/sdh1 /dev/sdh2

taft-01: vgcreate -s 1K mirror_sanity /dev/sdd1 /dev/sdd2 /dev/sde1 /dev/sde2 /dev/sdf1 /dev/sdf2 /dev/sdg1 /dev/sdg2 /dev/sdh1 /dev/sdh2

taft-01: lvcreate -m 1 -n mirror_on_1Kextent_vg -L 20M mirror_sanity
Deactivating mirror mirror_on_1Kextent_vg... and removing
Restoring VG to default extent size

Comment 7 Peter Rajnoha 2011-10-26 12:59:11 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:
Do not document.

Comment 8 errata-xmlrpc 2011-12-06 17:03:08 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