xfs
[Top] [All Lists]

Re: sparse file handling bug in XFS

To: Sean Noonan <Sean.Noonan@xxxxxxxxxxxx>
Subject: Re: sparse file handling bug in XFS
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 16 Jun 2011 11:08:22 -0500
Cc: "'linux-xfs@xxxxxxxxxxx'" <linux-xfs@xxxxxxxxxxx>, Martin Bligh <Martin.Bligh@xxxxxxxxxxxx>, Trammell Hudson <Trammell.Hudson@xxxxxxxxxxxx>, Ian Baum <Ian.Baum@xxxxxxxxxxxx>, Stephen Degler <Stephen.Degler@xxxxxxxxxxxx>
In-reply-to: <081DDE43F61F3D43929A181B477DCA95639B561F@xxxxxxxxxxxxxxxxxxxx>
References: <081DDE43F61F3D43929A181B477DCA95639B561F@xxxxxxxxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
On 6/16/11 9:49 AM, Sean Noonan wrote:
> Sparse files do not stay sparse.
> Here's the simplest test case I've got so far.  I don't think it can get much 
> simpler than this.
> 
> This did not exist in 2.6.36.  It appeared by 2.6.38-rc8.  It continued into 
> 2.6.38.2.  It continues to exist on 3.0.0-rc3.
> 
> # for x in gogo xfs; do date | dd of=sparse-file bs=1k seek=4096; stat 
> sparse-file; done

Funky; if we do xfs_bmap, it shows the right nr of blocks allocated:

# for x in gogo xfs; do date | dd of=sparse-file bs=1k seek=4096; stat 
sparse-file | grep Blocks; xfs_bmap -v sparse-file; done
  Size: 4194333         Blocks: 8          IO Block: 4096   regular file
sparse-file:
 EXT: FILE-OFFSET      BLOCK-RANGE          AG AG-OFFSET            TOTAL
   0: [0..8191]:       hole                                          8192
   1: [8192..8199]:    450475168..450475175  2 (18736320..18736327)     8

  Size: 4194333         Blocks: 8192       IO Block: 4096   regular file
sparse-file:
 EXT: FILE-OFFSET      BLOCK-RANGE          AG AG-OFFSET            TOTAL
   0: [0..8191]:       hole                                          8192
   1: [8192..8199]:    459367952..459367959  2 (27629104..27629111)     8


And if we unmount & remount it's right again:

# stat sparse-file | grep Blocks
  Size: 4194333         Blocks: 8          IO Block: 4096   regular file

so they do remain sparse, but stat tells us the wrong thing.  I think it has
to do with the count of delayed blocks but I'll try to look into it.

-Eric

<Prev in Thread] Current Thread [Next in Thread>