Hi Weiwen, On Fri, Jan 22, 2021 at 12:26:06AM +0800, Hu Weiwen wrote: > When __erofs_battach() is called on an buffer block of which > (bb->buffers.off % EROFS_BLKSIZ == 0), `tail_blkaddr' will not 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: > > * Don't inline tail-end data in this case, since the tail-end data will > be in a different block from inode. > * Correctly handle `battach' in this case. > > Signed-off-by: Hu Weiwen <[email protected]> > --- > Hi Xiang, > > I still think send this as a seperate patch would be better. In previous v6 > patch, I have fixed the erofs_mapbh() behaviour so that there should be no > user-visible bug introduced in that patch. And this patch is almost unrelated > to that optimization. > > Compared with v1, this version fixes an error when compression is enabled.
I cannot tell too much of it for now (since it's not an obvious update, I need to investagate). I will leave it this weekend. Thanks, Gao Xiang > > Thanks, > Hu Weiwen
