Bug 816672

Summary: Partial activation (missing segment replacement) is broken
Product: Red Hat Enterprise Linux 6 Reporter: Milan Broz <mbroz>
Component: lvm2Assignee: Zdenek Kabelac <zkabelac>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3CC: agk, cmarthal, dwysocha, heinzm, jbrassow, mbroz, msnitzer, prajnoha, prockai, pvrabec, syeghiay, thornber, zkabelac
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.02.95-9.el6 Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of:
: 822136 (view as bug list) Environment:
Last Closed: 2012-06-20 15:03:38 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:
Bug Depends On:    
Bug Blocks: 822136    

Description Milan Broz 2012-04-26 16:25:49 UTC
Description of problem:

Seems that --partial activation is now impossible if LV segments are missing.

# vgcreate vgt /dev/sdb[12]
  Volume group "vgt" successfully created
# lvcreate -n lv -l100%FREE vgt
  Logical volume "lv" created
# vgchange -a n vgt

destroy one PV:
# dd if=/dev/zero of=/dev/sdb1 bs=1M count=1
# vgscan
  Reading all physical volumes.  This may take a while...
  Couldn't find device with uuid E3uAeM-Mzkn-Jcig-mzD5-3ZPd-33sL-R7RkSX.
  ...
# lvs -o +devices vgt
  Couldn't find device with uuid E3uAeM-Mzkn-Jcig-mzD5-3ZPd-33sL-R7RkSX.
  LV   VG   Attr   LSize  Origin Snap%  Move Log Copy%  Convert Devices          
  lv   vgt  -wi-a- 15.33g                                       unknown device(0)
  lv   vgt  -wi-a- 15.33g                                       /dev/sdb2(0)     

Now, if we partially activate it, missing segment is replaced
with missing_stripe_filler (see lvm.conf), default is error:
# vgchange -a y vgt --partial
  Partial mode. Incomplete logical volumes will be processed.
  Couldn't find device with uuid E3uAeM-Mzkn-Jcig-mzD5-3ZPd-33sL-R7RkSX.
  1 logical volume(s) in volume group "vgt" now active

# dmsetup table |grep vgt
vgt-lv: 0 16072704 linear 253:3 0
vgt-lv: 16072704 16072704 linear 8:18 2048
vgt-lv-missing_0_0: 0 16072704 error 

lvm2-2.02.87-6.el6


For 6.3 lvm2 (here using some test version) it is broken:
lvm2-2.02.96-0.104.el6

# vgchange -a y vgt --partial
  Partial mode. Incomplete logical volumes will be processed.
  Couldn't find device with uuid E3uAeM-Mzkn-Jcig-mzD5-3ZPd-33sL-R7RkSX.
  Cannot activate vgt/lv: all segments missing.
  0 logical volume(s) in volume group "vgt" now active
# dmsetup table |grep vgt
[nothing]

There should be also some basic test coverage for this.

Comment 1 Corey Marthaler 2012-04-26 16:37:59 UTC
We'll add test cases for this to the regression suite.

Comment 2 Alasdair Kergon 2012-04-26 16:57:07 UTC
add_areas_line() is trying to detect if a partial activation is pointless, but is only looking at one segment in isolation.

1) The test needs to consider the LV as a whole - check all segments at once, not each individually.

2) If all areas used by a segment are missing, the whole segment should be mapped to an error target.

Comment 3 Milan Broz 2012-05-09 15:00:03 UTC
From call: if it is easier to revert patch to reintroduce previous state, let's do it for 6.3.

And fix it properly upstream.

Peter, I think it was your patch causing this problem, can you take a look? THX.

Comment 4 Alasdair Kergon 2012-05-16 11:38:47 UTC
Should be split into two.

(a) revert this from upstream/RHEL6.3:

               if (!num_existing_areas &&
                   !strstr(seg->lv->name, "_mimage_") &&
                   !((name = strstr(seg->lv->name, "_mlog")) && !name[5])) {
                       log_error("Cannot activate %s/%s: all segments missing."
                                 seg->lv->vg->name, seg->lv->name);
                       return 0;

(b) new bug for upstream/RHEL6.4 to deal with the issue properly (comment #2)

Comment 8 Corey Marthaler 2012-05-17 20:27:57 UTC
Fix verified in the latest rpms.

2.6.32-270.el6.x86_64
lvm2-2.02.95-9.el6    BUILT: Wed May 16 10:34:14 CDT 2012
lvm2-libs-2.02.95-9.el6    BUILT: Wed May 16 10:34:14 CDT 2012
lvm2-cluster-2.02.95-9.el6    BUILT: Wed May 16 10:34:14 CDT 2012
udev-147-2.41.el6    BUILT: Thu Mar  1 13:01:08 CST 2012
device-mapper-1.02.74-9.el6    BUILT: Wed May 16 10:34:14 CDT 2012
device-mapper-libs-1.02.74-9.el6    BUILT: Wed May 16 10:34:14 CDT 2012
device-mapper-event-1.02.74-9.el6    BUILT: Wed May 16 10:34:14 CDT 2012
device-mapper-event-libs-1.02.74-9.el6    BUILT: Wed May 16 10:34:14 CDT 2012
cmirror-2.02.95-9.el6    BUILT: Wed May 16 10:34:14 CDT 2012

[root@taft-01 ~]# vgcreate test /dev/sd[bc][1]
  Volume group "test" successfully created

[root@taft-01 ~]# lvcreate -n lv -l100%FREE  test
  Logical volume "lv" created

[root@taft-01 ~]# lvs -a -o +devices
  LV  VG    Attr     LSize    Devices         
  lv  test  -wi-a--- 271.33g  /dev/sdb1(0)    
  lv  test  -wi-a--- 271.33g  /dev/sdc1(0)    

[root@taft-01 ~]# vgchange -a n test
  0 logical volume(s) in volume group "test" now active

[root@taft-01 ~]# dd if=/dev/zero of=/dev/sdb1 bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.0115695 s, 90.6 MB/s

[root@taft-01 ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Couldn't find device with uuid egskWs-Zx5i-DQwE-x1B4-tamM-jeOh-wfphE5.
  Found volume group "test" using metadata type lvm2
  Found volume group "vg_taft01" using metadata type lvm2

[root@taft-01 ~]# lvs -o +devices test
  Couldn't find device with uuid egskWs-Zx5i-DQwE-x1B4-tamM-jeOh-wfphE5.
  LV   VG   Attr     LSize   Devices          
  lv   test -wi----- 271.33g unknown device(0)
  lv   test -wi----- 271.33g /dev/sdc1(0)     

[root@taft-01 ~]# vgchange -a y test --partial
  Partial mode. Incomplete logical volumes will be processed.
  Couldn't find device with uuid egskWs-Zx5i-DQwE-x1B4-tamM-jeOh-wfphE5.
  1 logical volume(s) in volume group "test" now active

[root@taft-01 ~]# dmsetup table |grep test
test-lv: 0 284508160 linear 253:3 0
test-lv: 284508160 284508160 linear 8:33 2048
test-lv-missing_0_0: 0 284508160 error

Comment 9 Peter Rajnoha 2012-05-22 09:29:59 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No documentation needed.

Comment 11 errata-xmlrpc 2012-06-20 15:03:38 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-2012-0962.html