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

胡玮文 sehuww at mail.scut.edu.cn
Tue Jan 19 02:52:05 AEDT 2021


Hi Xiang,

I would like to. If I understand it correctly, tests should based on
experimental-tests branch, and be submitted to this mail-list, too?

I wonder if we already have some CI service set up to run these tests
automatically? I saw a mail from Travis CI in the mail-list archive, but it
seems I don't have access to that organization.

On Mon, Jan 18, 2021 at 09:59:16PM +0800, Gao Xiang wrote:
> Hi Weiwen,
> 
> On Mon, Jan 18, 2021 at 08:39:45PM +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.
> > 
> 
> I will evaluate this condition later, yet if you have some interest
> and extra time, could you also help on writing a regression testcase
> for this, so we can look after such regression in case of the future
> code changes?
> 
> This is also an ongoing work for the next erofs-utils release, see:
> https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/
> 
> Thanks,
> Gao Xiang



More information about the Linux-erofs mailing list