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

2021-02-14 Thread Gao Xiang via Linux-erofs
From: Hu Weiwen 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

[PATCH v2 2/2] erofs-utils: more sanity check for buffer allocation optimization

2021-02-14 Thread Gao Xiang via Linux-erofs
From: Gao Xiang In case that new buffer allocation optimization logic is potentially broken. Signed-off-by: Gao Xiang --- changes since v1: - add a more check "used_before != cur->buffers.off % EROFS_BLKSIZ" lib/cache.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git

[PATCH v2 1/2] erofs-utils: don't reuse full mapped buffer blocks

2021-02-14 Thread Gao Xiang via Linux-erofs
From: Gao Xiang Full mapped buffer blocks aren't the targets for reusing. Fixes: 185b0bcdef4b ("erofs-utils: optimize buffer allocation logic") Signed-off-by: Gao Xiang --- changes since v1: - update commit message since "erofs-utils: fix battach on full buffer blocks" has been considered i

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

2021-02-14 Thread Gao Xiang via Linux-erofs
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/urand