Bug 836391

Summary: nosync raid upconverts w/o initial resync
Product: Red Hat Enterprise Linux 6 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Jonathan Earl Brassow <jbrassow>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: low    
Version: 6.3CC: agk, dwysocha, heinzm, jbrassow, msnitzer, prajnoha, prockai, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.98-1.el6 Doc Type: Bug Fix
Doc Text:
Previously, the code that was used to cause a user-initiated resync of a RAID logical volume was ineffective. This has been resolved and issuing a 'lvchange --resync' on a RAID logical volume will now cause the logical volume to undergo a complete resync.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 08:11:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Corey Marthaler 2012-06-28 21:54:27 UTC
Description of problem:
Should a --nosync raid volume be allowed to be upconverted w/o an initial sync? It fails when attempted with mirrored volumes.

lvcreate --type raid1 -m 1 -n nosync_raid_up_convert -L 100M --nosync raid_sanity
  WARNING: New raid1 won't be synchronised. Don't read what you didn't write!

# Attempt to upconvert without an initial resync
lvconvert --type raid1 -m 2 raid_sanity/nosync_raid_up_convert

  LV                                 Attr     LSize   Copy%  Devices
  nosync_raid_up_convert             Rwi-a-m- 100.00m  60.00 nosync_raid_up_convert_rimage_0(0),nosync_raid_up_convert_rimage_1(0),nosync_raid_up_convert_rimage_2(0)
  [nosync_raid_up_convert_rimage_0]  Iwi-aor- 100.00m        /dev/etherd/e1.1p9(1)
  [nosync_raid_up_convert_rimage_1]  Iwi-aor- 100.00m        /dev/etherd/e1.1p8(1)
  [nosync_raid_up_convert_rimage_2]  Iwi-aor- 100.00m        /dev/etherd/e1.1p7(1)
  [nosync_raid_up_convert_rmeta_0]   ewi-aor-   4.00m        /dev/etherd/e1.1p9(0)
  [nosync_raid_up_convert_rmeta_1]   ewi-aor-   4.00m        /dev/etherd/e1.1p8(0)
  [nosync_raid_up_convert_rmeta_2]   ewi-aor-   4.00m        /dev/etherd/e1.1p7(0)

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

lvm2-2.02.95-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
lvm2-libs-2.02.95-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
lvm2-cluster-2.02.95-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
udev-147-2.41.el6    BUILT: Thu Mar  1 13:01:08 CST 2012
device-mapper-1.02.74-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
device-mapper-libs-1.02.74-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
device-mapper-event-1.02.74-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
device-mapper-event-libs-1.02.74-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012
cmirror-2.02.95-10.el6    BUILT: Fri May 18 03:26:00 CDT 2012

Comment 1 RHEL Program Management 2012-07-10 06:01:36 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 2 RHEL Program Management 2012-07-10 23:59:17 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 4 Jonathan Earl Brassow 2012-09-14 21:11:23 UTC
Unit test:

[root@hayes-01 lvm2]# lvcreate --type raid1 -m1 -L 500M -n lv vg --nosync
  WARNING: New raid1 won't be synchronised. Don't read what you didn't write!
  Logical volume "lv" created

[root@hayes-01 lvm2]# lvconvert -m 2 vg/lv
  Can't add image to out-of-sync RAID LV: use 'lvchange --resync' first.

[root@hayes-01 lvm2]# lvchange --resync vg/lv
Do you really want to deactivate logical volume lv to resync it? [y/n]: y

[root@hayes-01 lvm2]# lvconvert -m 2 vg/lv
  Can't add image to RAID LV that is still initializing.

[root@hayes-01 lvm2]# lvconvert -m 2 vg/lv

[root@hayes-01 lvm2]# dmsetup status vg-lv
0 1024000 raid raid1 3 AAa 298112/1024000


The 'mirror' segment type allows upconverting while a mirror is initializing/resyncing.  The 'raid1' segment type does not.  This is intentional and necessary.

Comment 5 Jonathan Earl Brassow 2012-09-14 21:14:02 UTC
commit 116bcb3ea4c3e4b030180757fb5be149af1fda07
Author: Jonathan Brassow <jbrassow>
Date:   Fri Sep 14 16:12:52 2012 -0500

    RAID1:  Like mirrors, do not allow adding images to LV created w/ --nosync
    
    Mirrors do not allow upconverting if the LV has been created with --nosync.
    We will enforce the same rule for RAID1.  It isn't hugely critical, since
    the portions that have been written will be copied over to the new device
    identically from either of the existing images.  However, the unwritten
    sections may be different, causing the added image to be a hybrid of the
    existing images.
    
    Also, we are disallowing the addition of new images to a RAID1 LV that has
    not completed the initial sync.  This may be different from mirroring, but
    that is due to the fact that the 'mirror' segment type "stacks" when adding
    a new image and RAID1 does not.  RAID1 will rebuild a newly added image
    "inline" from the existant images, so they should be in-sync.

Comment 7 Corey Marthaler 2012-11-14 21:39:10 UTC
Fix verified in the latest rpms.

2.6.32-339.el6.x86_64
lvm2-2.02.98-3.el6    BUILT: Mon Nov  5 06:45:48 CST 2012
lvm2-libs-2.02.98-3.el6    BUILT: Mon Nov  5 06:45:48 CST 2012
lvm2-cluster-2.02.98-3.el6    BUILT: Mon Nov  5 06:45:48 CST 2012
udev-147-2.43.el6    BUILT: Thu Oct 11 05:59:38 CDT 2012
device-mapper-1.02.77-3.el6    BUILT: Mon Nov  5 06:45:48 CST 2012
device-mapper-libs-1.02.77-3.el6    BUILT: Mon Nov  5 06:45:48 CST 2012
device-mapper-event-1.02.77-3.el6    BUILT: Mon Nov  5 06:45:48 CST 2012
device-mapper-event-libs-1.02.77-3.el6    BUILT: Mon Nov  5 06:45:48 CST 2012
cmirror-2.02.98-3.el6    BUILT: Mon Nov  5 06:45:48 CST 2012

============================================================
Iteration 10 of 10 started at Wed Nov 14 15:38:08 CST 2012
============================================================
SCENARIO (raid1) - [nosync_raid_up_convert]
Create a nosync mirror then resync it so that it can be up converted
taft-01: lvcreate --type raid1 -m 1 -n nosync_raid_up_convert -L 100M --nosync raid_sanity
  WARNING: New raid1 won't be synchronised. Don't read what you didn't write!
Attempt to upconvert without an initial resync
lvconvert --type raid1 -m 2 raid_sanity/nosync_raid_up_convert
  Can't add image to out-of-sync RAID LV: use 'lvchange --resync' first.
Deactivating nosync_raid_up_convert raid
Re-sync the mirror
Activating nosync_raid_up_convert raid
Waiting until all mirror|raid volumes become fully syncd...
   1/1 mirror(s) are fully synced: ( 100.00% )

Re-attempt to upconvert after the resync
lvconvert --type raid1 -m 2 raid_sanity/nosync_raid_up_convert
Deactivating raid nosync_raid_up_convert... and removing

Comment 8 errata-xmlrpc 2013-02-21 08:11:00 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-2013-0501.html