Bug 186304 - [RHEL4 U3] LVM2 mirror: lvextend spoils redundancy by allocating extents for mirror images from same PV.
[RHEL4 U3] LVM2 mirror: lvextend spoils redundancy by allocating extents for ...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: lvm2 (Show other bugs)
4.4
All Linux
low Severity low
: ---
: ---
Assigned To: Alasdair Kergon
:
Depends On:
Blocks: 186476
  Show dependency treegraph
 
Reported: 2006-03-22 14:42 EST by Kiyoshi Ueda
Modified: 2013-04-02 19:51 EDT (History)
7 users (show)

See Also:
Fixed In Version: RHBA-2007-0287
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-05-07 20:00:20 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)

  None (edit)
Description Kiyoshi Ueda 2006-03-22 14:42:22 EST
Description of problem:
lvextend allocates extents for mirror images from same PV.
It spoils disk redundancy.
Extents should be allocated from same PV with the extended mimage
as long as possible and the allocation should avoid different mimages
in same PV.


Version-Release number of selected component:
lvm2-2.02.02-1.0.RHEL4 (Technical Preview Version)


How reproducible:
Always


Steps to Reproduce:
 1. Prepare some PVs (more than 2) and create VG from them.
    Example)
      - /dev/sda, /dev/sdb, /dev/sdc as PVs
      - vg0 contains these 3 PVs
 2. Create a mirror LV from the VG and deactivate it.
      # lvcreate -L 12M -n lv0 -m 1 vg0
      # lvchange -an vg0/lv0
 3. Extend the size of the mirror LV.
      # lvextend -L 24M vg0/lv0
 4. Re-activate the mirror LV.
      # lvchange -ay vg0/lv0
 5. Check tables of mirror images.
      # dmsetup table


Actual results:
Extents for two mirror images are allocated from one PV.
So if the PV fails, all mirror images of the mirror PV fail
despite having other fine PVs.


Expected results:
Extents for one mirror image should not share PV with the extents
for the other mirror image.
Extents for extended mirror image should be allocated contiguously
with the original image as far as possible.


Additional info:
If "--alloc contiguous" is specified at Step 3, the following error
is displayed and the size isn't extended, though free extents in PVs
are enough.
----------------------------------------------------------------------
# lvextend --alloc contiguous -L 24M vg0/lv0
  Extending 2 mirror images.
  Extending logical volume lv0 to 24.00 MB
  Insufficient suitable contiguous allocatable extents for logical volume lv0: 6
more required
----------------------------------------------------------------------

Reproduction images are attached below.
-------------------------------------------------------------------
# lvcreate -L 12m -n lv0 -m 1 vg0
  Logical volume "lv0" created
#
# dmsetup table
vg0-lv0_mlog: 0 8192 linear 253:2 384
vg0-lv0_mimage_1: 0 24576 linear 253:1 384
vg0-lv0_mimage_0: 0 24576 linear 253:0 384
pv2: 0 512000 linear 7:3 1024000
pv1: 0 512000 linear 7:3 512000
pv0: 0 512000 linear 7:3 0
vg0-lv0: 0 24576 mirror disk 2 253:3 1024 2 253:4 0 253:5 0
#
# dmsetup ls --tree
vg0-lv0 (253:6)
 |-vg0-lv0_mimage_1 (253:5)
 |  `-pv1 (253:1)
 |     `- (7:3)
 |-vg0-lv0_mimage_0 (253:4)
 |  `-pv0 (253:0)
 |     `- (7:3)
 `-vg0-lv0_mlog (253:3)
    `-pv2 (253:2)
       `- (7:3)
#
# lvchange -an vg0/lv0
#
# lvextend -L 24M vg0/lv0
  Extending 2 mirror images.
  Extending logical volume lv0 to 24.00 MB
  Logical volume lv0 successfully resized
#
# lvchange -ay vg0/lv0
#
# dmsetup table
vg0-lv0_mlog: 0 8192 linear 253:2 384
vg0-lv0_mimage_1: 0 24576 linear 253:1 384
vg0-lv0_mimage_1: 24576 24576 linear 253:0 24960
vg0-lv0_mimage_0: 0 24576 linear 253:0 384
vg0-lv0_mimage_0: 24576 24576 linear 253:2 8576
pv2: 0 512000 linear 7:3 1024000
pv1: 0 512000 linear 7:3 512000
pv0: 0 512000 linear 7:3 0
vg0-lv0: 0 49152 mirror disk 2 253:3 1024 2 253:4 0 253:5 0
#
# dmsetup ls --tree
vg0-lv0 (253:6)
 |-vg0-lv0_mimage_1 (253:5)
 |  |-pv0 (253:0)
 |  |  `- (7:3)
 |  `-pv1 (253:1)
 |     `- (7:3)
 |-vg0-lv0_mimage_0 (253:4)
 |  |-pv2 (253:2)
 |  |  `- (7:3)
 |  `-pv0 (253:0)
 |     `- (7:3)
 `-vg0-lv0_mlog (253:3)
    `-pv2 (253:2)
       `- (7:3)
#
# vgdisplay -v
    Finding all volume groups
    Finding volume group "vg0"
  --- Volume group ---
  VG Name               vg0
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               0
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               744.00 MB
  PE Size               4.00 MB
  Total PE              186
  Alloc PE / Size       13 / 52.00 MB
  Free  PE / Size       173 / 692.00 MB
  VG UUID               uzGZos-W4r4-j4W9-RkYz-DCLO-SR3W-hqT3aZ

  --- Logical volume ---
  LV Name                /dev/vg0/lv0
  VG Name                vg0
  LV UUID                6uGGXk-CQzT-qtHN-JUs7-hrKm-cj3c-iJjS6t
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                24.00 MB
  Current LE             6
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:6

  --- Logical volume ---
  LV Name                /dev/vg0/lv0_mlog
  VG Name                vg0
  LV UUID                E8vZhz-1k1U-0K34-vSzS-OZrR-vQSB-g2Dg3f
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                4.00 MB
  Current LE             1
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:3

  --- Logical volume ---
  LV Name                /dev/vg0/lv0_mimage_0
  VG Name                vg0
  LV UUID                45WoUJ-QqYR-5W0b-v6NX-8MDV-31kS-sY5UCp
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                24.00 MB
  Current LE             6
  Segments               2
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:4

  --- Logical volume ---
  LV Name                /dev/vg0/lv0_mimage_1
  VG Name                vg0
  LV UUID                CHyO41-mL86-ZoNt-fUlW-0doo-IigE-Zdmi1G
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                24.00 MB
  Current LE             6
  Segments               2
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:5

  --- Physical volumes ---
  PV Name               /dev/dm-0
  PV UUID               swBAWJ-xzIj-G2Cm-jn6m-bL7k-mnQN-qPlWOH
  PV Status             allocatable
  Total PE / Free PE    62 / 56

  PV Name               /dev/dm-1
  PV UUID               nTO7rq-xgHV-oAsN-QHfC-5Om3-1he1-cVbvbE
  PV Status             allocatable
  Total PE / Free PE    62 / 59

  PV Name               /dev/dm-2
  PV UUID               GaZOHP-CgpX-dNkK-B91K-okER-m3Sg-aLGiEe
  PV Status             allocatable
  Total PE / Free PE    62 / 58

#
# lvdisplay -m
  --- Logical volume ---
  LV Name                /dev/vg0/lv0
  VG Name                vg0
  LV UUID                6uGGXk-CQzT-qtHN-JUs7-hrKm-cj3c-iJjS6t
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                24.00 MB
  Current LE             6
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:6

  --- Segments ---
  Logical extent 0 to 5:
    Type                mirror
    Mirrors             2
    Mirror size         6
    Mirror log volume   lv0_mlog
    Mirror region size  512.00 KB
    Mirror original:
      Logical volume    lv0_mimage_0
      Logical extents   0 to 5
    Mirror destinations:
      Logical volume    lv0_mimage_1
      Logical extents   0 to 5
-------------------------------------------------------------------
Comment 3 Alasdair Kergon 2006-04-28 13:59:55 EDT
The algorithm should not have allocated new parts of the mirror onto the same PV
as an existing log.
Comment 6 RHEL Product and Program Management 2006-08-18 12:25:59 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 7 Jun'ichi NOMURA 2006-09-12 16:58:28 EDT
Patch is posted to linux-lvm:
https://www.redhat.com/archives/linux-lvm/2006-August/msg00098.html
Comment 8 Alasdair Kergon 2006-11-30 11:03:15 EST
I think the contiguous part of this got fixed.
Comment 9 Jun'ichi NOMURA 2006-11-30 11:25:38 EST
Fixed in 2.02.10.
Comment 10 Jonathan Earl Brassow 2006-11-30 11:42:06 EST
Fix going into RHEL 4.5
Comment 11 Corey Marthaler 2006-12-21 12:56:40 EST
Jon and I verified that the following mirror extend cases all worked:

1. mirror extend into contiguous free space on both m leg devices 
2. mirror extend into non-contiguous free space on both m leg devices
3. mirror extend into non-contiguous free space on primary m leg but contiguous
free space on secondary m leg
Comment 15 Red Hat Bugzilla 2007-05-07 20:00:21 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 the 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-2007-0287.html

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