Skip to content

Commit 41c4d25

Browse files
jankaraAl Viro
authored and
Al Viro
committed
mm: Update file times from fault path only if .page_mkwrite is not set
Filesystems wanting to properly support freezing need to have control when file_update_time() is called. After pushing file_update_time() to all relevant .page_mkwrite implementations we can just stop calling file_update_time() when filesystem implements .page_mkwrite. Tested-by: Kamal Mostafa <[email protected]> Tested-by: Peter M. Petrakis <[email protected]> Tested-by: Dann Frazier <[email protected]> Tested-by: Massimo Morana <[email protected]> Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 14ae417 commit 41c4d25

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mm/memory.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2638,6 +2638,9 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
26382638
if (!page_mkwrite) {
26392639
wait_on_page_locked(dirty_page);
26402640
set_page_dirty_balance(dirty_page, page_mkwrite);
2641+
/* file_update_time outside page_lock */
2642+
if (vma->vm_file)
2643+
file_update_time(vma->vm_file);
26412644
}
26422645
put_page(dirty_page);
26432646
if (page_mkwrite) {
@@ -2655,10 +2658,6 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
26552658
}
26562659
}
26572660

2658-
/* file_update_time outside page_lock */
2659-
if (vma->vm_file)
2660-
file_update_time(vma->vm_file);
2661-
26622661
return ret;
26632662
}
26642663

@@ -3327,12 +3326,13 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
33273326

33283327
if (dirty_page) {
33293328
struct address_space *mapping = page->mapping;
3329+
int dirtied = 0;
33303330

33313331
if (set_page_dirty(dirty_page))
3332-
page_mkwrite = 1;
3332+
dirtied = 1;
33333333
unlock_page(dirty_page);
33343334
put_page(dirty_page);
3335-
if (page_mkwrite && mapping) {
3335+
if ((dirtied || page_mkwrite) && mapping) {
33363336
/*
33373337
* Some device drivers do not set page.mapping but still
33383338
* dirty their pages
@@ -3341,7 +3341,7 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
33413341
}
33423342

33433343
/* file_update_time outside page_lock */
3344-
if (vma->vm_file)
3344+
if (vma->vm_file && !page_mkwrite)
33453345
file_update_time(vma->vm_file);
33463346
} else {
33473347
unlock_page(vmf.page);

0 commit comments

Comments
 (0)