aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/mm.h1
-rw-r--r--mm/filemap.c19
-rw-r--r--mm/filemap_xip.c1
3 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b36d08ce5c57..15987d8e1d59 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1411,6 +1411,7 @@ extern void truncate_inode_pages_range(struct address_space *,
1411 1411
1412/* generic vm_area_ops exported for stackable file systems */ 1412/* generic vm_area_ops exported for stackable file systems */
1413extern int filemap_fault(struct vm_area_struct *, struct vm_fault *); 1413extern int filemap_fault(struct vm_area_struct *, struct vm_fault *);
1414extern int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
1414 1415
1415/* mm/page-writeback.c */ 1416/* mm/page-writeback.c */
1416int write_one_page(struct page *page, int wait); 1417int write_one_page(struct page *page, int wait);
diff --git a/mm/filemap.c b/mm/filemap.c
index a4a5260b0279..51efee65c2cc 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1712,8 +1712,27 @@ page_not_uptodate:
1712} 1712}
1713EXPORT_SYMBOL(filemap_fault); 1713EXPORT_SYMBOL(filemap_fault);
1714 1714
1715int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
1716{
1717 struct page *page = vmf->page;
1718 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
1719 int ret = VM_FAULT_LOCKED;
1720
1721 file_update_time(vma->vm_file);
1722 lock_page(page);
1723 if (page->mapping != inode->i_mapping) {
1724 unlock_page(page);
1725 ret = VM_FAULT_NOPAGE;
1726 goto out;
1727 }
1728out:
1729 return ret;
1730}
1731EXPORT_SYMBOL(filemap_page_mkwrite);
1732
1715const struct vm_operations_struct generic_file_vm_ops = { 1733const struct vm_operations_struct generic_file_vm_ops = {
1716 .fault = filemap_fault, 1734 .fault = filemap_fault,
1735 .page_mkwrite = filemap_page_mkwrite,
1717}; 1736};
1718 1737
1719/* This is used for a general mmap of a disk file */ 1738/* This is used for a general mmap of a disk file */
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 213ca1f53409..80b34ef82dfe 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -304,6 +304,7 @@ out:
304 304
305static const struct vm_operations_struct xip_file_vm_ops = { 305static const struct vm_operations_struct xip_file_vm_ops = {
306 .fault = xip_file_fault, 306 .fault = xip_file_fault,
307 .page_mkwrite = filemap_page_mkwrite,
307}; 308};
308 309
309int xip_file_mmap(struct file * file, struct vm_area_struct * vma) 310int xip_file_mmap(struct file * file, struct vm_area_struct * vma)