]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Tao Ma <tao.ma@oracle.com> |
2 | Date: Mon, 6 Oct 2008 16:59:55 +0800 | |
3 | Subject: ocfs2: return 0 in page_mkwrite to let VFS retry. | |
4 | ||
5 | In ocfs2_page_mkwrite, we return -EINVAL when we found the page mapping | |
6 | isn't updated, and it will cause the user space program get SIGBUS and | |
7 | exit. The reason is that during race writeable mmap, we will do | |
8 | unmap_mapping_range in ocfs2_data_downconvert_worker. The good thing is | |
9 | that if we reuturn 0 in page_mkwrite, VFS will retry fault and then | |
10 | call page_mkwrite again, so it is safe to return 0 here. | |
11 | ||
12 | Signed-off-by: Tao Ma <tao.ma@oracle.com> | |
13 | Signed-off-by: Mark Fasheh <mfasheh@suse.com> | |
14 | --- | |
15 | fs/ocfs2/mmap.c | 6 +++++- | |
16 | 1 files changed, 5 insertions(+), 1 deletions(-) | |
17 | ||
18 | Index: linux-2.6.27-ocfs2/fs/ocfs2/mmap.c | |
19 | =================================================================== | |
20 | --- linux-2.6.27-ocfs2.orig/fs/ocfs2/mmap.c | |
21 | +++ linux-2.6.27-ocfs2/fs/ocfs2/mmap.c | |
22 | @@ -113,7 +113,11 @@ static int __ocfs2_page_mkwrite(struct i | |
23 | * ocfs2_write_begin_nolock(). | |
24 | */ | |
25 | if (!PageUptodate(page) || page->mapping != inode->i_mapping) { | |
26 | - ret = -EINVAL; | |
27 | + /* | |
28 | + * the page has been umapped in ocfs2_data_downconvert_worker. | |
29 | + * So return 0 here and let VFS retry. | |
30 | + */ | |
31 | + ret = 0; | |
32 | goto out; | |
33 | } | |
34 |