diff options
-rw-r--r-- | fs/ocfs2/file.c | 7 |
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: | |||
1866 | written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos, | 1866 | written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos, |
1867 | ppos, count, ocount); | 1867 | ppos, count, ocount); |
1868 | if (written < 0) { | 1868 | if (written < 0) { |
1869 | /* | ||
1870 | * direct write may have instantiated a few | ||
1871 | * blocks outside i_size. Trim these off again. | ||
1872 | * Don't need i_size_read because we hold i_mutex. | ||
1873 | */ | ||
1874 | if (*ppos + count > inode->i_size) | ||
1875 | vmtruncate(inode, inode->i_size); | ||
1869 | ret = written; | 1876 | ret = written; |
1870 | goto out_dio; | 1877 | goto out_dio; |
1871 | } | 1878 | } |