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.
Description of problem:
1. mkfs a xfs filesystem on some device to make its sector over 512 and put some file in it
mkfs.xfs -f -s size=4096 $SCRATCH_DEV
2. xfs_copy $SCRATCH_DEV to $target
xfs_copy $SCRATCH_DEV $target
$target is corrupted, and can't be mounted.
The following patch fix it.
From ffe9a9a81b58ac84158eb566b403212eb0646048 Mon Sep 17 00:00:00 2001
From: Junxiao Bi <junxiao.bi>
Date: Wed, 28 May 2014 11:15:54 +0800
Subject: [PATCH] xfsprogs: xfs_copy: fix data corruption of target
The unit of XFS_AGFL_DADDR(mp) is "basic block" whose size is "BBSIZE"
(512 bytes), so when "source_sectorsize" is not 512, it will cause the
target a corrupted filesystem.
Signed-off-by: Junxiao Bi <junxiao.bi>
Reviewed-by: Christoph Hellwig <hch>
---
copy/xfs_copy.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 39bb9d7..6b3396d 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -687,7 +687,7 @@ main(int argc, char **argv)
if (source_blocksize > source_sectorsize) {
/* get number of leftover sectors in last block of ag header */
- tmp_residue = ((XFS_AGFL_DADDR(mp) + 1) * source_sectorsize)
+ tmp_residue = ((XFS_AGFL_DADDR(mp) + 1) * BBSIZE)
% source_blocksize;
first_residue = (tmp_residue == 0) ? 0 :
source_blocksize - tmp_residue;
@@ -700,10 +700,10 @@ main(int argc, char **argv)
exit(1);
}
- first_agbno = (((XFS_AGFL_DADDR(mp) + 1) * source_sectorsize)
+ first_agbno = (((XFS_AGFL_DADDR(mp) + 1) * BBSIZE)
+ first_residue) / source_blocksize;
ASSERT(first_agbno != 0);
- ASSERT( ((((XFS_AGFL_DADDR(mp) + 1) * source_sectorsize)
+ ASSERT(((((XFS_AGFL_DADDR(mp) + 1) * BBSIZE)
+ first_residue) % source_blocksize) == 0);
/* now open targets */
--
1.7.1
Version-Release number of selected component (if applicable):
3.1.11
How reproducible:
Steps to Reproduce:
1.
2.
3.
Actual results:
Expected results:
Additional info:
xfs_copy seems take forever (24 hours now, but can be killed) to finish when I test on RHEL6/5 (haven't looked into why)
The script is simple
fallocate -l 1g fs.img
loopdev=`losetup --show -f fs.img`
mkfs -t xfs -s size=4096 $loopdev
mount $loopdev /mnt/xfs
echo "hello world" >/mnt/xfs/testfile
umount /mnt/xfs
xfs_copy $loopdev xfs.img
Note to QE, I've disabled this subtest on RHEL6/5 in test case /kernel/filesystems/xfs/1104956-xfs_copy-corrupt, so it won't hang the whole xfs regression test, please verify this fix manually. And please don't forget to update the test case once this issue is fixed.
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.
http://rhn.redhat.com/errata/RHBA-2014-1564.html
Description of problem: 1. mkfs a xfs filesystem on some device to make its sector over 512 and put some file in it mkfs.xfs -f -s size=4096 $SCRATCH_DEV 2. xfs_copy $SCRATCH_DEV to $target xfs_copy $SCRATCH_DEV $target $target is corrupted, and can't be mounted. The following patch fix it. From ffe9a9a81b58ac84158eb566b403212eb0646048 Mon Sep 17 00:00:00 2001 From: Junxiao Bi <junxiao.bi> Date: Wed, 28 May 2014 11:15:54 +0800 Subject: [PATCH] xfsprogs: xfs_copy: fix data corruption of target The unit of XFS_AGFL_DADDR(mp) is "basic block" whose size is "BBSIZE" (512 bytes), so when "source_sectorsize" is not 512, it will cause the target a corrupted filesystem. Signed-off-by: Junxiao Bi <junxiao.bi> Reviewed-by: Christoph Hellwig <hch> --- copy/xfs_copy.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index 39bb9d7..6b3396d 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -687,7 +687,7 @@ main(int argc, char **argv) if (source_blocksize > source_sectorsize) { /* get number of leftover sectors in last block of ag header */ - tmp_residue = ((XFS_AGFL_DADDR(mp) + 1) * source_sectorsize) + tmp_residue = ((XFS_AGFL_DADDR(mp) + 1) * BBSIZE) % source_blocksize; first_residue = (tmp_residue == 0) ? 0 : source_blocksize - tmp_residue; @@ -700,10 +700,10 @@ main(int argc, char **argv) exit(1); } - first_agbno = (((XFS_AGFL_DADDR(mp) + 1) * source_sectorsize) + first_agbno = (((XFS_AGFL_DADDR(mp) + 1) * BBSIZE) + first_residue) / source_blocksize; ASSERT(first_agbno != 0); - ASSERT( ((((XFS_AGFL_DADDR(mp) + 1) * source_sectorsize) + ASSERT(((((XFS_AGFL_DADDR(mp) + 1) * BBSIZE) + first_residue) % source_blocksize) == 0); /* now open targets */ -- 1.7.1 Version-Release number of selected component (if applicable): 3.1.11 How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: