From 42fc8ef29618b0954124af98ddddd6cb85a810b3 Mon Sep 17 00:00:00 2001 From: Dmitri Monakhov Date: Mon, 27 Oct 2008 13:01:49 -0700 Subject: [PATCH] --- yaml --- r: 118749 b: refs/heads/master c: c435400140d24fbcb3da6b1e006be831f9056cb6 h: refs/heads/master i: 118747: 3f41a6c96f455ed09991063a791dcf4b10d96244 v: v3 --- [refs] | 2 +- trunk/fs/ocfs2/file.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 3566ed5549a2..6350cfd6735d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 80bcaf3469b8aefd316d4ceb27d9af7cfbb0b913 +refs/heads/master: c435400140d24fbcb3da6b1e006be831f9056cb6 diff --git a/trunk/fs/ocfs2/file.c b/trunk/fs/ocfs2/file.c index 3138a385fdbb..e2570a3bc2b2 100644 --- a/trunk/fs/ocfs2/file.c +++ b/trunk/fs/ocfs2/file.c @@ -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; }