From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.130 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796458776; b=RQ3VgLEzE/SYtgkbsaiFQtVImcVUVyiY3xPcTBgIpOrKuqM33VfUvAJ8vQC9mz1bjpOV TreulG9Ga5AqHB660v/Lg8F9nA5OBcUDQi9bY2zqbFJnhm8P/LPe77lqTgfrNDDahGZFS IVLINfL8Nra64t0jTtEF3/5JD8vwib2tL5bilxeYFkEvk3GCa6GWyCT8z/Iqwf9+v8E37 Xe4wsptPSrEPJq1Y/PsafLiwMGOokgcEb+gDtM3aLsN+akKTN0wyO22S+V+X++6l7VP9l tXqsKY93c9p3XJcf9ghqGLOXwV1A2LpGy2qYr5LDEq/3ZZDdOUOdnH5R3rNmXPxEJFA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796458776; h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc: Subject:Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=o/ZMvEnKaMkLN4P93ddZOT+eZ1/1JppWUcHgqEDOguw=; b=xtJ4etHMNpu1hCSEs7aEOeFkhFyZp6bL7EN4OFwXMlLfQUzXwqkDAUwH2CB3SRzd0Qr+ WOtno6d34z5kvUC86cGmDIgjmDNkop0wteqVRqOh/0hPg85LIhtRKgYXuhTGRXX1luY4P bzGjK5+F2LTYp+XBgwjKKUqqWWLi8df0oDRx1dLt6DlVK/jeaquOsMlAozodrtqcJa+q5 07kcL4O5oYUKyNCxKShE0+egjKkvUYCqpxcpEnybtwjAU7sgbyBdj1E7sY939O1bVxyJE 5bIcfv2SvR8E1ampNd7kbu4tgp5/ikR7V35eAJyYRU0YczsqaM8pOkpkH8aJ2eFb07w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=whc+TC5Z; arc=none smtp.remote-ip=115.124.30.130 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C818C606A337 for ; Sat, 5 Dec 2026 08:19:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C818C606A337 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=whc+TC5Z DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1796458770; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=o/ZMvEnKaMkLN4P93ddZOT+eZ1/1JppWUcHgqEDOguw=; b=whc+TC5Zz+KxfR7FyF08Sp1vzZLEp4bb/g3TxfW99h0+f3QUleD/KhZYm371TSvUfUAvodobx41hKxl7MxskQe+OMTYLinhuLyuAaZdoaiM/F2uvHXu1mzGkE6uN4XDGsjQTWfBGohuWcyTeA2P8K1iMGXi6Z44HpmN+BeE7qfA= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033071064103;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0XGJGPbJ_1796458769; Received: from localhost(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0XGJGPbJ_1796458769 cluster:ay36) by smtp.aliyun-inc.com; Sat, 05 Dec 2026 16:19:30 +0800 From: Joseph Qi To: Andrew Morton , Heming Zhao , hch@lst.de Cc: Mark Fasheh , Joel Becker , ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org, Joseph Qi Subject: [PATCH v17 05/10] ocfs2: record the fsync transaction when CoW makes clusters writable Date: Sat, 5 Dec 2026 16:19:18 +0800 Message-Id: <20261205081923.4097763-6-joseph.qi@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20261205081923.4097763-1-joseph.qi@linux.alibaba.com> References: <20261205081923.4097763-1-joseph.qi@linux.alibaba.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Heming Zhao 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 Signed-off-by: Joseph Qi Signed-off-by: Heming Zhao --- 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