Bug 1477232 - Unable to restore metadata from metadata snapshot (thin_dump -m -> thin_restore)
Unable to restore metadata from metadata snapshot (thin_dump -m -> thin_restore)
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: device-mapper-persistent-data (Show other bugs)
7.4
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: LVM and device-mapper development team
Jakub Krysl
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-01 10:13 EDT by Jakub Krysl
Modified: 2017-08-01 10:13 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
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 Jakub Krysl 2017-08-01 10:13:04 EDT
Description of problem:
Not able to restore swapped metadata dumped by thin_dump from metadata snapshot created by dmsetup message. 

[root@storageqe-21 thin]# thin_check /dev/mapper/vgtest-swapvol 
examining superblock
examining devices tree
examining mapping tree
checking space map counts
[root@storageqe-21 thin]# thin_dump /dev/mapper/vgtest-swapvol -o metadata
[root@storageqe-21 thin]# thin_dump /dev/mapper/vgtest-swapvol -o metadata_snap -m
[root@storageqe-21 thin]# thin_restore -i metadata -o /dev/mapper/vgtest-swapvol 
Restoring: [==================================================]   100%
[root@storageqe-21 thin]# thin_restore -i metadata_snap -o /dev/mapper/vgtest-swapvol 
Restoring: [>                                                 ] | 0%
mapping beyond end of data device (0 >= 0)

[root@storageqe-21 thin]# diff metadata metadata_snap 
1c1
< <superblock uuid="" time="0" transaction="10" flags="0" version="2" data_block_size="128" nr_data_blocks="1600">
---
> <superblock uuid="" time="0" transaction="10" flags="0" version="2" data_block_size="128" nr_data_blocks="0">

The only difference between the metadata is in "nr_data_blocks", where in regular it is 1600 and in snapshot 0.


Version-Release number of selected component (if applicable):
device-mapper-persistent-data-0.7.0-0.1.rc6.el7

How reproducible:
100%

Steps to Reproduce:
1. get swapped metadata with metadata snapshot
vgcreate  vgtest /dev/loop1
lvcreate -T -L 100 vgtest -n thinpool
lvcreate -T -V 10 vgtest/thinpool -n thinvol
mkfs.ext4 /dev/vgtest/thinvol
lvchange -an vgtest/thinvol
lvcreate -T -V 10 vgtest/thinpool -n thinvol1
mkfs.ext4 /dev/vgtest/thinvol1
lvchange -an vgtest/thinvol1
dmsetup suspend /dev/mapper/vgtest-swapvol-tpool
dmsetup message /dev/mapper/vgtest-swapvol-tpool 0 reserve_metadata_snap
dmsetup resume /dev/mapper/vgtest-swapvol-tpool
lvchange -an vgtest/thinpool
lvcreate -L 100 vgtest -n swapvol
lvchange -an vgtest/swapvol
lvconvert -y --thinpool vgtest/thinpool --poolmetadata  vgtest/swapvol
lvchange -ay vgtest/swapvol

2.dump metadata snapshot
thin_dump /dev/mapper/vgtest-swapvol -o metadata_snap

3.try to restore metadata
thin_restore -i metadata_snap -o /dev/mapper/vgtest-swapvol

Actual results:
Restoring: [>                                                 ] | 0%
mapping beyond end of data device (0 >= 0)

Expected results:
Restoring: [==================================================]   100%

Additional info:
Even though thin_dump manpage says it is not processable by thin_restore, this is quite important feature as the metadata might be corrupted but the metadata snapshot could be OK. For this reason both metadata dump and metadata snapshot dump should be restorable even though restoring either leads to loosing the metadata snapshot.

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