From: Dmitri Monakhov Date: Mon, 27 Oct 2008 20:01:49 +0000 (-0700) Subject: ocfs2: truncate outstanding block after direct io failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c435400140d24fbcb3da6b1e006be831f9056cb6;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.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 3138a385fdbb..e2570a3bc2b2 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; }