Skip to content
  • Boaz Harrosh's avatar
    mm: new pfn_mkwrite same as page_mkwrite for VM_PFNMAP · dd906184
    Boaz Harrosh authored
    
    
    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: default avatarYigal Korman <yigal@plexistor.com>
    Signed-off-by: default avatarBoaz Harrosh <boaz@plexistor.com>
    Acked-by: default avatarKirill 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: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    dd906184