public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* sparse file handling bug in XFS
@ 2011-06-16 14:49 Sean Noonan
  2011-06-16 16:08 ` Eric Sandeen
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Noonan @ 2011-06-16 14:49 UTC (permalink / raw)
  To: 'linux-xfs@oss.sgi.com'
  Cc: Martin Bligh, Trammell Hudson, Ian Baum, Stephen Degler

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
0+1 records in
0+1 records out
29 bytes (29 B) copied, 0.00151976 s, 19.1 kB/s
  File: `sparse-file'
  Size: 4194333                   Blocks: 8          IO Block: 4096   regular file
Device: 6809h/26633d    Inode: 12153368    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2011-06-14 13:56:43.826251881 +0000
Modify: 2011-06-14 13:56:43.826251881 +0000
Change: 2011-06-14 13:56:43.826251881 +0000
0+1 records in
0+1 records out
29 bytes (29 B) copied, 0.00152104 s, 19.1 kB/s
  File: `sparse-file'
  Size: 4194333                   Blocks: 8192       IO Block: 4096   regular file
Device: 6809h/26633d    Inode: 12153368    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2011-06-14 13:56:43.826251881 +0000
Modify: 2011-06-14 13:56:43.834252062 +0000
Change: 2011-06-14 13:56:43.834252062 +0000


For more fun, it even happens if we explicitly remove the file in between!  (It looks like this is just because the recently freed inode is reused and not properly initialized.)

FILE=sparse-file-99; for x in gogo xfs; do rm -f $FILE; date | dd of=$FILE bs=1k seek=4096; stat $FILE; done
0+1 records in
0+1 records out
29 bytes (29 B) copied, 0.00151841 s, 19.1 kB/s
  File: `sparse-file-99'
  Size: 4194333                   Blocks: 8          IO Block: 4096   regular file
Device: 6809h/26633d    Inode: 12153371    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2011-06-14 14:03:37.933888145 +0000
Modify: 2011-06-14 14:03:37.937888543 +0000
Change: 2011-06-14 14:03:37.937888543 +0000
0+1 records in
0+1 records out
29 bytes (29 B) copied, 2.1681e-05 s, 1.3 MB/s
  File: `sparse-file-99'
  Size: 4194333                   Blocks: 8192       IO Block: 4096   regular file
Device: 6809h/26633d    Inode: 12153371    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2011-06-14 14:03:37.941888722 +0000
Modify: 2011-06-14 14:03:37.941888722 +0000
Change: 2011-06-14 14:03:37.941888722 +0000


Here is a run on ext3.  Notice how blocks stays at 16.
# for x in gogo xfs; do date | dd of=sparse-file bs=1k seek=4096; stat sparse-file; done
0+1 records in
0+1 records out
29 bytes (29 B) copied, 0.00603038 s, 4.8 kB/s
  File: `sparse-file'
  Size: 4194333   	Blocks: 16         IO Block: 4096   regular file
Device: 6805h/26629d	Inode: 24          Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2011-06-16 14:48:32.480750867 +0000
Modify: 2011-06-16 14:48:32.480750867 +0000
Change: 2011-06-16 14:48:32.480750867 +0000
0+1 records in
0+1 records out
29 bytes (29 B) copied, 0.00125449 s, 23.1 kB/s
  File: `sparse-file'
  Size: 4194333   	Blocks: 16         IO Block: 4096   regular file
Device: 6805h/26629d	Inode: 24          Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2011-06-16 14:48:32.480750867 +0000
Modify: 2011-06-16 14:48:32.492751347 +0000
Change: 2011-06-16 14:48:32.492751347 +0000

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-06-19 22:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-16 14:49 sparse file handling bug in XFS Sean Noonan
2011-06-16 16:08 ` Eric Sandeen
2011-06-16 17:33   ` Eric Sandeen
2011-06-16 17:57     ` Christoph Hellwig
2011-06-16 21:08       ` Eric Sandeen
2011-06-19 22:27         ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox