[PATCH v3] erofs-utils: fix battach on full buffer blocks

Li GuiFu bluce.lee at aliyun.com
Tue Feb 23 02:34:25 AEDT 2021



On 2021/2/15 0:00, Gao Xiang via Linux-erofs wrote:
> From: Hu Weiwen <sehuww at mail.scut.edu.cn>
> 
> When the subsequent erofs_battach() is called on an buffer block of
> which (bb->buffers.off % EROFS_BLKSIZ == 0), `tail_blkaddr' won't be
> updated correctly. This bug can be reproduced by:
> 
> mkdir bug-repo
> head -c 4032 /dev/urandom > bug-repo/1
> head -c 4095 /dev/urandom > bug-repo/2
> head -c 12345 /dev/urandom > bug-repo/3  # arbitrary size
> mkfs.erofs -Eforce-inode-compact bug-repo.erofs.img bug-repo
> Then mount this image and see that file `3' in the image is different
> from `bug-repo/3'.
> 
> This patch fix this by:
>  * Handle `oob' and `tail_blkaddr' for the case above properly;
>  * Don't inline tail-packing data for such case, since the tail-packing
>    data is actually in a different block from inode itself even kernel
>    can handle such cases properly.
> 
> Signed-off-by: Hu Weiwen <sehuww at mail.scut.edu.cn>
> Reviewed-by: Gao Xiang <hsiangkao at aol.com>
> Signed-off-by: Gao Xiang <hsiangkao at aol.com>
> ---

It looks good
Reviewed-by: Li Guifu <bluce.lee at aliyun.com>

Thanks,


More information about the Linux-erofs mailing list