ext4: truncate the file properly if we fail to copy data from userspace
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Fri, 5 Jun 2009 04:56:49 +0000 (00:56 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 5 Jun 2009 04:56:49 +0000 (00:56 -0400)
commitf8514083cd61daef12fba5ef883ad9352c450428
tree46cbf0c28ea112229c3ee9209750c8017f1b9385
parent1938a150c25bf7c2c47182e753a1038945b70b0e
ext4: truncate the file properly if we fail to copy data from userspace

In generic_perform_write if we fail to copy the user data we don't
update the inode->i_size.  We should truncate the file in the above
case so that we don't have blocks allocated outside inode->i_size.  Add
the inode to orphan list in the same transaction as block allocation
This ensures that if we crash in between the recovery would do the
truncate.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
CC: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/inode.c