From: Jan Kara Date: Mon, 1 Mar 2010 13:02:37 +0000 (+0100) Subject: ext3: Truncate allocated blocks if direct IO write fails to update i_size X-Git-Tag: v2.6.34-rc1~192^2~10 X-Git-Url: http://ftp.safe.ca/?p=safe%2Fjmp%2Flinux-2.6;a=commitdiff_plain;h=7eb4969e04060dcf3fbd46af9c21b1059b853068 ext3: Truncate allocated blocks if direct IO write fails to update i_size We have to truncate blocks allocated to file during direct IO when we fail to update i_size properly. Signed-off-by: Jan Kara --- diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 44b5338..c0ff9d6 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c @@ -1785,8 +1785,9 @@ retry: handle = ext3_journal_start(inode, 2); if (IS_ERR(handle)) { /* This is really bad luck. We've written the data - * but cannot extend i_size. Bail out and pretend - * the write failed... */ + * but cannot extend i_size. Truncate allocated blocks + * and pretend the write failed... */ + ext3_truncate(inode); ret = PTR_ERR(handle); goto out; }