Commit 8f7b3d15 authored by Anton Salikhmetov's avatar Anton Salikhmetov Committed by Linus Torvalds

Update ctime and mtime for memory-mapped files

Update ctime and mtime for memory-mapped files at a write access on
a present, read-only PTE, as well as at a write on a non-present PTE.
Signed-off-by: default avatarAnton Salikhmetov <salikhmetov@gmail.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 667984d9
...@@ -1670,6 +1670,9 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -1670,6 +1670,9 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
unlock: unlock:
pte_unmap_unlock(page_table, ptl); pte_unmap_unlock(page_table, ptl);
if (dirty_page) { if (dirty_page) {
if (vma->vm_file)
file_update_time(vma->vm_file);
/* /*
* Yes, Virginia, this is actually required to prevent a race * Yes, Virginia, this is actually required to prevent a race
* with clear_page_dirty_for_io() from clearing the page dirty * with clear_page_dirty_for_io() from clearing the page dirty
...@@ -2343,6 +2346,9 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -2343,6 +2346,9 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
if (anon) if (anon)
page_cache_release(vmf.page); page_cache_release(vmf.page);
else if (dirty_page) { else if (dirty_page) {
if (vma->vm_file)
file_update_time(vma->vm_file);
set_page_dirty_balance(dirty_page, page_mkwrite); set_page_dirty_balance(dirty_page, page_mkwrite);
put_page(dirty_page); put_page(dirty_page);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment