From: Dmitri Monakhov Date: Mon, 27 Oct 2008 20:01:49 +0000 (-0700) Subject: ocfs2: truncate outstanding block after direct io failure X-Git-Tag: upstream/snapshot3+hdmi~21565^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c435400140d24fbcb3da6b1e006be831f9056cb6;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git ocfs2: truncate outstanding block after direct io failure Signed-off-by: Dmitri Monakhov Cc: Jeff Moyer Cc: Mark Fasheh Cc: Joel Becker Cc: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Mark Fasheh --- diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 3138a38..e2570a3 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1866,6 +1866,13 @@ relock: 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; }