[PATCH] erofs-utils: mkfs: fix image reproducibility of `-E(all-)fragments`

Gao Xiang hsiangkao at linux.alibaba.com
Mon Jun 2 22:23:23 AEST 2025


Hi Hongbo,

On 2025/6/2 17:31, Hongbo Li wrote:
> Hi, Xiang,
> 
> On 2025/5/31 8:29, Gao Xiang wrote:
>> The timestamp of the packed inode should be fixed to the build time.
>>
>> Fixes: 9fa9b017f773 ("erofs-utils: mkfs: support fragments")
>> Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
>> ---
>>   lib/inode.c | 14 ++++++++++----
>>   1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/inode.c b/lib/inode.c
>> index 7a10624..ca49a80 100644
>> --- a/lib/inode.c
>> +++ b/lib/inode.c
>> @@ -910,7 +910,8 @@ out:
>>       return 0;
>>   }
>> -static bool erofs_should_use_inode_extended(struct erofs_inode *inode)
>> +static bool erofs_should_use_inode_extended(struct erofs_inode *inode,
>> +                        const char *path)
>>   {
>>       if (cfg.c_force_inodeversion == FORCE_INODE_EXTENDED)
>>           return true;
>> @@ -924,7 +925,8 @@ static bool erofs_should_use_inode_extended(struct erofs_inode *inode)
>>           return true;
>>       if (inode->i_nlink > USHRT_MAX)
>>           return true;
>> -    if ((inode->i_mtime != inode->sbi->build_time ||
>> +    if (path != EROFS_PACKED_INODE &&
>> +        (inode->i_mtime != inode->sbi->build_time ||
>>            inode->i_mtime_nsec != inode->sbi->build_time_nsec) &&
>>           !cfg.c_ignore_mtime)
>>           return true;
>> @@ -1016,6 +1018,10 @@ int __erofs_fill_inode(struct erofs_inode *inode, struct stat *st,
>>           erofs_err("gid overflow @ %s", path);
>>       inode->i_gid += cfg.c_gid_offset;
>> +    if (path == EROFS_PACKED_INODE) {
>> +        inode->i_mtime = sbi->build_time;
>> +        inode->i_mtime_nsec = 0;
>> +    }
>>       inode->i_mtime = st->st_mtime;
>>       inode->i_mtime_nsec = ST_MTIM_NSEC(st);
> 
> Should we put the condition in here? Because it will be reassigned if we do like this.

Oh, that is my fault, I will fix it soon.

> 
> And what about assigning sbi->build_time_nsec to inode->i_mtime_nsec like the FIXED case?

I just would like a quick fix for this because I have
other features to work on.

If you want to improve that, could you submit a patch?

Thanks,
Gao Xiang

> 
> Thanks,
> Hongbo
> 


More information about the Linux-erofs mailing list