@@ -1563,6 +1563,14 @@ iomap_add_to_ioend(struct inode *inode, loff_t pos, struct folio *folio,
bio_add_folio(wpc->ioend->io_bio, folio, len, poff);
}
+ /*
+ * Folio may be modified by the owner of the pin and we require stable
+ * page contents during writeback? Ask block layer to bounce the bio.
+ */
+ if (inode->i_sb->s_iflags & SB_I_STABLE_WRITES &&
+ folio_maybe_dma_pinned(folio))
+ wpc->ioend->io_bio->bi_flags |= 1 << BIO_NEED_PIN_BOUNCE;
+
if (iop)
atomic_add(len, &iop->write_bytes_pending);
wpc->ioend->io_size += len;
When there is direct IO (or other DMA write) running into a page, it is not generally safe to submit this page for writeback because this can cause DIF/DIX failures or similar issues. Ask block layer to bounce the page in this case. Signed-off-by: Jan Kara <jack@suse.cz> --- fs/iomap/buffered-io.c | 8 ++++++++ 1 file changed, 8 insertions(+)