ext4: Fix the alloc on close after a truncate hueristic
commita6c92a88b556da1073e03d6936ae70c2c045421c
authorTheodore Ts'o <tytso@mit.edu>
Thu, 17 Sep 2009 13:34:16 +0000 (17 09:34 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Dec 2009 16:06:52 +0000 (14 08:06 -0800)
tree87061c9b577fb0d476c3fef783014b80cee837ca
parent1f51991dec0bd679d172b55a86d54ca3f6227c51
ext4: Fix the alloc on close after a truncate hueristic

(cherry picked from commit 5534fb5bb35a62a94e0bd1fa2421f7fb6e894f10)

In an attempt to avoid doing an unneeded flush after opening a
(previously non-existent) file with O_CREAT|O_TRUNC, the code only
triggered the hueristic if ei->disksize was non-zero.  Turns out that
the VFS doesn't call ->truncate() if the file doesn't exist, and
ei->disksize is always zero even if the file previously existed.  So
remove the test, since it isn't necessary and in fact disabled the
hueristic.

Thanks to Clemens Eisserer that he was seeing problems with files
written using kwrite and eclipse after sudden crashes caused by a
buggy Intel video driver.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext4/inode.c