aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
authorBoaz Harrosh <boaz@plexistor.com>2015-04-15 19:15:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-15 19:35:20 -0400
commitdd9061846a3ba01b0fa45423aaa087e4a69187fa (patch)
tree799e6c9845a389a95173ca927caa825406175f41 /Documentation/filesystems
parent2682582a6ea118d974c33da64923ae8c687fdd0b (diff)
mm: new pfn_mkwrite same as page_mkwrite for VM_PFNMAP
This will allow FS that uses VM_PFNMAP | VM_MIXEDMAP (no page structs) to get notified when access is a write to a read-only PFN. This can happen if we mmap() a file then first mmap-read from it to page-in a read-only PFN, than we mmap-write to the same page. We need this functionality to fix a DAX bug, where in the scenario above we fail to set ctime/mtime though we modified the file. An xfstest is attached to this patchset that shows the failure and the fix. (A DAX patch will follow) This functionality is extra important for us, because upon dirtying of a pmem page we also want to RDMA the page to a remote cluster node. We define a new pfn_mkwrite and do not reuse page_mkwrite because 1 - The name ;-) 2 - But mainly because it would take a very long and tedious audit of all page_mkwrite functions of VM_MIXEDMAP/VM_PFNMAP users. To make sure they do not now CRASH. For example current DAX code (which this is for) would crash. If we would want to reuse page_mkwrite, We will need to first patch all users, so to not-crash-on-no-page. Then enable this patch. But even if I did that I would not sleep so well at night. Adding a new vector is the safest thing to do, and is not that expensive. an extra pointer at a static function vector per driver. Also the new vector is better for performance, because else we Will call all current Kernel vectors, so to: check-ha-no-page-do-nothing and return. No need to call it from do_shared_fault because do_wp_page is called to change pte permissions anyway. Signed-off-by: Yigal Korman <yigal@plexistor.com> Signed-off-by: Boaz Harrosh <boaz@plexistor.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Matthew Wilcox <matthew.r.wilcox@intel.com> Cc: Jan Kara <jack@suse.cz> Cc: Hugh Dickins <hughd@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Dave Chinner <david@fromorbit.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r--Documentation/filesystems/Locking8
1 files changed, 8 insertions, 0 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index f91926f2f482..8bb8a7ee0f99 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -525,6 +525,7 @@ prototypes:
525 void (*close)(struct vm_area_struct*); 525 void (*close)(struct vm_area_struct*);
526 int (*fault)(struct vm_area_struct*, struct vm_fault *); 526 int (*fault)(struct vm_area_struct*, struct vm_fault *);
527 int (*page_mkwrite)(struct vm_area_struct *, struct vm_fault *); 527 int (*page_mkwrite)(struct vm_area_struct *, struct vm_fault *);
528 int (*pfn_mkwrite)(struct vm_area_struct *, struct vm_fault *);
528 int (*access)(struct vm_area_struct *, unsigned long, void*, int, int); 529 int (*access)(struct vm_area_struct *, unsigned long, void*, int, int);
529 530
530locking rules: 531locking rules:
@@ -534,6 +535,7 @@ close: yes
534fault: yes can return with page locked 535fault: yes can return with page locked
535map_pages: yes 536map_pages: yes
536page_mkwrite: yes can return with page locked 537page_mkwrite: yes can return with page locked
538pfn_mkwrite: yes
537access: yes 539access: yes
538 540
539 ->fault() is called when a previously not present pte is about 541 ->fault() is called when a previously not present pte is about
@@ -560,6 +562,12 @@ the page has been truncated, the filesystem should not look up a new page
560like the ->fault() handler, but simply return with VM_FAULT_NOPAGE, which 562like the ->fault() handler, but simply return with VM_FAULT_NOPAGE, which
561will cause the VM to retry the fault. 563will cause the VM to retry the fault.
562 564
565 ->pfn_mkwrite() is the same as page_mkwrite but when the pte is
566VM_PFNMAP or VM_MIXEDMAP with a page-less entry. Expected return is
567VM_FAULT_NOPAGE. Or one of the VM_FAULT_ERROR types. The default behavior
568after this call is to make the pte read-write, unless pfn_mkwrite returns
569an error.
570
563 ->access() is called when get_user_pages() fails in 571 ->access() is called when get_user_pages() fails in
564access_process_vm(), typically used to debug a process through 572access_process_vm(), typically used to debug a process through
565/proc/pid/mem or ptrace. This function is needed only for 573/proc/pid/mem or ptrace. This function is needed only for