Bug 1478039
Summary: | cache_check reports corrupt superblock on good cache_dump metadata | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Jakub Krysl <jkrysl> | ||||
Component: | device-mapper-persistent-data | Assignee: | Joe Thornber <thornber> | ||||
Status: | CLOSED ERRATA | QA Contact: | Jakub Krysl <jkrysl> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 7.4 | CC: | agk, heinzm, lvm-team, mcsontos, msnitzer, thornber | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | device-mapper-persistent-data-0.7.3-2.el7 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2018-04-10 13:17:29 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: | |||||||
Attachments: |
|
Description
Jakub Krysl
2017-08-03 13:23:38 UTC
There are two metadata formats: - The binary format that the kernel uses. - An xml format that's generated by thin_dump and used by thin_restore. thin_check runs on the binary metadata. You are running it on the xml. Joe, this information is not stated in manpage nor in --help of thin_check / cache_check. So for user there is no way to know it and leads to confusion, as both sources simply state "metadata". So for now maybe just state "metadata in binary format" to quickly fix this. Also what is the reasoning for it to work on file in binary format only? Thanks The man pages for thin_dump and thin_restore both discuss the XML format. Only these tools use the xml format. thin_check is the equivalent of the fsck tool for filesystems; it checks the metadata that kernel is generating. I'll update thin_check to print a helpful message if the superblock is corrupt, and it begins with "<superblock ..." This patch tries to spot accidental use of XML. https://github.com/jthornber/thin-provisioning-tools/commit/b10d8d4440cc69e159e7db225dbbb5c21df7e5aa New release in the next few days. I found no change in cache_check behaviour, still reports bad checksum in superblock on cache_dumped correct metadata. Attaching dumped metadata as a reference. # cache_check -V 0.7.2-1.el7 # cache_check /dev/mapper/vgtest-swapvol examining superblock examining mapping array examining hint array examining discard bitset # cache_dump /dev/mapper/vgtest-swapvol -o /tmp/metadata # cache_check /tmp/metadata examining superblock superblock is corrupt bad checksum in superblock # cache_restore -i /tmp/metadata -o /dev/mapper/vgtest-swapvol Restoring: [==================================================] 100% # cache_check /dev/mapper/vgtest-swapvol examining superblock examining mapping array examining hint array examining discard bitset Created attachment 1329584 [details]
dumped metadata
It's correct to say there's a bad checksum in the superblock, you've given it XML after all. It's not crashing as some tools were when given an XML file. I'm not going to make any further changes. The patch in Comment 5 is modifying only thin_check. And the test suite suggests it is correct. The same change in other tools would be helpful. See pull request https://github.com/jthornber/thin-provisioning-tools/pull/86 BTW, I also noticed other *_check tools are checking magic number and version, size, etc, but seems to me thin_check is not. Shall I open an issue or BZ? Tested device-mapper-persistent-data-0.7.0-0.1.rc6.el7.x86_64 ('before') vs device-mapper-persistent-data-0.7.3-1.el7.x86_64 ('after'). before: # thin_dump /dev/mapper/vgtest-swapvol -o meta # thin_check meta examining superblock superblock is corrupt block out of bounds (0 >= 0) after: # thin_dump /dev/mapper/vgtest-swapvol -o meta # thin_check meta Metadata device/file too small. Is this binary metadata? before: # cache_dump /dev/mapper/vgtest-swapvol -o meta # cache_check meta examining superblock superblock is corrupt bad checksum in superblock after: # cache_dump /dev/mapper/vgtest-swapvol -o meta # cache_check meta examining superblock superblock is corrupt bad checksum in superblock It looks like it does not get to check_for_xml() as the return is not "This looks like XML. thin_check only checks the binary metadata format." but "Metadata device/file too small. Is this binary metadata?" even though the file starts with '<superblock'. I checked the code and to get past the size 'return FATAL;' I tried creating 20MB random file with dd and added '<superblock' to the beginning: # thin_check metadata examining superblock superblock is corrupt bad checksum in superblock, wanted 105687546 This looks like XML. thin_check only checks the binary metadata format. This time I got to check_for_xml() and it returned True, but only for thin_check. So not even thin_check is fixed in 0.7.3-1, and I can't see any change to cache_check. Marian is your patch in 0.7.3-1? Sorry, I can't in good conscience set this to VERIFIED as of yet. There were two issues: 1. tools could segfault with small metadata, and 2. unexpected XML input resulted in cryptic error. Small metadata issue: a whole block is expected and if size is smaller than the minimum expected, there is no parsing and error is reported straight away. Only if size is at least one block, the super-block is parsed. And only if parsing fails, it is checked if it is XML. It would be possible to check XML if input is too small, but IMHO this is very unlikely to ever happen in production and both issues are fixed with reasonable message. Fixed in device-mapper-persistent-data-0.7.3-2.el7. # cache_check meta examining superblock superblock is corrupt bad checksum in superblock This looks like XML. cache_check only checks the binary metadata format. FYI: There is different behaviour between cache_check and thin_check: # thin_dump /dev/mapper/vgtest-swapvol -o meta # thin_check meta Metadata device/file too small. Is this binary metadata? As this bug is about cache_check and it is fixed, setting to verified. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2018:0776 |