Re: [RESEND PATCH 1/2] erofs-utils: lib: don't abort on compression fallback
Gao Xiang <[email protected]>
| Newsgroups | org.ozlabs.lists.linux-erofs |
|---|---|
| Message-ID | <[email protected]> |
On 2026/6/22 12:10, zhaoyifan (H) wrote:
>
> On 2026/6/22 11:51, Gao Xiang wrote:
>> Hi Yifan,
>>
>> On 2026/6/22 11:42, Yifan Zhao wrote:
>>> -ENOSPC can be a normal compression fallback when fragments are off.
>>> Keep the global compression context reusable for that case while
>>> preserving the fatal state for real errors.
>>>
>>> Fixes: a729584ef975 ("erofs-utils: mkfs: avoid hanging if fragment is on and tmpdir is full")
>>> Reported-by: Bastian Schmitz <[email protected]>
>>> Closes: https://github.com/erofs/erofs-utils/issues/50
>>> Assisted-by: Codex:GPT-5.5
>>> Signed-off-by: Yifan Zhao <[email protected]>
>>> ---
>>> lib/compress.c | 6 +++++-
>>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/lib/compress.c b/lib/compress.c
>>> index ea07409..2a43b81 100644
>>> --- a/lib/compress.c
>>> +++ b/lib/compress.c
>>> @@ -2031,7 +2031,11 @@ err_free_idata:
>>> out:
>>> #ifdef EROFS_MT_ENABLED
>>> pthread_mutex_lock(&ictx->mutex);
>>> - ictx->seg_num = ret < 0 ? INT_MAX : 0;
>>> + if (ret < 0 && (ret != -ENOSPC || inode->fragment_size))
>>
>> Thanks for the fix! but why `inode->fragment_size`
>> is used here?
>>
> My understanding is that once inode->fragment_size is non-zero, -ENOSPC means real failure rather than compression fallback. (lib/compress.c:1374)
hmmm, I guess we should give another specific error
number for compression fallbacks instead to distiguish
no space and compression fallbacks...
Thanks,
Gao Xiang