Bug 715364

Summary: Segmentation fault when attempting lvextend --alloc cling_by_tags
Product: Red Hat Enterprise Linux 5 Reporter: Corey Marthaler <cmarthal>
Component: lvm2-clusterAssignee: LVM and device-mapper development team <lvm-team>
Status: CLOSED CURRENTRELEASE QA Contact: Cluster QE <mspqa-list>
Severity: high Docs Contact:
Priority: high    
Version: 5.7CC: agk, ccaulfie, dwysocha, heinzm, jbrassow, nperic, prajnoha, prockai, slevine, thornber, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-21 13:48:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 807971, 928849    
Attachments:
Description Flags
core from grant-02
none
lvextend -vvvv from grant-01 that segfaulted none

Description Corey Marthaler 2011-06-22 16:22:59 UTC
Description of problem:

SCENARIO - [cling_tags_extend_1]
Verify that mirror extends honor the cling by tags allocation policy when
there are enough PVs with tags present for extension to work
Add tags to random PVs
Create a mirror using the tagged PVs
lvcreate -m 1 -n cling_mirror -l 10462 mirror_sanity /dev/sdb5 /dev/sdb6 /dev/sdc5:50
Extend using the cling_by_tags policy:
lvextend -l 20924 --alloc cling_by_tags mirror_sanity/cling_mirror
couldn't extend mirror cling_mirror

[root@grant-03 ~]# pvs -a -o +pv_tags
  /dev/sdb1                       mirror_sanity lvm2 a-   40.87G 40.87G
  /dev/sdb2                       mirror_sanity lvm2 a-   40.87G 40.87G
  /dev/sdb3                       mirror_sanity lvm2 a-   40.87G 40.87G
  /dev/sdb5                       mirror_sanity lvm2 a-   40.88G  8.00M A
  /dev/sdb6                       mirror_sanity lvm2 a-   40.87G     0  B
  /dev/sdc1                       mirror_sanity lvm2 a-   54.49G 54.49G
  /dev/sdc2                       mirror_sanity lvm2 a-   54.49G 54.49G A
  /dev/sdc3                       mirror_sanity lvm2 a-   54.48G 54.48G
  /dev/sdc5                       mirror_sanity lvm2 a-   54.49G 54.49G
  /dev/sdc6                       mirror_sanity lvm2 a-   54.48G 54.48G B

[root@grant-03 ~]# lvs -a -o +devices
  LV                      Attr   LSize  Log               Copy%  Devices
  cling_mirror            mwi-a- 40.87G cling_mirror_mlog 100.00 cling_mirror_mimage_0(0),cling_mirror_mimage_1(0)
  [cling_mirror_mimage_0] iwi-ao 40.87G                          /dev/sdb5(0)
  [cling_mirror_mimage_1] iwi-ao 40.87G                          /dev/sdb6(0)
  [cling_mirror_mlog]     lwi-ao  4.00M                          /dev/sdc5(50)


[root@grant-02 ~]# lvextend -l 20924 --alloc cling_by_tags mirror_sanity/cling_mirror
  Extending 2 mirror images.
  Extending logical volume cling_mirror to 81.73 GB
Segmentation fault (core dumped)

Core was generated by `lvextend -l 20924 --alloc cling_by_tags mirror_sanity/cling_mirror'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000004562b6 in allocate_extents ()
(gdb) bt
#0  0x00000000004562b6 in allocate_extents ()
#1  0x00000000004596a3 in lv_extend ()
#2  0x000000000041f606 in lvresize ()
#3  0x000000000041c78f in lvm_run_command ()
#4  0x000000000041cc55 in lvm2_main ()
#5  0x00000032d161d994 in __libc_start_main () from /lib64/libc.so.6
#6  0x0000000000410749 in _start ()


Version-Release number of selected component (if applicable):
2.6.18-266.el5

lvm2-2.02.84-6.el5    BUILT: Thu Jun 16 10:31:15 CDT 2011
lvm2-cluster-2.02.84-6.el5    BUILT: Thu Jun 16 10:32:56 CDT 2011
device-mapper-1.02.63-4.el5    BUILT: Fri Jun 10 12:28:16 CDT 2011
device-mapper-event-1.02.63-4.el5    BUILT: Fri Jun 10 12:28:16 CDT 2011
cmirror-1.1.39-10.el5    BUILT: Wed Sep  8 16:32:05 CDT 2010
kmod-cmirror-0.1.22-3.el5    BUILT: Tue Dec 22 13:39:47 CST 2009

Comment 1 Corey Marthaler 2011-06-22 16:41:04 UTC
Created attachment 506056 [details]
core from grant-02

Comment 2 Corey Marthaler 2011-06-22 18:31:39 UTC
I attempted to reproduce this and saw this:

[root@grant-02 ~]# lvs -a -o +devices
  LV                      Attr   LSize  Log               Copy%  Devices
  cling_mirror            mwi-a- 40.87G cling_mirror_mlog  44.42 cling_mirror_mimage_0(0),cling_mirror_mimage_1(0)
  [cling_mirror_mimage_0] Iwi-ao 40.87G                          /dev/sdc5(0)
  [cling_mirror_mimage_1] Iwi-ao 40.87G                          /dev/sdc6(0)
  [cling_mirror_mlog]     lwi-ao  4.00M                          /dev/sdc2(50)

[root@grant-02 ~]# lvextend -l 20924 --alloc cling_by_tags mirror_sanity/cling_mirror
  Extending 2 mirror images.
  Extending logical volume cling_mirror to 81.73 GB
  Inconsistent length: 10466 13948
  PV segment pe_alloc_count mismatch: 10466 != 17442
  PV segment VG free_count mismatch: 90667 != 83691
  Internal error: PV segments corrupted in mirror_sanity.
  LV cling_mirror_mimage_1: segment 2 has inconsistent PV area 0
  LV cling_mirror_mimage_1: segment 3 has inconsistent PV area 0
  Internal error: LV segments corrupted in cling_mirror_mimage_1.

Comment 3 Milan Broz 2011-06-23 11:52:35 UTC
backtrace from coredump

Core was generated by `lvextend -l 20924 --alloc cling_by_tags mirror_sanity/cling_mirror'.
Program terminated with signal 11, Segmentation fault.
#0  _allocate (vg=0x1d851b60, lv=0x1d8529a8, segtype=<value optimized out>, stripes=<value optimized out>, 
    mirrors=<value optimized out>, log_count=0, region_size=0, extents=10462, allocatable_pvs=0x1d851be8, 
    alloc=ALLOC_CLING, parallel_areas=0x0) at metadata/lv_manip.c:806
806                     log_debug("Allocating parallel area %" PRIu32
(gdb) bt
#0  _allocate (vg=0x1d851b60, lv=0x1d8529a8, segtype=<value optimized out>, stripes=<value optimized out>, 
    mirrors=<value optimized out>, log_count=0, region_size=0, extents=10462, allocatable_pvs=0x1d851be8, 
    alloc=ALLOC_CLING, parallel_areas=0x0) at metadata/lv_manip.c:806
#1  allocate_extents (vg=0x1d851b60, lv=0x1d8529a8, segtype=<value optimized out>, stripes=<value optimized out>, 
    mirrors=<value optimized out>, log_count=0, region_size=0, extents=10462, allocatable_pvs=0x1d851be8, 
    alloc=ALLOC_CLING, parallel_areas=0x0) at metadata/lv_manip.c:1560
#2  0x00000000004596a3 in lv_extend (lv=0x1d8529a8, segtype=0x1d850620, stripes=1, stripe_size=0, mirrors=2, 
    extents=10462, mirrored_pv=0x0, mirrored_pe=0, status=0, allocatable_pvs=0x1d851be8, alloc=1929406326)
    at metadata/lv_manip.c:1853
#3  0x000000000041f606 in _lvresize (cmd=0x1d825550, argc=<value optimized out>, argv=<value optimized out>)
    at lvresize.c:706
#4  lvresize (cmd=0x1d825550, argc=<value optimized out>, argv=<value optimized out>) at lvresize.c:780
#5  0x000000000041c78f in lvm_run_command (cmd=0x1d825550, argc=1, argv=0x7fff1325a878) at lvmcmdline.c:1122
#6  0x000000000041cc55 in lvm2_main (argc=6, argv=0x7fff1325a878) at lvmcmdline.c:1485
#7  0x00000032d161d994 in __libc_start_main () from /lib64/libc.so.6
#8  0x0000000000410749 in _start ()

Comment 4 Milan Broz 2011-06-23 12:13:05 UTC
This must be some random memory corruption.

I am not able to reproduce it (either with local or cluster locking...).

Comment 5 Milan Broz 2011-06-23 12:17:25 UTC
Please also attach full debug log of crashing lvextend.

Comment 6 Corey Marthaler 2011-06-24 21:39:51 UTC
Created attachment 509849 [details]
lvextend -vvvv from grant-01 that segfaulted

Comment 16 Nenad Peric 2013-05-21 11:58:07 UTC
I ran the tests with the newest lvm pacakge and it worked without the mentioned issues. 
The lvm I used was:

lvm2-2.02.88-11.el5


I ran three scenarios which should cover this problem successfully:

cling extension with available tagged extents
cling extension with no avail. tagged extents
cling extension with avail. vg extents but none tagged

Comment 17 Peter Rajnoha 2013-05-21 13:48:54 UTC
...ok, since we were not able to reproduce as well, I'm closing this one then. If it appears again, feel free to reopen. Thanks.