]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
Merge tag 'dax-fix-5.2-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Jul 2019 02:32:11 +0000 (11:32 +0900)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Jul 2019 02:32:11 +0000 (11:32 +0900)
Pull dax fix from Dan Williams:
 "A single dax fix that has been soaking awaiting other fixes under
  discussion to join it. As it is getting late in the cycle lets proceed
  with this fix and save follow-on changes for post-v5.3-rc1.

   - Fix xarray entry association for mixed mappings"

* tag 'dax-fix-5.2-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  dax: Fix xarray entry association for mixed mappings

fs/dax.c

index 2e48c7ebb97350fee7deb5a7905b36deb5cc095d..d2c90bf1969aaf4fcb8a4cfce96e9c2380b38c3f 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -720,12 +720,11 @@ static void *dax_insert_entry(struct xa_state *xas,
 
        xas_reset(xas);
        xas_lock_irq(xas);
-       if (dax_entry_size(entry) != dax_entry_size(new_entry)) {
+       if (dax_is_zero_entry(entry) || dax_is_empty_entry(entry)) {
+               void *old;
+
                dax_disassociate_entry(entry, mapping, false);
                dax_associate_entry(new_entry, mapping, vmf->vma, vmf->address);
-       }
-
-       if (dax_is_zero_entry(entry) || dax_is_empty_entry(entry)) {
                /*
                 * Only swap our new entry into the page cache if the current
                 * entry is a zero page or an empty entry.  If a normal PTE or
@@ -734,7 +733,7 @@ static void *dax_insert_entry(struct xa_state *xas,
                 * existing entry is a PMD, we will just leave the PMD in the
                 * tree and dirty it if necessary.
                 */
-               void *old = dax_lock_entry(xas, new_entry);
+               old = dax_lock_entry(xas, new_entry);
                WARN_ON_ONCE(old != xa_mk_value(xa_to_value(entry) |
                                        DAX_LOCKED));
                entry = new_entry;