Skip to contentSkip to conversation

fs: ramfs: file-nommu: add SetPageUptodate()

PATCH New Bob Liu 1 participant 1 message Jun 27, 2012 Memory management

lore
Share & tools
lore

Bob Liu

author
#0 lore raw

PATCH 1/1 fs: ramfs: file-nommu: add SetPageUptodate()

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().

---
 fs/ramfs/file-nommu.c |    1 +
 1 file changed, 1 insertion(+)
fs/ramfs/file-nommu.c +1 -0
index fbb0b47..d5378d0 100644
@@ -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);
Signature · 8 lines
1.7.9.5


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