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 1641023

Summary: xfsprogs xfs_copy does not allow V5 XFS_ABTB_CRC_MAGIC
Product: Red Hat Enterprise Linux 7 Reporter: Lukas Herbolt <lherbolt>
Component: xfsprogsAssignee: Eric Sandeen <esandeen>
Status: CLOSED ERRATA QA Contact: Zorro Lang <zlang>
Severity: unspecified Docs Contact:
Priority: high    
Version: 7.5CC: esandeen, lherbolt, rhandlin, saime, swhiteho, xzhou
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1676459 (view as bug list) Environment:
Last Closed: 2019-08-06 13:06:18 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:    
Bug Blocks: 1577173, 1676459    
Attachments:
Description Flags
customers metadata dump none

Description Lukas Herbolt 2018-10-19 12:59:48 UTC
Created attachment 1495633 [details]
customers metadata dump

Description of problem: While switching to V5 with CRC there is new magic bno tree. This magic is not recognized by the xfs_copy as it check only the old 
one. And it ends on assert.


Version-Release number of selected component (if applicable):
xfsprogs-4.5.0-12.el7 (from CU )
xfsprogs-4.5.0-18.el7 (checked the code)


How reproducible:
I did not manage to reproduce it on V5 XFS but I have CUs metadata where 
it is reproducible. Attached to the bugzilla in case I am wrong.

Actual results:
The xfs_copy is interrupted on assert.


Expected results:
xfs_copy finishes successfully


Additional info:
xfsprogs upstream fix:

d0ca5d8 xfs_copy: accept CRC version of ABTB_MAGIC in ASSERT.

[lherbolt@smurf xfsprogs-dev]Φ git show d0ca5d8
commit d0ca5d8a3875a423b522ee9767cbeb3d47bed420
Author: Eric Sandeen <sandeen>
Date:   Thu Jan 25 13:55:01 2018 -0600

    xfs_copy: accept CRC version of ABTB_MAGIC in ASSERT
    
    Not sure how this was missed for so long, but to handle CRC
    filesystems, this ASSERT on block magic must accept CRC magic
    as well.
    
    Reported-by: Radek Burkat <radek>
    Signed-off-by: Eric Sandeen <sandeen>
    Reviewed-by: Darrick J. Wong <darrick.wong>
    Reviewed-by: Bill O'Donnell <billodo>
    Signed-off-by: Eric Sandeen <sandeen>

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index fb37375..16ee4d9 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -1140,7 +1140,8 @@ main(int argc, char **argv)
                                 ((char *) btree_buf.data +
                                  pos - btree_buf.position);
 
-                       ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC);
+                       ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC ||
+                              be32_to_cpu(block->bb_magic) == XFS_ABTB_CRC_MAGIC);
                }
 
                /*

Comment 9 Eric Sandeen 2019-02-11 18:07:24 UTC
Built in xfsprogs-4.5.0-19.el7

Comment 12 Zorro Lang 2019-04-06 03:26:03 UTC
Reproduced on xfsprogs-4.5.0-15.el7.x86_64:
QA output created by 503
Format and populate
metadump
metadump a
metadump g
metadump ag
copy
xfs_copy: xfs_copy.c:1131: main: Assertion '((__builtin_constant_p((__u32)(( __u32)(__be32)(block->bb_magic))) ? ((__u32)( (((__u32)((( __u32)(__be32)(block->bb_magic))) & (__u32)0x000000ffUL) << 24) | (((__u32)((( __u32)(__be32)(block->bb_magic))) & (__u32)0x0000ff00UL) << 8) | (((__u32)((( __u32)(__be32)(block->bb_magic))) & (__u32)0x00ff0000UL) >> 8) | (((__u32)((( __u32)(__be32)(block->bb_magic))) & (__u32)0xff000000UL) >> 24) )) : __fswab32((( __u32)(__be32)(block->bb_magic))))) == 0x41425442' failed.
./tests/xfs/503: line 62:  4245 Aborted                 $XFS_COPY_PROG $SCRATCH_DEV $copy_file >> $seqres.full
Metadata CRC error detected at xfs_agf block 0x500001/0x200
xfs_check: cannot init perag data (-74). Continuing anyway.
totally zeroed log
Metadata CRC error detected at xfs_sb block 0x0/0x200
bad magic number
bad magic number
bad magic number
cache_purge: shake on cache 0x1f1a0a0 left 3 nodes!?
_check_xfs_filesystem: filesystem on /mnt/test/test-503/copy.img is inconsistent (c)
(see /root/git/xfstests-dev/results//xfs/503.full for details)
_check_xfs_filesystem: filesystem on /mnt/test/test-503/copy.img is inconsistent (r)
(see /root/git/xfstests-dev/results//xfs/503.full for details)

Test passed on xfsprogs 20.el7
# rpm -q xfsprogs
xfsprogs-4.5.0-20.el7.x86_64
# ./check xfs/503
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 ibm-x3550m3-05 3.10.0-1035.el7.x86_64.debug
MKFS_OPTIONS  -- -f -m crc=1,finobt=1 /dev/sdb2
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sdb2 /mnt/scratch

xfs/503 38s ...  403s
Ran: xfs/503
Passed all 1 tests

Comment 14 errata-xmlrpc 2019-08-06 13:06:18 UTC
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/RHBA-2019:2216