[PATCH] mm/madvise.c: return 0 instead of read bytes after force_page_cache_readahead() succeeds.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



madvise_willneed() will return 0 when succeed, so need return 0 instead
of read bytes after force_page_cache_readahead() succeeds.

The related commit: "fee53ce mm/readahead.c: return the value which
force_page_cache_readahead() returns" causes this issue.

After modification, it can pass LTP common test (disable CONFIG_SWAP).
Although the original one also can pass LTP common test, still better
to fix it.


Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
---
 mm/madvise.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index dee8d46..3a739cd 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -220,6 +220,7 @@ static long madvise_willneed(struct vm_area_struct *vma,
 			     unsigned long start, unsigned long end)
 {
 	struct file *file = vma->vm_file;
+	int ret = 0;
 
 #ifdef CONFIG_SWAP
 	if (!file || mapping_cap_swap_backed(file->f_mapping)) {
@@ -247,8 +248,9 @@ static long madvise_willneed(struct vm_area_struct *vma,
 		end = vma->vm_end;
 	end = ((end - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 
-	return force_page_cache_readahead(file->f_mapping, file,
+	ret = force_page_cache_readahead(file->f_mapping, file,
 					start, end - start);
+	return ret < 0 ? ret : 0;
 }
 
 /*
-- 
1.7.7.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]