linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ext4: fix DAX dma vs truncate/hole-punch
@ 2018-06-20 22:15 Ross Zwisler
       [not found] ` <20180620221503.25237-1-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Ross Zwisler @ 2018-06-20 22:15 UTC (permalink / raw)
  To: Jan Kara, Dan Williams, Dave Chinner, Christoph Hellwig,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw, Jeff Moyer,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA

This series from Dan:

https://lists.01.org/pipermail/linux-nvdimm/2018-March/014913.html

added synchronization between DAX dma and truncate/hole-punch in XFS.
This short series adds analogous support to ext4.

I've added calls to ext4_break_layouts() everywhere that ext4 removes
blocks from an inode's map.

The timings in XFS are such that it's difficult to hit this race.  Dan
was able to show the race by manually introducing delays in the direct
I/O path.

For ext4, though, its trivial to hit this race, and a hit will result in
a trigger of this WARN_ON_ONCE() in dax_disassociate_entry():

	WARN_ON_ONCE(trunc && page_ref_count(page) > 1);

I've made an xfstest which tests all the paths where we now call
ext4_break_layouts(), with the exception of the site in
ext4_truncate_failed_write() which is an error path.  Each of the other
4 paths easily hits this race many times in my test setup with the
xfstest.  I'll post this test shortly.

With these patches applied, I've still seen occasional hits of the above
WARN_ON_ONCE(), which tells me that we still have some work to do.  I'll
continue looking at these more rare hits while we review this set.

Ross Zwisler (2):
  dax: dax_layout_busy_page() warn on !exceptional
  ext4: handle layout changes to pinned DAX mappings

 fs/dax.c           |  9 ++++++++-
 fs/ext4/ext4.h     |  1 +
 fs/ext4/extents.c  | 12 ++++++++++++
 fs/ext4/inode.c    | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/ext4/truncate.h |  1 +
 5 files changed, 70 insertions(+), 1 deletion(-)

-- 
2.14.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-06-27 20:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-20 22:15 [PATCH 0/2] ext4: fix DAX dma vs truncate/hole-punch Ross Zwisler
     [not found] ` <20180620221503.25237-1-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-20 22:15   ` [PATCH 1/2] dax: dax_layout_busy_page() warn on !exceptional Ross Zwisler
     [not found]     ` <20180620221503.25237-2-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-22  8:10       ` Jan Kara
2018-06-20 22:15   ` [PATCH 2/2] ext4: handle layout changes to pinned DAX mappings Ross Zwisler
     [not found]     ` <20180620221503.25237-3-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-22  8:19       ` Jan Kara
     [not found]         ` <20180622081915.dvqd5sxx7vzoijw3-4I4JzKEfoa/jFM9bn6wA6Q@public.gmane.org>
2018-06-27 20:10           ` Ross Zwisler
2018-06-22  8:25       ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).