From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Heming Zhao <heming.zhao@suse.com>,
hch@lst.de
Cc: Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
Joseph Qi <joseph.qi@linux.alibaba.com>
Subject: [PATCH v17 05/10] ocfs2: record the fsync transaction when CoW makes clusters writable
Date: Sat, 5 Dec 2026 16:19:18 +0800 [thread overview]
Message-ID: <20261205081923.4097763-6-joseph.qi@linux.alibaba.com> (raw)
In-Reply-To: <20261205081923.4097763-1-joseph.qi@linux.alibaba.com>
From: Heming Zhao <heming.zhao@suse.com>
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 before committing, at out_commit, so the error exits after the
transaction started record it too: earlier loop iterations may already
have dirtied extent tree buffers that ocfs2_commit_trans() will write.
Fixes: 2931cdcb4919 ("ocfs2: improve fsync efficiency and fix deadlock between aio_write and sync_file")
Co-developed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
fs/ocfs2/refcounttree.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 4f13b5a6faa7d..2e2f3becb8da9 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -3360,6 +3360,7 @@ static int ocfs2_make_clusters_writable(struct super_block *sb,
}
out_commit:
+ ocfs2_update_inode_fsync_trans(handle, context->inode, 1);
ocfs2_commit_trans(osb, handle);
out:
--
2.39.3
next prev parent reply other threads:[~2026-12-05 8:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 8:19 [PATCH v17 00/10] migrate ocfs2 DIO from buffer_head to iomap Joseph Qi
2026-12-05 8:19 ` [PATCH v17 01/10] ocfs2: Add new ocfs2_map_blocks() to introduce iomap feature Joseph Qi
2026-12-05 8:19 ` [PATCH v17 02/10] ocfs2: switch DIO read path from buffer_head to iomap Joseph Qi
2026-12-05 8:19 ` [PATCH v17 03/10] ocfs2: add ocfs2_get_clusters_uncached() Joseph Qi
2026-12-05 8:19 ` [PATCH v17 04/10] ocfs2: refactor ocfs2_lock_allocators() and add a dio variant Joseph Qi
2026-12-05 8:19 ` Joseph Qi [this message]
2026-12-05 8:19 ` [PATCH v17 06/10] ocfs2: rework the direct write context for multi-cluster mappings Joseph Qi
2026-12-05 8:19 ` [PATCH v17 07/10] ocfs2: switch dio write path from buffer_head to iomap Joseph Qi
2026-12-05 8:19 ` [PATCH v17 08/10] ocfs2: keep sub-page overwrites of written blocks on direct I/O Joseph Qi
2026-12-05 8:19 ` [PATCH v17 09/10] ocfs2: write the dio zeroed head/tail buffers out before completion Joseph Qi
2026-12-05 8:19 ` [PATCH v17 10/10] ocfs2: make buffered writes wait for in-flight direct writes Joseph Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261205081923.4097763-6-joseph.qi@linux.alibaba.com \
--to=joseph.qi@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=heming.zhao@suse.com \
--cc=jlbec@evilplan.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®