ext4 data corruption in 6.1 stable tree
-
Ext4 data corruption in stable kernels
There is a problem in multiple stable kernel releases that is causing data corruption in ext4 filesystems.
-
ext4 data corruption in 6.1 stable tree
So I've got back to this and the failure is a subtle interaction between iomap code and ext4 code. In particular that fact that commit 936e114a245b6 ("iomap: update ki_pos a little later in iomap_dio_complete") is not in stable causes that file position is not updated after direct IO write and thus we direct IO writes are ending in wrong locations effectively corrupting data. The subtle detail is that before this commit if ->end_io handler returns non-zero value (which the new ext4 ->end_io handler does), file pos doesn't get updated, after this commit it doesn't get updated only if the return value is < 0.
The commit got merged in 6.5-rc1 so all stable kernels that have 91562895f803 ("ext4: properly sync file size update after O_SYNC direct IO") before 6.5 are corrupting data - I've noticed at least 6.1 is still carrying the problematic commit. Greg, please take out the commit from all stable kernels before 6.5 as soon as possible, we'll figure out proper backport once user data are not being corrupted anymore. Thanks!
Honza
Update
One more:
-
Hold Off Debian Upgrades: Kernel 6.1.64 ext4 Bug Alert
A data corruption bug in GNU/Linux kernel 6.1.64-1 with possible data loss on ext4 file systems, delaying the release of Debian 12.3.
Much later by Lunduke: