From: sashiko-bot@kernel.org
To: "Tomás Senart" <ts@perfloop.ai>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] jbd2: stop fast commit replay at the end of the fast commit area
Date: Sat, 21 Nov 2026 03:13:23 +0000 [thread overview]
Message-ID: <sashiko-outbox-226561@kernel.org> (raw)
In-Reply-To: <CAEEBa3XJt0XU+5pXNQz_tjZyPEeEnY67i_QGupOnHLnXB=BVDw@mail.gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Critical] jbd2: skipped ext4_fc_set_bitmaps_and_counters() when fast
commit area is full
--
commit c70236779e98a78f5adca06274fb30cb8d0a0f06
Author: Tomás Senart <ts@perfloop.ai>
jbd2: stop fast commit replay at the end of the fast commit area
This commit changes the loop bound in fc_do_one_pass() from
<= journal->j_fc_last to < journal->j_fc_last so fast commit recovery
stops before reading past the end of the fast commit area.
> diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
> index cac8c2cd4a92a..a59de33a2a4a9 100644
> --- a/fs/jbd2/recovery.c
> +++ b/fs/jbd2/recovery.c
> @@ -242,7 +242,7 @@ static int fc_do_one_pass(journal_t *journal,
> if (!journal->j_fc_replay_callback)
> return 0;
>
> - while (next_fc_block <= journal->j_fc_last) {
> + while (next_fc_block < journal->j_fc_last) {
> jbd2_debug(3, "Fast commit replay: next block %ld\n",
> next_fc_block);
> err = jread(&bh, journal, next_fc_block);
[Severity: Critical]
When the fast commit area is full, does exiting the loop at
next_fc_block == journal->j_fc_last skip
ext4_fc_set_bitmaps_and_counters()?
In ext4_fc_replay(), state->fc_replay_num_tags is checked for zero only
at the top of the function and before decrementing it for the current tag:
fs/ext4/fast_commit.c:ext4_fc_replay() {
...
if (!sbi->s_fc_replay_state.fc_replay_num_tags) {
ext4_debug("Replay stops\n");
return ext4_fc_set_bitmaps_and_counters(sb);
}
...
for (cur = start; cur < end;
cur = cur + EXT4_FC_TAG_BASE_LEN + tl.fc_len) {
ext4_fc_get_tl(&tl, cur);
if (state->fc_replay_num_tags == 0) {
ret = ext4_fc_set_bitmaps_and_counters(sb);
break;
}
ext4_debug("Replay phase, tag:%s\n", tag2str(tl.fc_tag));
state->fc_replay_num_tags--;
...
}
Because ext4_fc_write_tail() sets the length of EXT4_FC_TAG_TAIL to cover
the rest of the block, the final tag in block journal->j_fc_last - 1
decrements state->fc_replay_num_tags from 1 to 0 and immediately finishes
the block loop, returning JBD2_FC_REPLAY_CONTINUE.
When the area is not full, fc_do_one_pass() invokes j_fc_replay_callback
on the next block, hitting !sbi->s_fc_replay_state.fc_replay_num_tags at
the start of ext4_fc_replay(). When the last usable block
(journal->j_fc_last - 1) holds the final EXT4_FC_TAG_TAIL, the while loop
in fc_do_one_pass() now terminates before calling j_fc_replay_callback
again.
During PASS_REPLAY, ext4_fc_replay_inode() clears the on-disk block
bitmaps for modified inodes via ext4_ext_clear_bb() and relies on
ext4_fc_set_bitmaps_and_counters() to mark their data and extent blocks
allocated again, so skipping it leaves live blocks marked free on disk.
--
Sashiko AI review · https://sashiko.dev/#/patchset/CAEEBa3XJt0XU+5pXNQz_tjZyPEeEnY67i_QGupOnHLnXB=BVDw@mail.gmail.com?part=1
prev parent reply other threads:[~2026-11-21 3:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 3:03 [PATCH] jbd2: stop fast commit replay at the end of the fast commit area Tomás Senart
2026-11-21 3:13 ` sashiko-bot [this message]
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=sashiko-outbox-226561@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=ts@perfloop.ai \
--cc=tytso@mit.edu \
/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