Bug 1579072

Summary: raid1 volumes with outstanding tracked split off images should probably be locked down from type conversion
Product: Red Hat Enterprise Linux 7 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: Heinz Mauelshagen <heinzm>
lvm2 sub component: Mirroring and RAID QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: unspecified CC: agk, heinzm, jbrassow, msnitzer, prajnoha, zkabelac
Version: 7.5   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.02.180-2.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 11:02:26 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 2018-05-16 22:57:17 UTC
Description of problem:

# Basic case of raid1 -> mirror w/ an outstanding tracked split

[root@host-073 tmp]# lvcreate --type raid1 -m 2 -n raid -L 100M VG
  Logical volume "raid" created.
[root@host-073 tmp]# lvconvert --yes --splitmirrors 1 --trackchanges VG/raid
  VG/raid_rimage_2 split from VG/raid for read-only purposes.
  Use 'lvconvert --merge VG/raid_rimage_2' to merge back into VG/raid.
[root@host-073 tmp]# lvs -a -o +devices
  LV              VG  Attr       LSize   Log Cpy%Sync Devices
  raid            VG  rwi-a-r--- 100.00m     100.00   raid_rimage_0(0),raid_rimage_1(0),raid_rimage_2(0)
  [raid_rimage_0] VG  iwi-aor--- 100.00m              /dev/sda1(1)
  [raid_rimage_1] VG  iwi-aor--- 100.00m              /dev/sda2(1)
  raid_rimage_2   VG  Iri-a-r--- 100.00m              /dev/sda3(1)
  [raid_rmeta_0]  VG  ewi-aor---   4.00m              /dev/sda1(0)
  [raid_rmeta_1]  VG  ewi-aor---   4.00m              /dev/sda2(0)
  [raid_rmeta_2]  VG  ewi-a-r---   4.00m              /dev/sda3(0)
[root@host-073 tmp]# lvconvert --type mirror VG/raid
Are you sure you want to convert VG/raid back to the older mirror type? [y/n]: y
  Logical volume VG/raid successfully converted.
[root@host-073 tmp]# lvs -a -o +devices
  LV              VG  Attr       LSize   Log         Cpy%Sync Devices
  raid            VG  mwi-a-m--- 100.00m [raid_mlog] 100.00   raid_mimage_0(0),raid_mimage_1(0),raid_mimage_2(0)
  [raid_mimage_0] VG  iwi-aom--- 100.00m                      /dev/sda1(1)
  [raid_mimage_1] VG  iwi-aom--- 100.00m                      /dev/sda2(1)
  raid_mimage_2   VG  iri-aom--- 100.00m                      /dev/sda3(1)
  [raid_mlog]     VG  lwn-aom---   4.00m                      /dev/sdb3(0)
[root@host-073 tmp]# lvconvert --yes --merge VG/raid_mimage_2
  Unable to merge non-mirror image VG/raid_mimage_2.

# The above split off image was renamed to raid_mimage_2, yet retained its "iri-" attr.





# raid1 -> raid5 atttempt
[root@host-073 tmp]# lvcreate --type raid1 -m 1 -n raid -L 100M VG
  Logical volume "raid" created.
[root@host-073 tmp]# lvconvert --yes --splitmirrors 1 --trackchanges VG/raid
  VG/raid_rimage_1 split from VG/raid for read-only purposes.
  WARNING: Any newly written data will be non-resilient on LV VG/raid during the split!
  Use 'lvconvert --merge VG/raid_rimage_1' to merge back into VG/raid.

[root@host-073 tmp]# lvconvert --type raid5 VG/raid
  Using default stripesize 64.00 KiB.
Are you sure you want to convert raid1 LV VG/raid to raid5 type? [y/n]: y
  Logical volume VG/raid successfully converted.

[root@host-073 tmp]# lvs -a -o +devices
  LV              VG  Attr       LSize   Log Cpy%Sync Devices
  raid            VG  rwi-a-r--- 100.00m     100.00   raid_rimage_0(0),raid_rimage_1(0)
  [raid_rimage_0] VG  iwi-aor--- 100.00m              /dev/sda1(1)
  raid_rimage_1   VG  Iri-a-r--- 100.00m              /dev/sda2(1)
  [raid_rmeta_0]  VG  ewi-aor---   4.00m              /dev/sda1(0)
  [raid_rmeta_1]  VG  ewi-a-r---   4.00m              /dev/sda2(0)

# An extend attempt gives a proper error message
[root@host-073 tmp]# lvextend -L +100M VG/raid
  Cannot resize logical volume VG/raid while it is tracking a split image.

# A reshape attempt properly fails, but the error is wrong since it is in sync. The error should be similar to the extend attempt
[root@host-073 tmp]# lvconvert --stripes 3 VG/raid
  Using default stripesize 64.00 KiB.
  Can't reshape out of sync LV VG/raid.
  Reshape request failed on LV VG/raid.

[root@host-073 tmp]# lvconvert --type raid5_n VG/raid
  Using default stripesize 64.00 KiB.
  Can't reshape out of sync LV VG/raid.
  Reshape request failed on LV VG/raid.

# An attempt to convert back to raid1:
[root@host-073 tmp]# lvconvert --type raid1 VG/raid
Are you sure you want to convert raid5 LV VG/raid to raid1 type? [y/n]: y
  device-mapper: reload ioctl on  (253:10) failed: Invalid argument
  Failed to lock logical volume VG/raid.

May 16 17:32:11 host-073 kernel: device-mapper: table: 253:10: raid: Insufficient redundancy to activate array
May 16 17:32:11 host-073 kernel: device-mapper: ioctl: error adding target to table

Version-Release number of selected component (if applicable):
3.10.0-862.el7.x86_64

lvm2-2.02.177-4.el7    BUILT: Fri Feb 16 06:22:31 CST 2018
lvm2-libs-2.02.177-4.el7    BUILT: Fri Feb 16 06:22:31 CST 2018
lvm2-cluster-2.02.177-4.el7    BUILT: Fri Feb 16 06:22:31 CST 2018
cmirror-2.02.177-4.el7    BUILT: Fri Feb 16 06:22:31 CST 2018
device-mapper-1.02.146-4.el7    BUILT: Fri Feb 16 06:22:31 CST 2018
device-mapper-libs-1.02.146-4.el7    BUILT: Fri Feb 16 06:22:31 CST 2018
device-mapper-event-1.02.146-4.el7    BUILT: Fri Feb 16 06:22:31 CST 2018
device-mapper-event-libs-1.02.146-4.el7    BUILT: Fri Feb 16 06:22:31 CST 2018
device-mapper-persistent-data-0.7.3-3.el7    BUILT: Tue Nov 14 05:07:18 CST 2017

Comment 2 Heinz Mauelshagen 2018-07-26 00:08:30 UTC
lvm upstream commit a004bb07f14baeed158ac9ea571cf5a6882c436f
to reject conversions of split trackchanges raid1 LVs.

Comment 4 Corey Marthaler 2018-08-08 20:18:27 UTC
3.10.0-931.el7.x86_64

lvm2-2.02.180-2.el7    BUILT: Wed Aug  1 11:22:48 CDT 2018
lvm2-libs-2.02.180-2.el7    BUILT: Wed Aug  1 11:22:48 CDT 2018
lvm2-cluster-2.02.180-2.el7    BUILT: Wed Aug  1 11:22:48 CDT 2018
cmirror-2.02.180-2.el7    BUILT: Wed Aug  1 11:22:48 CDT 2018
device-mapper-1.02.149-2.el7    BUILT: Wed Aug  1 11:22:48 CDT 2018
device-mapper-libs-1.02.149-2.el7    BUILT: Wed Aug  1 11:22:48 CDT 2018
device-mapper-event-1.02.149-2.el7    BUILT: Wed Aug  1 11:22:48 CDT 2018
device-mapper-event-libs-1.02.149-2.el7    BUILT: Wed Aug  1 11:22:48 CDT 2018



[root@host-073 ~]# lvs -a -o +devices
  LV                        VG            Attr       LSize   Pool   Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices                                                                         
  split_tracking            split_image   rwi-a-r--- 500.00m                                      100.00           split_tracking_rimage_0(0),split_tracking_rimage_1(0),split_tracking_rimage_2(0)
  [split_tracking_rimage_0] split_image   iwi-aor--- 500.00m                                                       /dev/sdb1(1)                                                                    
  [split_tracking_rimage_1] split_image   iwi-aor--- 500.00m                                                       /dev/sde1(1)                                                                    
  split_tracking_rimage_2   split_image   Iri---r--- 500.00m                                                       /dev/sdd1(1)                                                                    
  [split_tracking_rmeta_0]  split_image   ewi-aor---   4.00m                                                       /dev/sdb1(0)                                                                    
  [split_tracking_rmeta_1]  split_image   ewi-aor---   4.00m                                                       /dev/sde1(0)                                                                    
  [split_tracking_rmeta_2]  split_image   ewi---r---   4.00m                                                       /dev/sdd1(0)                                                                    

[root@host-073 ~]# lvconvert --yes --type mirror -m 1 split_image/split_tracking
  Conversion of tracking raid1 LV split_image/split_tracking is not supported.
[root@host-073 ~]# lvconvert --yes --type raid4 split_image/split_tracking
  Using default stripesize 64.00 KiB.
  Conversion of tracking raid1 LV split_image/split_tracking is not supported.

Comment 6 errata-xmlrpc 2018-10-30 11:02:26 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.

https://access.redhat.com/errata/RHBA-2018:3193