1. 23 10月, 2019 1 次提交
  2. 06 8月, 2019 1 次提交
    • V
      dax: dax_layout_busy_page() should not unmap cow pages · d75996dd
      Vivek Goyal 提交于
      Vivek:
      
          "As of now dax_layout_busy_page() calls unmap_mapping_range() with last
           argument as 1, which says even unmap cow pages. I am wondering who needs
           to get rid of cow pages as well.
      
           I noticed one interesting side affect of this. I mount xfs with -o dax and
           mmaped a file with MAP_PRIVATE and wrote some data to a page which created
           cow page. Then I called fallocate() on that file to zero a page of file.
           fallocate() called dax_layout_busy_page() which unmapped cow pages as well
           and then I tried to read back the data I wrote and what I get is old
           data from persistent memory. I lost the data I had written. This
           read basically resulted in new fault and read back the data from
           persistent memory.
      
           This sounds wrong. Are there any users which need to unmap cow pages
           as well? If not, I am proposing changing it to not unmap cow pages.
      
           I noticed this while while writing virtio_fs code where when I tried
           to reclaim a memory range and that corrupted the executable and I
           was running from virtio-fs and program got segment violation."
      
      Dan:
      
          "In fact the unmap_mapping_range() in this path is only to synchronize
           against get_user_pages_fast() and force it to call back into the
           filesystem to re-establish the mapping. COW pages should be left
           untouched by dax_layout_busy_page()."
      
      Cc: <stable@vger.kernel.org>
      Fixes: 5fac7408 ("mm, fs, dax: handle layout changes to pinned dax mappings")
      Signed-off-by: NVivek Goyal <vgoyal@redhat.com>
      Link: https://lore.kernel.org/r/20190802192956.GA3032@redhat.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      d75996dd
  3. 30 7月, 2019 1 次提交
  4. 17 7月, 2019 2 次提交
  5. 17 6月, 2019 1 次提交
  6. 07 6月, 2019 1 次提交
    • J
      dax: Fix xarray entry association for mixed mappings · 1571c029
      Jan Kara 提交于
      When inserting entry into xarray, we store mapping and index in
      corresponding struct pages for memory error handling. When it happened
      that one process was mapping file at PMD granularity while another
      process at PTE granularity, we could wrongly deassociate PMD range and
      then reassociate PTE range leaving the rest of struct pages in PMD range
      without mapping information which could later cause missed notifications
      about memory errors. Fix the problem by calling the association /
      deassociation code if and only if we are really going to update the
      xarray (deassociating and associating zero or empty entries is just
      no-op so there's no reason to complicate the code with trying to avoid
      the calls for these cases).
      
      Cc: <stable@vger.kernel.org>
      Fixes: d2c997c0 ("fs, dax: use page->mapping to warn if truncate...")
      Signed-off-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      1571c029
  7. 05 6月, 2019 1 次提交
  8. 15 5月, 2019 2 次提交
  9. 14 3月, 2019 1 次提交
    • A
      fs/dax: Deposit pagetable even when installing zero page · 11cf9d86
      Aneesh Kumar K.V 提交于
      Architectures like ppc64 use the deposited page table to store hardware
      page table slot information. Make sure we deposit a page table when
      using zero page at the pmd level for hash.
      
      Without this we hit
      
      Unable to handle kernel paging request for data at address 0x00000000
      Faulting instruction address: 0xc000000000082a74
      Oops: Kernel access of bad area, sig: 11 [#1]
      ....
      
      NIP [c000000000082a74] __hash_page_thp+0x224/0x5b0
      LR [c0000000000829a4] __hash_page_thp+0x154/0x5b0
      Call Trace:
       hash_page_mm+0x43c/0x740
       do_hash_page+0x2c/0x3c
       copy_from_iter_flushcache+0xa4/0x4a0
       pmem_copy_from_iter+0x2c/0x50 [nd_pmem]
       dax_copy_from_iter+0x40/0x70
       dax_iomap_actor+0x134/0x360
       iomap_apply+0xfc/0x1b0
       dax_iomap_rw+0xac/0x130
       ext4_file_write_iter+0x254/0x460 [ext4]
       __vfs_write+0x120/0x1e0
       vfs_write+0xd8/0x220
       SyS_write+0x6c/0x110
       system_call+0x3c/0x130
      
      Fixes: b5beae5e ("powerpc/pseries: Add driver for PAPR SCM regions")
      Cc: <stable@vger.kernel.org>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      11cf9d86
  10. 02 3月, 2019 1 次提交
  11. 13 2月, 2019 2 次提交
  12. 29 12月, 2018 1 次提交
  13. 22 12月, 2018 1 次提交
  14. 05 12月, 2018 1 次提交
    • M
      dax: Fix unlock mismatch with updated API · 27359fd6
      Matthew Wilcox 提交于
      Internal to dax_unlock_mapping_entry(), dax_unlock_entry() is used to
      store a replacement entry in the Xarray at the given xas-index with the
      DAX_LOCKED bit clear. When called, dax_unlock_entry() expects the unlocked
      value of the entry relative to the current Xarray state to be specified.
      
      In most contexts dax_unlock_entry() is operating in the same scope as
      the matched dax_lock_entry(). However, in the dax_unlock_mapping_entry()
      case the implementation needs to recall the original entry. In the case
      where the original entry is a 'pmd' entry it is possible that the pfn
      performed to do the lookup is misaligned to the value retrieved in the
      Xarray.
      
      Change the api to return the unlock cookie from dax_lock_page() and pass
      it to dax_unlock_page(). This fixes a bug where dax_unlock_page() was
      assuming that the page was PMD-aligned if the entry was a PMD entry with
      signatures like:
      
       WARNING: CPU: 38 PID: 1396 at fs/dax.c:340 dax_insert_entry+0x2b2/0x2d0
       RIP: 0010:dax_insert_entry+0x2b2/0x2d0
       [..]
       Call Trace:
        dax_iomap_pte_fault.isra.41+0x791/0xde0
        ext4_dax_huge_fault+0x16f/0x1f0
        ? up_read+0x1c/0xa0
        __do_fault+0x1f/0x160
        __handle_mm_fault+0x1033/0x1490
        handle_mm_fault+0x18b/0x3d0
      
      Link: https://lkml.kernel.org/r/20181130154902.GL10377@bombadil.infradead.org
      Fixes: 9f32d221 ("dax: Convert dax_lock_mapping_entry to XArray")
      Reported-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NMatthew Wilcox <willy@infradead.org>
      Tested-by: NDan Williams <dan.j.williams@intel.com>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      27359fd6
  15. 29 11月, 2018 2 次提交
  16. 19 11月, 2018 1 次提交
  17. 18 11月, 2018 2 次提交
    • M
      dax: Fix huge page faults · 0e40de03
      Matthew Wilcox 提交于
      Using xas_load() with a PMD-sized xa_state would work if either a
      PMD-sized entry was present or a PTE sized entry was present in the
      first 64 entries (of the 512 PTEs in a PMD on x86).  If there was no
      PTE in the first 64 entries, grab_mapping_entry() would believe there
      were no entries present, allocate a PMD-sized entry and overwrite the
      PTE in the page cache.
      
      Use xas_find_conflict() instead which turns out to simplify
      both get_unlocked_entry() and grab_mapping_entry().  Also remove a
      WARN_ON_ONCE from grab_mapping_entry() as it will have already triggered
      in get_unlocked_entry().
      
      Fixes: cfc93c6c ("dax: Convert dax_insert_pfn_mkwrite to XArray")
      Signed-off-by: NMatthew Wilcox <willy@infradead.org>
      0e40de03
    • M
      dax: Fix dax_unlock_mapping_entry for PMD pages · fda490d3
      Matthew Wilcox 提交于
      Device DAX PMD pages do not set the PageHead bit for compound pages.
      Fix for now by retrieving the PMD bit from the entry, but eventually we
      will be passed the page size by the caller.
      Reported-by: NDan Williams <dan.j.williams@intel.com>
      Fixes: 9f32d221 ("dax: Convert dax_lock_mapping_entry to XArray")
      Signed-off-by: NMatthew Wilcox <willy@infradead.org>
      fda490d3
  18. 17 11月, 2018 3 次提交
  19. 21 10月, 2018 8 次提交
  20. 09 10月, 2018 1 次提交
    • D
      filesystem-dax: Fix dax_layout_busy_page() livelock · d7782145
      Dan Williams 提交于
      In the presence of multi-order entries the typical
      pagevec_lookup_entries() pattern may loop forever:
      
      	while (index < end && pagevec_lookup_entries(&pvec, mapping, index,
      				min(end - index, (pgoff_t)PAGEVEC_SIZE),
      				indices)) {
      		...
      		for (i = 0; i < pagevec_count(&pvec); i++) {
      			index = indices[i];
      			...
      		}
      		index++; /* BUG */
      	}
      
      The loop updates 'index' for each index found and then increments to the
      next possible page to continue the lookup. However, if the last entry in
      the pagevec is multi-order then the next possible page index is more
      than 1 page away. Fix this locally for the filesystem-dax case by
      checking for dax-multi-order entries. Going forward new users of
      multi-order entries need to be similarly careful, or we need a generic
      way to report the page increment in the radix iterator.
      
      Fixes: 5fac7408 ("mm, fs, dax: handle layout changes to pinned dax...")
      Cc: <stable@vger.kernel.org>
      Cc: Ross Zwisler <zwisler@kernel.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      d7782145
  21. 30 9月, 2018 1 次提交
    • M
      xarray: Replace exceptional entries · 3159f943
      Matthew Wilcox 提交于
      Introduce xarray value entries and tagged pointers to replace radix
      tree exceptional entries.  This is a slight change in encoding to allow
      the use of an extra bit (we can now store BITS_PER_LONG - 1 bits in a
      value entry).  It is also a change in emphasis; exceptional entries are
      intimidating and different.  As the comment explains, you can choose
      to store values or pointers in the xarray and they are both first-class
      citizens.
      Signed-off-by: NMatthew Wilcox <willy@infradead.org>
      Reviewed-by: NJosef Bacik <jbacik@fb.com>
      3159f943
  22. 28 9月, 2018 1 次提交
  23. 12 9月, 2018 1 次提交
  24. 31 7月, 2018 1 次提交
  25. 30 7月, 2018 1 次提交
  26. 24 7月, 2018 1 次提交
    • D
      filesystem-dax: Introduce dax_lock_mapping_entry() · c2a7d2a1
      Dan Williams 提交于
      In preparation for implementing support for memory poison (media error)
      handling via dax mappings, implement a lock_page() equivalent. Poison
      error handling requires rmap and needs guarantees that the page->mapping
      association is maintained / valid (inode not freed) for the duration of
      the lookup.
      
      In the device-dax case it is sufficient to simply hold a dev_pagemap
      reference. In the filesystem-dax case we need to use the entry lock.
      
      Export the entry lock via dax_lock_mapping_entry() that uses
      rcu_read_lock() to protect against the inode being freed, and
      revalidates the page->mapping association under xa_lock().
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Cc: Jan Kara <jack@suse.cz>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NDave Jiang <dave.jiang@intel.com>
      c2a7d2a1