[PATCH] erofs-utils: lib: fix compressed packed inodes
Gao Xiang
hsiangkao at linux.alibaba.com
Mon Sep 23 15:02:58 AEST 2024
Hi Danny,
On 2024/9/23 12:36, Danny Lin wrote:
> On Sun, Sep 22, 2024 at 9:30 PM Danny Lin <danny at orbstack.dev> wrote:
>>
>> On Sun, Sep 22, 2024 at 8:03 PM Gao Xiang <hsiangkao at linux.alibaba.com> wrote:
>>>
>>> Hi Danny,
>>>
>>> On 2024/9/23 08:08, Gao Xiang wrote:
>>>> Hi Danny,
>>>>
>>>> Thanks for the patch!
>>>> Sorry I somewhat missed the previous email..
>>>>
>>>> On 2024/9/22 13:08, Danny Lin wrote:
>>>>> Gentle bump — let me know if anything needs to be changed!
>>>>
>>>> Does the following change resolve the issue too?
>>
>> Thanks for the suggestion. I tried your patch and it segfaults instead.
>
> I think the segfault is because it returns ERR_PTR(0) instead of inode
> on success. That should be an easy fix but we'd still be skipping
> erofs_prepare_inode_buffer and erofs_write_tail_end.
Yeah, correct, thanks for catching! so I think just?
@@ -1927,7 +1926,9 @@ struct erofs_inode *erofs_mkfs_build_special_from_fd(struct erofs_sb_info *sbi,
DBG_BUGON(!ictx);
ret = erofs_write_compressed_file(ictx);
- if (ret && ret != -ENOSPC)
+ if (!ret)
+ goto out;
+ if (ret != -ENOSPC)
return ERR_PTR(ret);
ret = lseek(fd, 0, SEEK_SET);
@@ -1937,6 +1938,7 @@ struct erofs_inode *erofs_mkfs_build_special_from_fd(struct erofs_sb_info *sbi,
ret = write_uncompressed_file_from_fd(inode, fd);
if (ret)
return ERR_PTR(ret);
+out:
erofs_prepare_inode_buffer(inode);
erofs_write_tail_end(inode);
return inode;
>
>>
>> From a quick glance at the surrounding code, it doesn't seem correct
>> because the calls to erofs_prepare_inode_buffer and
>> erofs_write_tail_end are skipped if ret == 0.
>>
>>>>
>>>> Also I think it
>>>> Fixes: 2fdbd28ad4a3 ("erofs-utils: lib: fix uncompressed packed inode")
>>
>> Ah, nice catch. Do you want me to resubmit or will you fix it when
>> applying the patch?
Could you please resubmit since you're credited on this?
Thanks,
Gao Xiang
More information about the Linux-erofs
mailing list