Re: [REGRESSION] ext4: silent data loss when a split at I/O completion gets ENOSPC
From: Zhang Yi
Date: Fri Nov 27 2026 - 20:09:09 EST
On 11/28/2026 1:45 AM, Jose Fernandez (Anthropic) wrote:
> On Tue, Nov 24, 2026 Zhang Yi wrote:
>> My idea is to make this a real reservation of currently allocatable
>> clusters rather than just a counter check. We can subtract
>> sbi->s_mb_free_pending from free_clusters in ext4_has_free_clusters().
>
> This makes sense to me.
>
>> However, the probability of returning ENOSPC for pure append writes
>> increases by about 10%.
>
> Our agents tried a close variant of it on mainline, with an exception
> for EXT4_MB_USE_RESERVED. The reproducer lost 0 of 72 files instead of
> 32 of 72. But write() got ENOSPC on 54 of 540 delalloc files, against
> none without it, with the filesystem at most about half full. The
> writers ran as root. Is your 10% before or after
> ext4_should_retry_alloc() gives up? Ours is after.
Yes, my test results match yours. Writes to preallocated files no longer
lose data or return ENOSPC, while the probability of delalloc writes
returning ENOSPC after ext4_should_retry_alloc() gives up increases from
0 to about 10%.
Thanks,
Yi.
>
> We can test the patch once it is posted.
>
> - Jose