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=1796481615; b=nNFRinCQ0frOm6lWX4iV8zer6TNVBVlUElwOAt8AAA+NHwhSF4feYu8DiYnDsj/wiz6J MOhSZaRx6RF3fFHdB+4rp3eKEZgurxhDzCpqJqOfu3GjFqhQ+0nYiS2T5Y8OQyM2QNR9l PUYomWi1qV8oI/YIo8BWsbZOwdzonBxjKypO7hf8r4aL7hGnlh4xfrNhbNw1Ad40gMxd9 bzfdPLlM0D5WU9r5oJ7sYDK5nRx55rMpINunhGZKpXYlP6DlaTHDJDrV/lz5Q8z+f2oWC 4XRZujAMG1fC5UkBMzYTqBKAyRIWvWzgXZ5Hc/+HvlzUbgGvIPPTcaBo/JORU8U4H/A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796481615; 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=9zF/pXhbt2A44DEaY53DhVzf24a2jow1vFFVvIU7EfY=; b=0nNgZjDMTaghOWhwxkj16sGJ+se7irNwlUDyzKZW91shhW767NBXABxiF6aXhYmAPe+t LxXZzTdcgk2hpPw/K9XdICwyMYnE5q4MF18nae4fNf/DaJkN27BWxDw2Qqz39dufAHw2N EWutYh3GyoPgWsk9nDYqhznXTs5Lmk0kANbXR+YWKRy2owWYLa+EJkIY/lhRzhRSZ7PkJ hcaNkZDRhiej/7sLf0a4La11r3U0DSq8W688JmKmwP41nWzXkgX3YRP1DkTcj42CXAvlc 1UOjqyEv5+S7w7LEMdX/PlqPTJHWBceFjnNV07Kv5IHoEXrsJmZItTnCIAblcKhOaVQ== 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=yjWrxQrq; 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 A441E606A6BC for ; Sat, 5 Dec 2026 14:40:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A441E606A6BC 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=yjWrxQrq DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1796481606; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=9zF/pXhbt2A44DEaY53DhVzf24a2jow1vFFVvIU7EfY=; b=yjWrxQrqzktFcV2W15aMMWHFCALg2RWrKC9l5x0QocBjvXJ8zylKAcpf7l12OdJvU3D1wzy4wzTE1fBRialj9z+nR6ZeY8tBIxTOTEHl8bVLT5spWrZTgFgMCn8syP+BovO6lcr75OKLsLerPUG74h3QFXbp6PLt78mvJLvvyOM= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R431e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=joseph.qi@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0XGJjjS2_1796481605; Received: from localhost(mailfrom:joseph.qi@linux.alibaba.com fp:SMTPD_---0XGJjjS2_1796481605 cluster:ay36) by smtp.aliyun-inc.com; Sat, 05 Dec 2026 22:40:06 +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 v18 05/10] ocfs2: record the fsync transaction when CoW makes clusters writable Date: Sat, 5 Dec 2026 22:39:54 +0800 Message-Id: <20261205143959.704982-6-joseph.qi@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20261205143959.704982-1-joseph.qi@linux.alibaba.com> References: <20261205143959.704982-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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 4f13b5a6faa7d..0181993f56149 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: + ocfs2_update_inode_fsync_trans(handle, context->inode, + context->get_clusters == ocfs2_di_get_clusters); ocfs2_commit_trans(osb, handle); out: -- 2.39.3