Public bug reported: [Impact]
On ext4 with fast_commit enabled, every unwritten-extent conversion waits in ext4_fc_track_inode() while that inode's fast commit runs (EXT4_STATE_FC_COMMITTING). With a database writing O_DIRECT into fallocated files (MariaDB/InnoDB), DIO completions run on the dio/<dev> workqueue and pile up behind that wait: ext4_fc_track_inode <- ext4_map_blocks <- ext4_convert_unwritten_extents <- ext4_dio_write_end_io <- iomap_dio_complete_work A per-thread D-state sampler (0.5 s) caught up to 993 dio kworkers in that one stack at the same time during a write burst, on 7.0.0-43-generic (linux-hwe-7.0, noble). The piles last well under a second, but a loadavg sample that lands in one jumps by about 8% of the pile (we see load 34-188 on idle-CPU VMs, with iowait and IO PSI near zero). Write completion latency rises during the pile. The same workload on 6.8 never showed more than 5 waiting threads. Upstream also notes the wait risks an ABBA deadlock with i_data_sem (ext4_fc_track_inode() can be called with i_data_sem held, e.g. fallocate, while the commit task waits for i_data_sem). [Fix] Mainline series "ext4: fast commit" by Li Chen, merged for 7.2-rc1 (ext4_for_linus-7.2-rc1, 83f1454877cc), https://patch.msgid.link/[email protected] and following: e9c6e0b8e096 ext4: fast commit: snapshot inode state before writing log 7f473f971382 ext4: lockdep: handle i_data_sem subclassing for special inodes b3060e96533d ext4: fast commit: avoid waiting for FC_COMMITTING 2b9b216628fd ext4: fast commit: avoid self-deadlock in inode snapshotting 22d887e06a57 ext4: fast commit: avoid i_data_sem by dropping ext4_map_blocks() in snapshots b3060e96533d depends on the snapshot patch; 2b9b216628fd and 22d887e06a57 fix regressions in it, so the series should go in together. Not in linux-stable 7.0.y. The 7.0 kernels already carry 8b3bc93fee67 ("ext4: fix fast commit wait/wake bit mapping on 64-bit", 7.0.0-38). Requested for the 7.0 kernels (resolute linux, noble linux-hwe-7.0). [Test Plan] 1. ext4 root with fast_commit (tune2fs -l shows fast_commit), MariaDB with innodb_flush_method=O_DIRECT. 2. Run a sustained bulk INSERT ... SELECT workload (several GB of redo) into a fresh table. 3. Sample D-state threads per thread every 0.5 s (/proc/*/task/*/stat, wchan) during the burst. Before: hundreds of dio kworkers in ext4_fc_track_inode. After: none in that wait. 4. xfstests generic/ and ext4/ fast commit groups (log replay after a crash) pass. [Where problems could occur] The series changes what fast commit writes to the log (inode state is snapshotted at commit start). A bug would show as wrong or missing inode state after fast commit replay following a crash, or as a hang in ext4_fc_del() on inode eviction, which now waits for FC_COMMITTING instead. Only filesystems with fast_commit enabled (not the mkfs default) are affected. ** Affects: linux (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2190838 Title: ext4 fast_commit: DIO completion kworkers block in ext4_fc_track_inode() waiting for FC_COMMITTING (fixed upstream in 7.2, b3060e96533d) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2190838/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
