linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: ramfs: file-nommu: add SetPageUptodate()
@ 2012-06-27 14:55 Bob Liu
  0 siblings, 0 replies; only message in thread
From: Bob Liu @ 2012-06-27 14:55 UTC (permalink / raw)
  To: akpm; +Cc: hughd, dhowells, linux-mm, Bob Liu

There is a bug in below scene for platform !CONFIG_MMU:
1. create a new file
2. mmap the file and write to it
3. read the file can't get the correct value

Because
sys_read() > generic_file_aio_read() > simple_readpage() > clear_page()
which make the page be zeroed.

Add SetPageUptodate() to ramfs_nommu_expand_for_mapping() so that
generic_file_aio_read() do not call simple_readpage().

Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 fs/ramfs/file-nommu.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index fbb0b47..d5378d0 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -110,6 +110,7 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
 
 		/* prevent the page from being discarded on memory pressure */
 		SetPageDirty(page);
+		SetPageUptodate(page);
 
 		unlock_page(page);
 		put_page(page);
-- 
1.7.9.5


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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-06-27  6:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-27 14:55 [PATCH] fs: ramfs: file-nommu: add SetPageUptodate() Bob Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).