The patch titled
     Subject: dax: use pfn_mkwrite to update c/mtime + freeze protection
has been added to the -mm tree.  Its filename is
     dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection.patch

This patch should soon appear at
    
http://ozlabs.org/~akpm/mmots/broken-out/dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection.patch
and later at
    
http://ozlabs.org/~akpm/mmotm/broken-out/dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Boaz Harrosh <[email protected]>
Subject: dax: use pfn_mkwrite to update c/mtime + freeze protection


[v1]
Without this patch, c/mtime is not updated correctly when mmap'ed page is
first read from and then written to.

A new xfstest is submitted for testing this (generic/080)

[v2]
Jan Kara has pointed out that if we add the
sb_start/end_pagefault pair in the new pfn_mkwrite we
are then fixing another bug where: A user could start
writing to the page while filesystem is frozen.

Signed-off-by: Yigal Korman <[email protected]>
Signed-off-by: Boaz Harrosh <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Kirill A. Shutemov <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 fs/dax.c           |   17 +++++++++++++++++
 fs/ext2/file.c     |    1 +
 fs/ext4/file.c     |    1 +
 include/linux/fs.h |    1 +
 4 files changed, 20 insertions(+)

diff -puN fs/dax.c~dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection 
fs/dax.c
--- a/fs/dax.c~dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection
+++ a/fs/dax.c
@@ -464,6 +464,23 @@ int dax_fault(struct vm_area_struct *vma
 EXPORT_SYMBOL_GPL(dax_fault);
 
 /**
+ * dax_pfn_mkwrite - handle first write to DAX page
+ * @vma: The virtual memory area where the fault occurred
+ * @vmf: The description of the fault
+ *
+ */
+int dax_pfn_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
+{
+       struct super_block *sb = file_inode(vma->vm_file)->i_sb;
+
+       sb_start_pagefault(sb);
+       file_update_time(vma->vm_file);
+       sb_end_pagefault(sb);
+       return VM_FAULT_NOPAGE;
+}
+EXPORT_SYMBOL_GPL(dax_pfn_mkwrite);
+
+/**
  * dax_zero_page_range - zero a range within a page of a DAX file
  * @inode: The file being truncated
  * @from: The file offset that is being truncated to
diff -puN 
fs/ext2/file.c~dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection 
fs/ext2/file.c
--- a/fs/ext2/file.c~dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection
+++ a/fs/ext2/file.c
@@ -39,6 +39,7 @@ static int ext2_dax_mkwrite(struct vm_ar
 static const struct vm_operations_struct ext2_dax_vm_ops = {
        .fault          = ext2_dax_fault,
        .page_mkwrite   = ext2_dax_mkwrite,
+       .pfn_mkwrite    = dax_pfn_mkwrite,
 };
 
 static int ext2_file_mmap(struct file *file, struct vm_area_struct *vma)
diff -puN 
fs/ext4/file.c~dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection 
fs/ext4/file.c
--- a/fs/ext4/file.c~dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection
+++ a/fs/ext4/file.c
@@ -206,6 +206,7 @@ static int ext4_dax_mkwrite(struct vm_ar
 static const struct vm_operations_struct ext4_dax_vm_ops = {
        .fault          = ext4_dax_fault,
        .page_mkwrite   = ext4_dax_mkwrite,
+       .pfn_mkwrite    = dax_pfn_mkwrite,
 };
 #else
 #define ext4_dax_vm_ops        ext4_file_vm_ops
diff -puN 
include/linux/fs.h~dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection 
include/linux/fs.h
--- a/include/linux/fs.h~dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection
+++ a/include/linux/fs.h
@@ -2598,6 +2598,7 @@ int dax_clear_blocks(struct inode *, sec
 int dax_zero_page_range(struct inode *, loff_t from, unsigned len, 
get_block_t);
 int dax_truncate_page(struct inode *, loff_t from, get_block_t);
 int dax_fault(struct vm_area_struct *, struct vm_fault *, get_block_t);
+int dax_pfn_mkwrite(struct vm_area_struct *, struct vm_fault *);
 #define dax_mkwrite(vma, vmf, gb)      dax_fault(vma, vmf, gb)
 
 #ifdef CONFIG_BLOCK
_

Patches currently in -mm which might be from [email protected] are

mmv41-new-pfn_mkwrite-same-as-page_mkwrite-for-vm_pfnmap.patch
dax-use-pfn_mkwrite-to-update-c-mtime-freeze-protection.patch
dax-unify-ext2-4_dax_file_operations.patch
gitignore-ignore-tar.patch

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to