[PATCH v6 08/37] ntfs: preserve buffered fallback writeback errors

From: Xuewen Wang

Date: Wed Nov 18 2026 - 04:10:08 EST


From: Xuewen Wang <wangxuewen@xxxxxxxxxx>

The buffered fallback of a direct write waits for writeback before
invalidating the written pages. It replaces any writeback failure with EIO,
discarding more specific errors such as ENOMEM.

Return the error from filemap_write_and_wait_range() through the existing
cleanup path.

Reviewed-by: Baolin Liu <liubaolin@xxxxxxxxxx>
Signed-off-by: Xuewen Wang <wangxuewen@xxxxxxxxxx>
---
Changes in v6:
Extract buffered-fallback writeback errno propagation from v5 patch 23.

Validation:
- Compiled and linked the NTFS module object with W=1 at this stage.
- No undefined references to ntfs_report_* or fserror_report_*.

fs/ntfs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index 55c48d174b28..b1c6a84bf955 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -805,7 +805,7 @@ static ssize_t ntfs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from)
ret2 = filemap_write_and_wait_range(iocb->ki_filp->f_mapping,
offset, end);
if (ret2) {
- ret = -EIO;
+ ret = ret2;
goto out;
}
invalidate_mapping_pages(iocb->ki_filp->f_mapping,
--
2.51.0