[PATCH v4 01/31] ntfs: propagate mapping-pairs update errors from inode writeback

From: Baolin Liu

Date: Tue Oct 20 2026 - 04:50:01 EST


From: Xuewen Wang <wangxuewen@xxxxxxxxxx>

__ntfs_write_inode() overwrites a failed mapping-pairs update with the
result of syncing standard information. fsync() can then report success
while the mapping pairs remain dirty.

Check the update result after releasing the runlist lock and take the
existing error path. Preserve the errno and retry handling for ENOMEM.

Fixes: af0db57d4293 ("ntfs: update inode operations")
Signed-off-by: Xuewen Wang <wangxuewen@xxxxxxxxxx>
---
Testing:
Fault injection reproduced successful fsync() returns for ENOMEM and
EIO before the fix. Both errors reach userspace afterward; disabling
injection allows fsync() to succeed, with size and data preserved across
remount.

fs/ntfs/inode.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 206db4e99ef1..52e22022b4e7 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -2940,6 +2940,8 @@ int __ntfs_write_inode(struct inode *vi, int sync)
if (!err)
NInoClearRunlistDirty(ni);
up_write(&ni->runlist.lock);
+ if (err)
+ goto unm_err_out;
}

err = ntfs_inode_sync_standard_information(vi, m);
--
2.51.0