Skip to content

Commit

Permalink
ext3: Truncate allocated blocks if direct IO write fails to update i_…
Browse files Browse the repository at this point in the history
…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 <jack@suse.cz>
  • Loading branch information
Jan Kara committed Mar 4, 2010
1 parent ab94c39 commit 7eb4969
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/ext3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1785,8 +1785,9 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
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;
}
Expand Down

0 comments on commit 7eb4969

Please sign in to comment.