lkml.org 
[lkml]   [2009]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] vfs: fix find_lock_page_retry() return value parsing
find_lock_page_retry() won't touch the *ppage value when returning
VM_FAULT_RETRY. This is fine except for the case

if (VM_RandomReadHint())
goto no_cached_page;
where the 'page' could be undefined after calling find_lock_page_retry().

Fix it by checking the VM_FAULT_RETRY case first.

Cc: Ying Han <yinghan@google.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
mm/filemap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- mm.orig/mm/filemap.c
+++ mm/mm/filemap.c
@@ -759,7 +759,7 @@ EXPORT_SYMBOL(find_lock_page);
* @retry: 1 indicate caller tolerate a retry.
*
* If retry flag is on, and page is already locked by someone else, return
- * a hint of retry.
+ * a hint of retry and leave *ppage untouched.
*
* Return *ppage==NULL if page is not in pagecache. Otherwise return *ppage
* points to the page in the pagecache with ret=VM_FAULT_RETRY indicate a
@@ -1672,10 +1672,10 @@ no_cached_page:

retry_ret = find_lock_page_retry(mapping, vmf->pgoff,
vma, &page, retry_flag);
+ if (retry_ret == VM_FAULT_RETRY)
+ return retry_ret;
if (!page)
goto retry_find_nopage;
- else if (retry_ret == VM_FAULT_RETRY)
- return retry_ret;
else
goto retry_page_update;
}

\
 
 \ /
  Last update: 2009-04-03 10:25    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site