Skip to content

Commit

Permalink
Update ctime and mtime for memory-mapped files
Browse files Browse the repository at this point in the history
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: Anton Salikhmetov <salikhmetov@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Anton Salikhmetov authored and Linus Torvalds committed Jan 23, 2008
1 parent 667984d commit 8f7b3d1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mm/memory.c
Original file line number Diff line number Diff line change
@@ -1670,6 +1670,9 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
unlock:
pte_unmap_unlock(page_table, ptl);
if (dirty_page) {
if (vma->vm_file)
file_update_time(vma->vm_file);

/*
* Yes, Virginia, this is actually required to prevent a race
* 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,
if (anon)
page_cache_release(vmf.page);
else if (dirty_page) {
if (vma->vm_file)
file_update_time(vma->vm_file);

set_page_dirty_balance(dirty_page, page_mkwrite);
put_page(dirty_page);
}

0 comments on commit 8f7b3d1

Please sign in to comment.