Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1020825

Summary: Thin_check doesn't return error exit code for broken metadata
Product: Red Hat Enterprise Linux 7 Reporter: Heinz Mauelshagen <heinzm>
Component: device-mapper-persistent-dataAssignee: Heinz Mauelshagen <heinzm>
Status: CLOSED CURRENTRELEASE QA Contact: yanfu,wang <yanwang>
Severity: medium Docs Contact:
Priority: high    
Version: 7.0CC: agk, heinzm, jbrassow, lvm-team, msnitzer, prajnoha, prockai, qcai, thornber, yanwang, zkabelac
Target Milestone: rcKeywords: Triaged
Target Release: 7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 0.2.8-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1019217 Environment:
Last Closed: 2014-06-13 13:12:25 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: 1019217    
Bug Blocks:    

Comment 6 yanfu,wang 2013-12-05 06:07:33 UTC
Verified on device-mapper-persistent-data-0.2.8-2.el7:
# modprobe scsi_debug dev_size_mb=256 lbpu=1 lbpws10=1
# pvcreate /dev/sdn
# vgcreate vg /dev/sdn
# lvcreate -T -L20 -V10 -n LV1 vg/pool
# lvcreate -T -V10 -n LV2 vg/pool
# mkfs.ext2 /dev/vg/LV1
# mkfs.ext2 /dev/vg/LV2
# lvs -a vg
  LV              VG              Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert
  LV1             vg              Vwi-a-tz--  12.00m pool          5.21                          
  LV2             vg              Vwi-a-tz--  12.00m pool          5.21                          
  [lvol0_pmspare] vg              ewi-------   4.00m                                             
  pool            vg              twi-a-tz--  20.00m               6.25                          
  [pool_tdata]    vg              Twi-ao----  20.00m                                             
  [pool_tmeta]    vg              ewi-ao----   4.00m                                             

# lvchange -an vg/LV1
# lvchange -an vg/LV2
# lvchange -an vg/pool
# lvs -a vg

swap and dump metadata:
# lvcreate -n meta -L 8M vg
# lvconvert --poolmetadata vg/meta  --thinpool vg/pool
# lvchange -ay vg/meta
# thin_dump /dev/vg/meta >meta
# cat meta 
<superblock uuid="" time="0" transaction="2" data_block_size="128" nr_data_blocks="320">
  <device dev_id="1" mapped_blocks="10" transaction="0" creation_time="0" snap_time="0">
    <range_mapping origin_begin="0" data_begin="0" length="5" time="0"/>
    <range_mapping origin_begin="128" data_begin="5" length="4" time="0"/>
    <single_mapping origin_block="191" data_block="9" time="0"/>
  </device>
  <device dev_id="2" mapped_blocks="10" transaction="1" creation_time="0" snap_time="0">
    <range_mapping origin_begin="0" data_begin="10" length="5" time="0"/>
    <range_mapping origin_begin="128" data_begin="15" length="4" time="0"/>
    <single_mapping origin_block="191" data_block="19" time="0"/>
  </device>
</superblock> 

Single byte corruption in metadata:
# dd if=/dev/zero of=/dev/vg/meta bs=1 seek=40960 count=1
# thin_check /dev/vg/meta 
examining superblock
examining devices tree
examining mapping tree
  missing all mappings for devices: [3, -]
    bad checksum in btree node
  thin device 2 is missing mappings [3, 0]
    
[root@sun-x2270m2-01 ~]# echo $?
1
note: fixed version gives the correct 'failing' exit code now. 

# thin_dump /dev/vg/meta >meta2
metadata contains errors (run thin_check for details).
perhaps you wanted to run with --repair

repair metedata now:
# lvcreate -n fix -L 8M vg
# thin_repair -i /dev/vg/meta -o /dev/vg/fix
# echo $?
0
# thin_check /dev/vg/fix 
examining superblock
examining devices tree
examining mapping tree

Comment 7 Ludek Smid 2014-06-13 13:12:25 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.