Bug 1505434

Summary: raid1: snapshosts erronously allowed on legs
Product: Red Hat Enterprise Linux 7 Reporter: Heinz Mauelshagen <heinzm>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
lvm2 sub component: Mirroring and RAID QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, cmarthal, heinzm, jbrassow, lmiksik, mcsontos, msnitzer, prajnoha, prockai, toneata, zkabelac
Version: 7.5   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.176-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 15:22:16 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 Heinz Mauelshagen 2017-10-23 14:50:16 UTC
Description of problem:
Snapshots can be created on raid1 leg devices (rimage SubLVs).

Version-Release number of selected component (if applicable):
lvm2-2.02.171-8.el7

How reproducible:
Always

Steps to Reproduce:
1. lvcreate -l1 -nr --type raid1 -m1 vg
2. lvcreate -s -l1 -ns0 /dev/mapper/r_rimage_0
3.

Actual results:
Snapshot's being created on first raid1 leg.

Expected results:
Snapshot creation on raid1 leg should be rejected.

Additional info:

Comment 2 Zdenek Kabelac 2017-10-23 16:28:26 UTC
Surprisingly this was not protected even in versions like 2.02.98.

Also '--type mirror' has the same problem.

Comment 3 Zdenek Kabelac 2017-10-25 20:13:32 UTC
Fixed validation with upstream patch:

https://www.redhat.com/archives/lvm-devel/2017-October/msg00066.html

Comment 4 Corey Marthaler 2017-10-26 17:11:40 UTC
I assume pmspare volumes will be disallowed as well with this fix?


[root@host-007 ~]# lvs -a -o +devices
  LV              VG      Attr       LSize   Pool Origin Data%  Meta% Devices
  [lvol0_pmspare] snapper ewi-------   4.00m                          /dev/sdd1(76)
  origin          snapper twi-a-tz-- 300.00m             0.00   0.88  origin_tdata(0)
  [origin_tdata]  snapper Twi-ao---- 300.00m                          /dev/sdd1(0)
  [origin_tmeta]  snapper ewi-ao----   4.00m                          /dev/sdd1(75)

# This could be disallowed as well
[root@host-007 ~]# lvcreate -s snapper/lvol0_pmspare -L 100M
  Using default stripesize 64.00 KiB.
  Reducing COW size 100.00 MiB down to maximum usable size 8.00 MiB.
  Logical volume "lvol1" created.

[root@host-007 ~]# lvcreate -s snapper/origin_tdata -L 100M
  Using default stripesize 64.00 KiB.
  Snapshots of thin pool data devices are not supported.

[root@host-007 ~]# lvcreate -s snapper/origin_tmeta -L 100M
  Using default stripesize 64.00 KiB.
  Reducing COW size 100.00 MiB down to maximum usable size 8.00 MiB.
  Snapshots of thin pool metadata devices are not supported.

[root@host-007 ~]# lvs -a -o +devices
  LV              VG      Attr       LSize   Pool Origin          Data%  Meta% Devices
  [lvol0_pmspare] snapper owi---s---   4.00m                                   /dev/sdd1(76)
  lvol1           snapper swi---s---   8.00m      [lvol0_pmspare]              /dev/sdd1(77)
  origin          snapper twi-a-tz-- 300.00m                      0.00   0.88  origin_tdata(0)
  [origin_tdata]  snapper Twi-ao---- 300.00m                                   /dev/sdd1(0)
  [origin_tmeta]  snapper ewi-ao----   4.00m                                   /dev/sdd1(75)

Comment 5 Zdenek Kabelac 2017-10-26 17:37:03 UTC
Nope - this needs another extra (similar) check. 

Thanks for pointing this out.

Comment 7 Zdenek Kabelac 2017-11-04 20:53:59 UTC
Further fixes in (2.02.176):

https://www.redhat.com/archives/lvm-devel/2017-October/msg00084.html

Comment 13 Corey Marthaler 2017-11-14 16:35:01 UTC
Fix verified in the latest rpms.

3.10.0-772.el7.x86_64

lvm2-2.02.176-3.el7    BUILT: Fri Nov 10 07:12:10 CST 2017
lvm2-libs-2.02.176-3.el7    BUILT: Fri Nov 10 07:12:10 CST 2017
lvm2-cluster-2.02.176-3.el7    BUILT: Fri Nov 10 07:12:10 CST 2017
lvm2-lockd-2.02.176-3.el7    BUILT: Fri Nov 10 07:12:10 CST 2017
lvm2-python-boom-0.8-3.el7    BUILT: Fri Nov 10 07:16:45 CST 2017
cmirror-2.02.176-3.el7    BUILT: Fri Nov 10 07:12:10 CST 2017
device-mapper-1.02.145-3.el7    BUILT: Fri Nov 10 07:12:10 CST 2017
device-mapper-libs-1.02.145-3.el7    BUILT: Fri Nov 10 07:12:10 CST 2017
device-mapper-event-1.02.145-3.el7    BUILT: Fri Nov 10 07:12:10 CST 2017
device-mapper-event-libs-1.02.145-3.el7    BUILT: Fri Nov 10 07:12:10 CST 2017
device-mapper-persistent-data-0.7.3-2.el7    BUILT: Tue Oct 10 04:00:07 CDT 2017




============================================================
Iteration 1 of 1 started at Tue Nov 14 10:31:28 CST 2017
============================================================
SCENARIO - [attempt_to_create_mirror_subvol_snaps]
Attempt to create mirror/raid LVs which contain meta volumes, and attempt to snapshot them
Making origin volume
lvcreate -L 300M snapper -n origin

Converting origin volume to type mirror
lvconvert --yes --type mirror -m 1 snapper/origin
Attempting to create snapshot volumes of mirror subvolumes:
lvcreate -s /dev/snapper/origin_mimage_0 -L 100M
  Snapshots of hidden volumes are not supported.
lvcreate -s /dev/snapper/origin_mlog -L 100M
  Snapshots of hidden volumes are not supported.
Removing origin snapper/origin

Making origin volume
lvcreate -L 300M snapper -n origin

Converting origin volume to type raid1
lvconvert --yes --type raid1 -m 1 snapper/origin
Attempting to create snapshot volumes of raid1 subvolumes:
lvcreate -s /dev/snapper/origin_rimage_0 -L 100M
  Snapshots of hidden volumes are not supported.
lvcreate -s /dev/snapper/origin_rmeta -L 100M
  Snapshot origin LV origin_rmeta not found in Volume group snapper.
Removing origin snapper/origin



SCENARIO - [attempt_to_create_pool_subvol_snaps]
Attempt to create thin/cache pool LVs which contain meta volumes, and attempt to snapshot them
Making origin volume
lvcreate -L 300M snapper -n origin

Converting origin volume to type cache-pool
lvconvert --yes --type cache-pool snapper/origin
  WARNING: Converting snapper/origin to cache pool's data volume with metadata wiping.
  THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
Attempting to create snapshot volumes of cache-pool subvolumes:
lvcreate -s /dev/snapper/origin_cdata -L 100M
  Snapshots of hidden volumes are not supported.
lvcreate -s /dev/snapper/origin_cmeta -L 100M
  Snapshots of hidden volumes are not supported.
lvcreate -s /dev/snapper/lvol0_pmspare -L 100M
  Snapshots of hidden volumes are not supported.
Removing origin snapper/origin

Making origin volume
lvcreate -L 300M snapper -n origin

Converting origin volume to type thin-pool
lvconvert --yes --type thin-pool snapper/origin
  WARNING: Converting snapper/origin to thin pool's data volume with metadata wiping.
  THIS WILL DESTROY CONTENT OF LOGICAL VOLUME (filesystem etc.)
Attempting to create snapshot volumes of thin-pool subvolumes:
lvcreate -s /dev/snapper/origin_tdata -L 100M
  Snapshots of hidden volumes are not supported.
lvcreate -s /dev/snapper/origin_tmeta -L 100M
  Snapshots of hidden volumes are not supported.
lvcreate -s /dev/snapper/lvol0_pmspare -L 100M
  Snapshots of hidden volumes are not supported.
Removing origin snapper/origin



Deleting VG snapper
Deleting PVs /dev/sdb1 /dev/sdg1

Comment 16 errata-xmlrpc 2018-04-10 15:22:16 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/RHEA-2018:0853