All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] ocfs2/mmap: return 0 in page_mkwrite to let VFS retry.
@ 2008-10-06  8:59 Tao Ma
  2008-10-06 17:15 ` Sunil Mushran
  0 siblings, 1 reply; 2+ messages in thread
From: Tao Ma @ 2008-10-06  8:59 UTC (permalink / raw)
  To: ocfs2-devel

In ocfs2_page_mkwrite, we return -EINVAL when we found the page mapping
isn't updated, and it will cause the user space program get SIGBUS and
exit. The reason is that during race writeable mmap, we will do
unmap_mapping_range in ocfs2_data_downconvert_worker. The good thing is
that if we reuturn 0 in page_mkwrite, VFS will retry fault and then
call page_mkwrite again, so it is safe to return 0 here.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
---
 fs/ocfs2/mmap.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
index 3dc18d6..eea1d24 100644
--- a/fs/ocfs2/mmap.c
+++ b/fs/ocfs2/mmap.c
@@ -113,7 +113,11 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
 	 * ocfs2_write_begin_nolock().
 	 */
 	if (!PageUptodate(page) || page->mapping != inode->i_mapping) {
-		ret = -EINVAL;
+		/*
+		 * the page has been umapped in ocfs2_data_downconvert_worker.
+		 * So return 0 here and let VFS retry.
+		 */
+		ret = 0;
 		goto out;
 	}
 
-- 
1.5.3.6.861.gd794-dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Ocfs2-devel] [PATCH] ocfs2/mmap: return 0 in page_mkwrite to let VFS retry.
  2008-10-06  8:59 [Ocfs2-devel] [PATCH] ocfs2/mmap: return 0 in page_mkwrite to let VFS retry Tao Ma
@ 2008-10-06 17:15 ` Sunil Mushran
  0 siblings, 0 replies; 2+ messages in thread
From: Sunil Mushran @ 2008-10-06 17:15 UTC (permalink / raw)
  To: ocfs2-devel

Tao,

Please can you attach this to the bugzilla.
http://oss.oracle.com/bugzilla/show_bug.cgi?id=1019

Easier to track fixes.

Thanks
Sunil

Tao Ma wrote:
> In ocfs2_page_mkwrite, we return -EINVAL when we found the page mapping
> isn't updated, and it will cause the user space program get SIGBUS and
> exit. The reason is that during race writeable mmap, we will do
> unmap_mapping_range in ocfs2_data_downconvert_worker. The good thing is
> that if we reuturn 0 in page_mkwrite, VFS will retry fault and then
> call page_mkwrite again, so it is safe to return 0 here.
>
> Signed-off-by: Tao Ma <tao.ma@oracle.com>
> ---
>  fs/ocfs2/mmap.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c
> index 3dc18d6..eea1d24 100644
> --- a/fs/ocfs2/mmap.c
> +++ b/fs/ocfs2/mmap.c
> @@ -113,7 +113,11 @@ static int __ocfs2_page_mkwrite(struct inode *inode, struct buffer_head *di_bh,
>  	 * ocfs2_write_begin_nolock().
>  	 */
>  	if (!PageUptodate(page) || page->mapping != inode->i_mapping) {
> -		ret = -EINVAL;
> +		/*
> +		 * the page has been umapped in ocfs2_data_downconvert_worker.
> +		 * So return 0 here and let VFS retry.
> +		 */
> +		ret = 0;
>  		goto out;
>  	}
>  
>   

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-06 17:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-06  8:59 [Ocfs2-devel] [PATCH] ocfs2/mmap: return 0 in page_mkwrite to let VFS retry Tao Ma
2008-10-06 17:15 ` Sunil Mushran

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.