[RFC PATCH v13 05/10] ocfs2: record the fsync transaction when CoW makes clusters writable
From: Joseph Qi
Date: Mon Nov 30 2026 - 05:03:16 EST
From: Heming Zhao <heming.zhao@xxxxxxxx>
ocfs2_make_clusters_writable() changes the extent tree to break a
refcount sharing, but it does not record the transaction in the inode's
datasync tid. A subsequent O_DSYNC or fsync that relies on
i_datasync_tid can therefore consider the CoW already committed and skip
waiting for it.
Record it on the success path, like the other extent tree changes do.
Fixes: 6f70fa519976 ("ocfs2: Add CoW support.")
Co-developed-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>
Signed-off-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>
Signed-off-by: Heming Zhao <heming.zhao@xxxxxxxx>
---
fs/ocfs2/refcounttree.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 4f13b5a6faa7d..485104aab14e6 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -3360,6 +3360,8 @@ static int ocfs2_make_clusters_writable(struct super_block *sb,
}
out_commit:
+ if (!ret)
+ ocfs2_update_inode_fsync_trans(handle, context->inode, 1);
ocfs2_commit_trans(osb, handle);
out:
--
2.39.3