Bug 927541

Summary: filefrag: filefrag -v reports wrong extent count
Product: Red Hat Enterprise Linux 6 Reporter: Eryu Guan <eguan>
Component: e2fsprogsAssignee: Eric Sandeen <esandeen>
Status: CLOSED ERRATA QA Contact: Petr Beňas <pbenas>
Severity: low Docs Contact:
Priority: low    
Version: 6.4CC: esandeen, lnovich, pbenas, pstehlik, sct
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: e2fsprogs-1.41.12-15.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 22:43:46 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:

Description Eryu Guan 2013-03-26 07:35:20 UTC
Description of problem:
[root@hp-dl388g8-01 ~]# dd if=/dev/zero of=testfile bs=$block_size count=1 seek=$((2**32 - 2))
[root@hp-dl388g8-01 ~]# filefrag testfile
testfile: 1 extent found            <====== 1 extent in non-verbose mode
[root@hp-dl388g8-01 ~]# filefrag -v testfile
Filesystem type is: ef53
File size of testfile is 17592186040320 (4294967295 blocks, blocksize 4096)
 ext   logical physical expected length flags
   0 4294967294 11188222               1 eof
testfile: 2 extents found           <======= 2 extents in verbose mode

Version-Release number of selected component (if applicable):
e2fsprogs-1.41.12-14.el6

How reproducible:
always

Steps to Reproduce:
1.dd if=/dev/zero of=testfile bs=$block_size count=1 seek=$((2**32 - 2))
2.filefrag testfile
3.filefrag -v testfile
  
Actual results:
filefrag -v reports 2 extents for testfile

Expected results:
1 extent

Additional info:
e2fsprogs on RHEL7 doesn't have this issue, also e2fsprogs from F18

Comment 1 Eric Sandeen 2013-06-06 17:18:23 UTC
There are a lot of upstream filefrag fixes, I'll pull them all in w/ this bug.

339e457939bf1663ac2dbd52e47cd6e145726771 filefrag: fix segfault on virtual fs
036fda6d487737eac9be086d999b7480a81d37ea filefrag: fix report of number of extents
605cf6edaf6fce6a3810cda24c6ceca90af1a096 filefrag: fix infinite loop in filefrag
9c58eaf7d3a47d83945bd3756271e7ae675b25e1 filefrag: fix an off by one error in when printing the next expected block
a00be17e4768c5ce55f74be518f35f5d5d1b158b filefrag: Display the number of contiguous, not physical, extents
1e003cc77d43ee01eeaae962ff6d264c9a74a363 filefrag: Fix uninitialized "expected" value
a8d8432b584c222dc7960c15cd7b9acbc7c72352 filefrag: count 0 extents properly when verbose
b637f8e7ed4309ec39d87ea0cf07f48fc0610266 filefrag: remove useless assignment

Comment 7 Eric Sandeen 2013-06-26 15:18:32 UTC
One thing that should possibly be added to the test is a "sync" (or umount/remount) after creating the file which filefrag inspects.  Otherwise differences with respect to delayed allocation (which is all kernel behavior) may influence the test.

See how the answer changes after a sync for a freshly-created file:

[root@bp-05 tmp]# filefrag -v $mnt/testfile
Filesystem type is: ef53
File size of /mnt/bz927541/testfile is 17592186040320 (4294967295 blocks, blocksize 4096)
/mnt/bz927541/testfile: 0 extents found

[root@bp-05 tmp]# sync

[root@bp-05 tmp]# filefrag -v $mnt/testfile
Filesystem type is: ef53
File size of /mnt/bz927541/testfile is 17592186040320 (4294967295 blocks, blocksize 4096)
 ext   logical physical expected length flags
   0 4294967294     1550               1 eof
/mnt/bz927541/testfile: 2 extents found

Comment 8 Eric Sandeen 2013-06-26 15:27:48 UTC
I think that seeing 2 extents not one (above) was a local problem here; re-installing the brew-built packages, I see one extent as I should.

Adding syncs to the test will take kernelside delalloc behavior out of the mix, and I hope the test will pass.

Thanks,
-Eric

Comment 12 Petr Beňas 2013-08-13 09:31:14 UTC
Reproduced in e2fsprogs-1.41.12-14.el6.x86_64 and verified in e2fsprogs-1.41.12-15.el6.x86_64.

Comment 13 errata-xmlrpc 2013-11-21 22:43:46 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.

http://rhn.redhat.com/errata/RHBA-2013-1689.html