]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Dmitri Monakhov <dmonakhov@openvz.org> |
2 | Date: Mon, 27 Oct 2008 13:01:49 -0700 | |
3 | Subject: ocfs2: truncate outstanding block after direct io failure | |
4 | ||
5 | Signed-off-by: Dmitri Monakhov <dmonakhov@openvz.org> | |
6 | Cc: Jeff Moyer <jmoyer@redhat.com> | |
7 | Cc: Mark Fasheh <mark.fasheh@oracle.com> | |
8 | Cc: Joel Becker <Joel.Becker@oracle.com> | |
9 | Cc: Nick Piggin <nickpiggin@yahoo.com.au> | |
10 | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> | |
11 | Signed-off-by: Mark Fasheh <mfasheh@suse.com> | |
12 | --- | |
13 | fs/ocfs2/file.c | 7 +++++++ | |
14 | 1 files changed, 7 insertions(+), 0 deletions(-) | |
15 | ||
16 | Index: linux-2.6.27-ocfs2/fs/ocfs2/file.c | |
17 | =================================================================== | |
18 | --- linux-2.6.27-ocfs2.orig/fs/ocfs2/file.c | |
19 | +++ linux-2.6.27-ocfs2/fs/ocfs2/file.c | |
20 | @@ -1866,6 +1866,13 @@ relock: | |
21 | written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos, | |
22 | ppos, count, ocount); | |
23 | if (written < 0) { | |
24 | + /* | |
25 | + * direct write may have instantiated a few | |
26 | + * blocks outside i_size. Trim these off again. | |
27 | + * Don't need i_size_read because we hold i_mutex. | |
28 | + */ | |
29 | + if (*ppos + count > inode->i_size) | |
30 | + vmtruncate(inode, inode->i_size); | |
31 | ret = written; | |
32 | goto out_dio; | |
33 | } |