]> Pileus Git - ~andy/linux/commit
Btrfs: fix the file extent gap when doing direct IO
authorMiao Xie <miaox@cn.fujitsu.com>
Sun, 11 Sep 2011 14:52:24 +0000 (10:52 -0400)
committerChris Mason <chris.mason@oracle.com>
Sun, 11 Sep 2011 14:52:24 +0000 (10:52 -0400)
commit0c1a98c81413e00a6c379d898e06a09350d31926
tree6f92bcd7954fc8131197ccca25b94a3a88dbb368
parent5b397377e97d436fc2ed872fc53f85395bb984e0
Btrfs: fix the file extent gap when doing direct IO

When we write some data to the place that is beyond the end of the file
in direct I/O mode, a data hole will be created. And Btrfs should insert
a file extent item that point to this hole into the fs tree. But unfortunately
Btrfs forgets doing it.

The following is a simple way to reproduce it:
 # mkfs.btrfs /dev/sdc2
 # mount /dev/sdc2 /test4
 # touch /test4/a
 # dd if=/dev/zero of=/test4/a seek=8 count=1 bs=4K oflag=direct conv=nocreat,notrunc
 # umount /test4
 # btrfsck /dev/sdc2
 root 5 inode 257 errors 100

Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Tested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/file.c