On 2021/2/15 0:00, Gao Xiang via Linux-erofs wrote:
> From: Hu Weiwen <[email protected]>
>
> 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 <[email protected]>
> Reviewed-by: Gao Xiang <[email protected]>
> Signed-off-by: Gao Xiang <[email protected]>
> ---
It looks good
Reviewed-by: Li Guifu <[email protected]>
Thanks,