Skip to content

Commit b6c0649

Browse files
committed
Merge tag 'dax-fixes-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull dax fixes from Dan Williams: "A filesystem-dax and device-dax fix for v5.3. The filesystem-dax fix is tagged for stable as the implementation has been mistakenly throwing away all cow pages on any truncate or hole punch operation as part of the solution to coordinate device-dma vs truncate to dax pages. The device-dax change fixes up a regression this cycle from the introduction of a common 'internal per-cpu-ref' implementation. Summary: - Fix dax_layout_busy_page() to not discard private cow pages of fs/dax private mappings. - Update the memremap_pages core to properly cleanup on behalf of internal reference-count users like device-dax" * tag 'dax-fixes-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: mm/memremap: Fix reuse of pgmap instances with internal references dax: dax_layout_busy_page() should not unmap cow pages
2 parents f6192cb + 0628237 commit b6c0649

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

fs/dax.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ struct page *dax_layout_busy_page(struct address_space *mapping)
600600
* guaranteed to either see new references or prevent new
601601
* references from being established.
602602
*/
603-
unmap_mapping_range(mapping, 0, 0, 1);
603+
unmap_mapping_range(mapping, 0, 0, 0);
604604

605605
xas_lock_irq(&xas);
606606
xas_for_each(&xas, entry, ULONG_MAX) {

mm/memremap.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ static void dev_pagemap_cleanup(struct dev_pagemap *pgmap)
9191
wait_for_completion(&pgmap->done);
9292
percpu_ref_exit(pgmap->ref);
9393
}
94+
/*
95+
* Undo the pgmap ref assignment for the internal case as the
96+
* caller may re-enable the same pgmap.
97+
*/
98+
if (pgmap->ref == &pgmap->internal_ref)
99+
pgmap->ref = NULL;
94100
}
95101

96102
static void devm_memremap_pages_release(void *data)

0 commit comments

Comments
 (0)