diff mbox series

[v2,1/9] iomap: Fix misplaced page flushing

Message ID 20200910234707.5504-2-willy@infradead.org (mailing list archive)
State Accepted
Commit 7ed3cd1a69e3aedb29d4edf0b02624a1833a952d
Headers show
Series THP iomap patches for 5.10 | expand

Commit Message

Matthew Wilcox Sept. 10, 2020, 11:46 p.m. UTC
If iomap_unshare_actor() unshares to an inline iomap, the page was
not being flushed.  block_write_end() and __iomap_write_end() already
contain flushes, so adding it to iomap_write_end_inline() seems like
the best place.  That means we can remove it from iomap_write_actor().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
 fs/iomap/buffered-io.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series


diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 897ab9a26a74..d81a9a86c5aa 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -717,6 +717,7 @@  iomap_write_end_inline(struct inode *inode, struct page *page,
 	BUG_ON(pos + copied > PAGE_SIZE - offset_in_page(iomap->inline_data));
+	flush_dcache_page(page);
 	addr = kmap_atomic(page);
 	memcpy(iomap->inline_data + pos, addr + pos, copied);
@@ -810,8 +811,6 @@  iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
 		copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);
-		flush_dcache_page(page);
 		status = iomap_write_end(inode, pos, bytes, copied, page, iomap,
 		if (unlikely(status < 0))