Bug 1020825 - Thin_check doesn't return error exit code for broken metadata
Summary: Thin_check doesn't return error exit code for broken metadata
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: device-mapper-persistent-data
Version: 7.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: 7.0
Assignee: Heinz Mauelshagen
QA Contact: yanfu,wang
URL:
Whiteboard:
Depends On: 1019217
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-18 10:52 UTC by Heinz Mauelshagen
Modified: 2021-09-03 12:07 UTC (History)
11 users (show)

Fixed In Version: 0.2.8-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1019217
Environment:
Last Closed: 2014-06-13 13:12:25 UTC
Target Upstream Version:


Attachments (Terms of Use)

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.


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