Bug 816672 - Partial activation (missing segment replacement) is broken
Partial activation (missing segment replacement) is broken
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: lvm2 (Show other bugs)
6.3
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: Zdenek Kabelac
Cluster QE
: Regression
Depends On:
Blocks: 822136
  Show dependency treegraph
 
Reported: 2012-04-26 12:25 EDT by Milan Broz
Modified: 2013-02-28 23:11 EST (History)
13 users (show)

See Also:
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 11:03:38 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Milan Broz 2012-04-26 12:25:49 EDT
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 12:37:59 EDT
We'll add test cases for this to the regression suite.
Comment 2 Alasdair Kergon 2012-04-26 12:57:07 EDT
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 11:00:03 EDT
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 07:38:47 EDT
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 16:27:57 EDT
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 05:29:59 EDT
    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 11:03:38 EDT
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

Note You need to log in before you can comment on or make changes to this bug.