summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitri Monakhov <dmonakhov@openvz.org>2008-10-27 13:01:49 -0700
committerMark Fasheh <mfasheh@suse.com>2008-11-10 09:51:47 -0800
commitc435400140d24fbcb3da6b1e006be831f9056cb6 (patch)
tree6f90cad133521a2a4d52a57149a41199bdf89367
parent80bcaf3469b8aefd316d4ceb27d9af7cfbb0b913 (diff)
downloadlinux-c435400140d24fbcb3da6b1e006be831f9056cb6.tar.gz
linux-c435400140d24fbcb3da6b1e006be831f9056cb6.tar.bz2
linux-c435400140d24fbcb3da6b1e006be831f9056cb6.zip
ocfs2: truncate outstanding block after direct io failure
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>
-rw-r--r--fs/ocfs2/file.c7
1 files changed, 7 insertions, 0 deletions
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;
}