From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796057877; b=g+1tUwXIRkoeFfMGewvDtBT+oEOwJlSQJEYVNODKSimOTc6SCcuh+wgFoKbwqKZpptIs Jw0U4OQb4eH49fr9Fla0wgS+07uPN+Gf+MDiQTgkAd3O7N5EK09dIGHACimjG25w+dSZs 5Poy0hhDKvCSgCydrw1HTJTEk4Ur/HehWjsBBnhYoig9wXRFsbseBrLiRrFJm5szcMjyA Mihej1YuTzpWAbLaeE+cl2gl3v1V1ILFt0dtVM4hs7qXiX6wGgQHQIkL7eR95k3idxhFm NI4iaNbueBgNTD1hHPZyWvIqYwdOst/ubKYWLYxHXMTu+37xX8ogaNuMlu0WCsU7jhQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796057877; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=sxTs8jhss8TQVX0PoLdAnznEtlO5/0Aye2QRVyy+QdM=; b=JbGfo2TI9coS8dZ9zoAEsCVvF71/MPJ4KyKsvBJu2rKbLE9kOXnMsbUtpSVs9F8YqGyL f8pKnNRbSKzzvJQgquBXoV1neLlRCosGEnGU/hjMZ4JKqf9SaeWMf/BJm4mmxv/6eBm5e 8HhBc1QsSlMP0npwihJjNy689x284yL7IuNRqgMi5ILg2HGuPSfZU06VVUFbLZeJn+Pq2 TrZB/MCau8cgoKMFoAsAC/jHRL3BflvDLqo3eIP48PmLnNh30CfZr59IZfYLnOTa+z90+ VSuljtW5fnuDAvbJ79SdD+jRBcsitQJPnagGmfqNgRHe06FYnru5/R7I/4hyMp1oBhg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=B6BSt95M; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E0B2606A31C for ; Mon, 30 Nov 2026 16:57:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=B6BSt95M Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46EC71F00897; Mon, 30 Nov 2026 16:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796057877; bh=sxTs8jhss8TQVX0PoLdAnznEtlO5/0Aye2QRVyy+QdM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=B6BSt95Mx6cwsmdvoq4YS5oi7sUxDjFREhb7FMW36LyuG5Tnz0E9TGPEkZhgAOHKW qjxk/Y8LYnixh04a36C9Z7+HsEQ55OQHzkzmBY7oc7mvMFT8Kg2gzXA9bpas+km07/ ZWGczi8xntCO1GxadvaJwOvdm3+sz0fPU530S79vZ7f/cqGKxCi9Eehq2UkWO8kcLH bb/fR9YMRvAOthMDPoiEGmoXDsNIrxytmYkgQNKu0l6lqWk8Pw3lYyYvHgDFzKkrap vNa+lqH2NRPY0IuJizsHO+kv5aUtd3PVEH5pxscgD3154vGbYJjxKimvaw20PsI8hO OEipO5HfngqtA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/3] ext4: do not skip fast commit for updates queued during ongoing commit Reply-To: sashiko-reviews@lists.linux.dev To: "Xing Ma" , linux-ext4@vger.kernel.org Cc: tytso@mit.edu In-Reply-To: <20261130163819.13819-2-maxing.lan@bytedance.com> References: <20261130163819.13819-1-maxing.lan@bytedance.com> <20261130163819.13819-2-maxing.lan@bytedance.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 16:57:56 +0000 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] ext4: double-counted target_subtid in ext4_fc_commit() during cleanup -- commit b8e5dbb706be86ee24d82de27b0c55791a280c70 Author: Xing Ma ext4: do not skip fast commit for updates queued during ongoing commit This commit samples s_fc_subtid and JBD2_FAST_COMMIT_ONGOING under j_state_lock at entry to ext4_fc_commit() so callers wait for an additional fast commit when one is already in progress. > diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c > index 9beb423b208f8..03ab9b8a2d983 100644 > --- a/fs/ext4/fast_commit.c > +++ b/fs/ext4/fast_commit.c > @@ -1588,7 +1588,7 @@ int ext4_fc_commit(journal_t *journal, tid_t commit= _tid) > struct super_block *sb =3D journal->j_private; > struct ext4_sb_info *sbi =3D EXT4_SB(sb); > int nblks =3D 0, ret, bsize =3D journal->j_blocksize; > - int subtid =3D atomic_read(&sbi->s_fc_subtid); > + int target_subtid; > int status =3D EXT4_FC_STATUS_OK, fc_bufs_before =3D 0; > ktime_t start_time, commit_time; > int old_ioprio, journal_ioprio; > @@ -1601,11 +1601,24 @@ int ext4_fc_commit(journal_t *journal, tid_t comm= it_tid) > start_time =3D ktime_get(); > old_ioprio =3D get_current_ioprio(); > =20 > + /* > + * If a fast commit is already ongoing when we enter ext4_fc_commit(), > + * updates made by this caller may have been queued on FC_Q_STAGING or > + * marked EXT4_STATE_FC_REQUEUE and will not be included in that > + * ongoing fast commit. Require a subsequent fast commit (or a full > + * commit of commit_tid) before skipping. > + */ > + read_lock(&journal->j_state_lock); > + target_subtid =3D atomic_read(&sbi->s_fc_subtid) + 1; > + if (journal->j_flags & JBD2_FAST_COMMIT_ONGOING) > + target_subtid++; > + read_unlock(&journal->j_state_lock); [Severity: Medium] Can target_subtid be incremented twice for the same ongoing fast commit when ext4_fc_commit() enters while another commit is in cleanup? ext4_fc_commit() increments sbi->s_fc_subtid before calling jbd2_fc_end_commit(), whereas __jbd2_fc_end_commit() clears JBD2_FAST_COMMIT_ONGOING only after j_fc_cleanup_callback() (ext4_fc_cleanup()) returns: CPU0 (s_fc_subtid =3D=3D N) CPU1 ext4_fc_commit() ... atomic_inc(&sbi->s_fc_subtid) -> N + 1 jbd2_fc_end_commit() __jbd2_fc_end_commit() ext4_fc_cleanup() ext4_fc_commit() read_lock(&journal->j_state_lock) target_subtid =3D (N + 1) + 1 JBD2_FAST_COMMIT_ONGOING is set -> target_subtid =3D N + 3 read_unlock(&journal->j_state_lock) write_lock(&journal->j_state_lock) j_flags &=3D ~JBD2_FAST_COMMIT_ONGOING write_unlock(&journal->j_state_lock) After the next fast commit (N + 2) commits the updates spliced onto FC_Q_MAIN during CPU0's cleanup, CPU1 wakes from jbd2_fc_begin_commit() with s_fc_subtid =3D=3D N + 2 < target_subtid (N + 3) and restarts to run an extra fast commit. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130163819.1381= 9-1-maxing.lan@bytedance.com?part=3D1