Re: [PATCH v2 3/3] exfat: drain in-flight DIO before buffered write fallback

From: Chi Zhiling

Date: Sun Sep 27 2026 - 09:05:34 EST


On 9/26/26 3:26 PM, Jiale Yao wrote:
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index a2a9ee1a2004..cf5ccbd54823 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -807,6 +807,12 @@ static ssize_t exfat_fallback_buffered_write(struct kiocb *iocb,
iocb->ki_flags &= ~IOCB_DIRECT;
+ /*
+ * Prevent concurrent direct I/O and buffered I/O to the same file
+ * range. Wait for in-flight DIO to finish before dirtying pages.
+ */
+ inode_dio_wait(file_inode(iocb->ki_filp));

This change is correct, but the comment is not accurate because the function you modified is not part of the buffered I/O path in exFAT.

You can add inode_dio_wait() to both exfat_file_write_iter() and exfat_fallback_buffered_write(), and move the comment to exfat_file_write_iter().

+
written = iomap_file_buffered_write(iocb, from, &exfat_write_iomap_ops,
NULL, NULL);
if (written < 0)