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: v2.6.28-rc5~82^2~2 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c435400140d24fbcb3da6b1e006be831f9056cb6;p=linux-2.6-omap-h63xx.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 3138a385fdb..e2570a3bc2b 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; }