[PATCH 5/5] iomap: Bounce pinned pages during writeback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 fs/iomap/buffered-io.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 356193e44cf0..e6469e7715cc 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -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;
-- 
2.35.3




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux