Bug 1104956
| Summary: | xfs_copy will make a corrupted target when source sector is over 512 | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Junxiao Bi <junxiao.bi> | |
| Component: | xfsprogs | Assignee: | Eric Sandeen <esandeen> | |
| Status: | CLOSED ERRATA | QA Contact: | Eryu Guan <eguan> | |
| Severity: | high | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 6.5 | CC: | eguan, sau289 | |
| Target Milestone: | rc | |||
| Target Release: | --- | |||
| Hardware: | All | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | xfsprogs-3.1.1-16.el6 | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1105170 (view as bug list) | Environment: | ||
| Last Closed: | 2014-10-14 07:49:58 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: | 1105170 | |||
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. I hit the hang as well on xfsprogs-3.1.1-14.el6.x86_64; the latest package (xfsprogs-3.1.1-16.el6.x86_64) works fine with your testcase. thanks, -Eric Verified with /kernel/filesystems/xfs/1104956-xfs_copy-corrupt, test passed and there was no hang with xfsprogs-3.1.1-16.el6 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: