Bug 1020825 - Thin_check doesn't return error exit code for broken metadata
Thin_check doesn't return error exit code for broken metadata
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: device-mapper-persistent-data (Show other bugs)
7.0
Unspecified Unspecified
high Severity medium
: rc
: 7.0
Assigned To: Heinz Mauelshagen
yanfu,wang
:
Depends On: 1019217
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-18 06:52 EDT by Heinz Mauelshagen
Modified: 2014-06-18 01:09 EDT (History)
11 users (show)

See Also:
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 09:12:25 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)
Comment 6 yanfu,wang 2013-12-05 01:07:33 EST
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 09:12:25 EDT
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.

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