jbd2_fc_begin_commit() tests journal->j_stats.ts_tid before taking j_state_lock, while jbd2_journal_commit_transaction() increments that field under j_history_lock. The two accesses therefore have no common lock and KCSAN reports a data race. In the observed window the reader can see the initial zero after the first real commit has already incremented ts_tid, causing jbd2_fc_begin_commit() to return -EINVAL and ext4 to fall back to a full commit. This is a low-severity fast-commit eligibility race, not a journal-format or data-integrity bug. The detailed description: * Test environment / affected version Linux version 7.3.0 (gcc 13.3.0, GNU ld 2.42) #1 SMP PREEMPT_DYNAMIC, vanilla mainline 7.3, rebuilt with CONFIG_KCSAN=y, CONFIG_EXT4_FS=y, CONFIG_JBD2=y, CONFIG_PROC_FS=y. QEMU/KVM x86_64 guest, 8 vCPU, 4 GB RAM. The fast-commit image is 256 MB with an 8 MB journal and the ext4 fast_commit feature enabled; it is mounted with commit=1. Line numbers below are from 7.3. * Mechanism Reader (ext4 fsync -> fast commit begin): fs/jbd2/journal.c:702-711 if (is_journal_aborted(journal)) return -EIO; /* We are only called by the FS after it has called * jbd2_journal_start() ... */ if (!journal->j_stats.ts_tid) return -EINVAL; write_lock(&journal->j_state_lock); The ts_tid load at journal.c:708 is a plain read, before the write lock is taken at journal.c:711. Writer (kjournald2 commit thread, at the end of a full commit): fs/jbd2/commit.c:1173-1185 spin_lock(&journal->j_history_lock); journal->j_stats.ts_tid++; ... spin_unlock(&journal->j_history_lock); The declaration is: include/linux/jbd2.h:738-742 struct transaction_stats_s { unsigned long ts_tid; unsigned long ts_requested; ... }; and j_stats is embedded in struct journal_s at jbd2.h:1241-1243. ts_tid is monotonic: it is zero until the first full commit, then becomes non-zero forever. It does not wrap in any realistic journal lifetime. The race is therefore a transition 0 -> non-zero that is not published to the reader. The reader's early check is not protected by j_history_lock, and the writer does not take j_state_lock around the increment. There is no common lock, and no READ_ONCE()/data_race() annotation. * Trigger model and reproducer The reproducer is jbd2_race.c, run inside a minimal initramfs. The "mr02" plan performs up to 12 mount/unmount cycles on the fast-commit image (11 completed in the recorded run). In each cycle it starts 8 threads that write 4096 bytes to /mnt/jbd2- and fsync(), for 2 seconds, immediately after a fresh mount. A fresh journal gives the reader a chance to run before the first full commit has published ts_tid; an 800 ms warmup is deliberately not used in this mode. * Observed result on 7.3 The first report is at 4.933 s: BUG: KCSAN: data-race in jbd2_fc_begin_commit / jbd2_journal_commit_transaction read-write to 0xff27e8144186c000 of 8 bytes by task 115 on cpu 7: jbd2_journal_commit_transaction+0x220/0x2850 kjournald2+0xfb/0x310 read to 0xff27e8144186c000 of 8 bytes by task 127 on cpu 1: jbd2_fc_begin_commit+0x27/0x160 ext4_fc_commit+0x200/0x2120 ext4_sync_file+0x1ef/0x4f0 __x64_sys_fsync+0xae/0xf0 do_syscall_64+0x114/0x380 The 8-byte width matches unsigned long ts_tid on this 64-bit build. * Suggested direction Snapshot ts_tid under j_history_lock before taking j_state_lock: unsigned long ts_tid; spin_lock(&journal->j_history_lock); ts_tid = journal->j_stats.ts_tid; spin_unlock(&journal->j_history_lock); if (!ts_tid) return -EINVAL; Do not hold j_history_lock while taking j_state_lock: the commit thread takes j_state_lock first and j_history_lock later, and nesting them in the opposite order would create a lock-order inversion. Alternatively, if maintainers consider the 0 -> non-zero transition benign and intentionally racy, annotate the load with data_race() and a comment; KCSAN would then stop reporting it. The lock snapshot is the stronger option. Please keep me in Cc; I am not subscribed to the lists. Regards, Hanxiang Xu xuhx@hust.edu.cn