Skip to content

Commit

Permalink
ocfs2: truncate outstanding block after direct io failure
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitri Monakhov <dmonakhov@openvz.org>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Mark Fasheh <mark.fasheh@oracle.com>
Cc: Joel Becker <Joel.Becker@oracle.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
  • Loading branch information
Dmitri Monakhov authored and Mark Fasheh committed Nov 10, 2008
1 parent 80bcaf3 commit c435400
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,13 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos,
ppos, count, ocount);
if (written < 0) {
/*
* direct write may have instantiated a few
* blocks outside i_size. Trim these off again.
* Don't need i_size_read because we hold i_mutex.
*/
if (*ppos + count > inode->i_size)
vmtruncate(inode, inode->i_size);
ret = written;
goto out_dio;
}
Expand Down

0 comments on commit c435400

Please sign in to comment.