Description of problem: lvconvert from corelog to disklog allocates log device from the same PV where mirror image resides Version-Release number of selected component: lvm2-2.02.06-6.0.RHEL4 How reproducible: Always Steps to Reproduce: 1. Create a VG with 3 or more PVs # vgcreate testvg /dev/sdb[1-3] 2. Create a mirrored LV with corelog # lvcreate -m1 --corelog -l1 -nlv0 testvg 3. Convert it to disklog # lvconvert -m1 testvg/lv0 4. Check what consists of the LV # lvs -a -o+devices Actual results: Mirror image and log shares the same PV. LV Devices lv0 lv0_mimage_0(0),lv0_mimage_1(0) [lv0_mimage_0] /dev/sdb1(0) [lv0_mimage_1] /dev/sdb2(0) [lv0_mlog] /dev/sdb2(1) Expected results: Mirror images and log use different PVs. LV Devices lv0 lv0_mimage_0(0),lv0_mimage_1(0) [lv0_mimage_0] /dev/sdb1(0) [lv0_mimage_1] /dev/sdb2(0) [lv0_mlog] /dev/sdb3(0) Additional info: Attached script does the above steps and show what happens. # sh lvconvert-corelog.sh INFO: Creating a file for loop setup. file=tmpfile 122880+0 records in 122880+0 records out INFO: Setting up loop device. dev=/dev/loop0 file=tmpfile INFO: Creating PV. nr_pv=3 Physical volume "/dev/mapper/pv0" successfully created Physical volume "/dev/mapper/pv1" successfully created Physical volume "/dev/mapper/pv2" successfully created INFO: Creating VG. nr_vg=1. each pv in a vg: 3 INFO: vgname=testvg0 Volume group "testvg0" successfully created INFO: Create mirrored LV with corelog. Logical volume "lv0" created LV Devices lv0 lv0_mimage_0(0),lv0_mimage_1(0) [lv0_mimage_0] /dev/dm-0(0) [lv0_mimage_1] /dev/dm-1(0) INFO: Convert the LV to disklog. Logical volume lv0 converted. LV Devices lv0 lv0_mimage_0(0),lv0_mimage_1(0) [lv0_mimage_0] /dev/dm-0(0) [lv0_mimage_1] /dev/dm-1(0) [lv0_mlog] /dev/dm-1(1) INFO: Cleaning up.
Created attachment 134949 [details] Reproducer test script
Changed title to reflect real problem. The default allocation policy requires mirror images and log device to go on distinct devices. If the allocation policy is 'anywhere', the mirror images must be on distinct devices, but the log device can go anywhere. When up-converting, lvconvert behaves as though the allocation policy is 'anywhere'.
Patch and test case posted on linux-lvm: https://www.redhat.com/archives/linux-lvm/2006-September/msg00108.html
This patch should also be necessary to support the patches in comment #3 https://www.redhat.com/archives/linux-lvm/2006-August/msg00116.html
Revised patch set posted to lvm-devel. Waiting for comments / inclusion. https://www.redhat.com/archives/lvm-devel/2007-January/msg00004.html https://www.redhat.com/archives/lvm-devel/2007-January/msg00005.html https://www.redhat.com/archives/lvm-devel/2007-January/msg00006.html https://www.redhat.com/archives/lvm-devel/2007-January/msg00007.html https://www.redhat.com/archives/lvm-devel/2007-January/msg00008.html https://www.redhat.com/archives/lvm-devel/2007-January/msg00009.html
The patches work.
Created attachment 145103 [details] Reproducer test script What this script does: 1. Create loop-back device and dummy PVs on top of it 2. Create VG named "testvg" on it 3. lvcreate --corelog -m1 The each leg of the created mirror LV spans multiple PVs. 4. lvconvert -m1 5. Check the redundancy How to run: # sh testcase-lvconvert-addlog-multiseg.sh PV /dev/dm-7 VG testvg lvm2 [196.00 MB / 0 free] PV /dev/dm-8 VG testvg lvm2 [196.00 MB / 0 free] PV /dev/dm-9 VG testvg lvm2 [196.00 MB / 100.00 MB free] PV /dev/dm-10 VG testvg lvm2 [196.00 MB / 96.00 MB free] PV /dev/dm-11 VG testvg lvm2 [196.00 MB / 196.00 MB free] PV /dev/dm-12 VG testvg lvm2 [196.00 MB / 196.00 MB free] PV /dev/dm-13 VG testvg lvm2 [196.00 MB / 196.00 MB free] Total: 11 [19.03 GB] / in use: 9 [11.43 GB] / in no VG: 2 [7.60 GB] VG #PV #LV #SN Attr VSize VFree testvg 7 4 0 wz--n- 1.34G 784.00M VG #PV #LV #SN Attr VSize VFree testvg 7 4 0 wz--n- 1.34G 784.00M Logical volume "lv" successfully removed INFO: PE count of PV is 49. /dev/dm-10 testvg lvm2 a- 196.00M 196.00M /dev/dm-11 testvg lvm2 a- 196.00M 196.00M /dev/dm-12 testvg lvm2 a- 196.00M 196.00M /dev/dm-13 testvg lvm2 a- 196.00M 196.00M /dev/dm-7 testvg lvm2 a- 196.00M 196.00M /dev/dm-8 testvg lvm2 a- 196.00M 196.00M /dev/dm-9 testvg lvm2 a- 196.00M 196.00M INFO: Create mirror LV with each legs spanning multiple PVs. Logical volume "lv" created LV Devices lv lv_mimage_0(0),lv_mimage_1(0) [lv_mimage_0] /dev/dm-7(0) [lv_mimage_0] /dev/dm-9(0) [lv_mimage_1] /dev/dm-8(0) [lv_mimage_1] /dev/dm-10(0) INFO: Convert the LV to disklog. Logical volume lv converted. LV Devices lv lv_mimage_0(0),lv_mimage_1(0) [lv_mimage_0] /dev/dm-7(0) [lv_mimage_0] /dev/dm-9(0) [lv_mimage_1] /dev/dm-8(0) [lv_mimage_1] /dev/dm-10(0) [lv_mlog] /dev/dm-10(24) ERROR: /dev/dm-10 is used in both testvg/lv_mlog and testvg/lv_mimage_1 ERROR: /dev/dm-10 is used in both testvg/lv_mimage_1 and testvg/lv_mlog Number of failures: 2 FAIL
This bugzilla had previously been approved for engineering consideration but Red Hat Product Management is currently reevaluating this issue for inclusion in RHEL4.6.
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.
The needed patch is still not upstream, moving the development tracking to RHEL5 bug 221891.