sparse file handling bug in XFS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux