From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,MIME_QP_LONG_LINE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE5A1C433DB for ; Wed, 20 Jan 2021 04:58:28 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01BE623110 for ; Wed, 20 Jan 2021 04:58:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01BE623110 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mail.scut.edu.cn Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DLCw14szRzDqr6 for ; Wed, 20 Jan 2021 15:58:25 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=mail.scut.edu.cn (client-ip=202.38.213.20; helo=mail.scut.edu.cn; envelope-from=sehuww@mail.scut.edu.cn; receiver=) Received: from mail.scut.edu.cn (stumail1.scut.edu.cn [202.38.213.20]) by lists.ozlabs.org (Postfix) with ESMTP id 4DLCvn6pBFzDqG0 for ; Wed, 20 Jan 2021 15:58:09 +1100 (AEDT) Received: from [192.168.43.20] (unknown [113.115.40.34]) by front (Coremail) with SMTP id AWSowAAnLQU1uAdgw_rTAQ--.61228S2; Wed, 20 Jan 2021 12:57:27 +0800 (CST) Content-Type: multipart/alternative; boundary=Apple-Mail-5FE531C4-B5B1-4CAB-823C-0947073B8D9A Content-Transfer-Encoding: 7bit From: =?utf-8?B?6IOh546u5paH?= Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] erofs-utils: fix battach on full buffer block Date: Wed, 20 Jan 2021 12:57:39 +0800 Message-Id: <32A61DA5-EED5-4268-B6C5-CAAB94527F91@mail.scut.edu.cn> References: <20210119154335.GB2601261@xiangao.remote.csb> In-Reply-To: <20210119154335.GB2601261@xiangao.remote.csb> To: Gao Xiang X-Mailer: iPad Mail (18C66) X-CM-TRANSID: AWSowAAnLQU1uAdgw_rTAQ--.61228S2 X-Coremail-Antispam: 1UD129KBjvJXoW7trWkKF4kGF1rWF1kAry7ZFb_yoW8ZF4rp3 9rK3WkKrWktF1vyr1xJw12v34Iy3s5Gr93Kry5uryvvrZxXFy8CryIkr4j93srX397AFWj va18uwn5Jay5Z3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUyab7Iv0xC_tr1lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwV C2z280aVCY1x0267AKxVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21lYx0E2Ix0 cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8Jw ACjcxG0xvY0x0EwIxGrwCjr7xvwVCIw2I0I7xG6c02F41l42xK82IYc2Ij64vIr41l4I8I 3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUGVWUWwC20s026x8GjcxK67AKxV WUGVWUWwC2zVAF1VAY17CE14v26r1Y6r17MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAF wI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcI k0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_ Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8wYFtUUUUU== X-CM-SenderInfo: qsqrljqqwxllyrt6zt1loo2ulxwovvfxof0/1tbiAQAFBlepTBDbiwAVsl X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-erofs@lists.ozlabs.org Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" --Apple-Mail-5FE531C4-B5B1-4CAB-823C-0947073B8D9A Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > =E5=9C=A8 2021=E5=B9=B41=E6=9C=8819=E6=97=A5=EF=BC=8C23:43=EF=BC=8CGao Xia= ng =E5=86=99=E9=81=93=EF=BC=9A >=20 > =EF=BB=BFHi Weiwen, >=20 >> On Tue, Jan 19, 2021 at 02:02:56PM +0800, =E8=83=A1=E7=8E=AE=E6=96=87 wro= te: >> Hi Xiang, >>=20 >> After further investgate, this bug will not reveal in any released versio= n of >> mkfs.erofs. Previous patch v5 [1] will map all allocated bb when erofs_ma= pbh() >> is called on an already mapped bb, which triggers this bug. before that p= atch, >> under the same condition, __erofs_battach() will only be called on bb whi= ch is >> not mapped, thus no need to update `tail_blkaddr'. >=20 > Good to know this, thanks! I haven't looked into that (I will test it this= > weekend.) IMO, although this is not a regression, yet it seems it's potent= ial > harmful if we didn't notice this... So I think a proper testcase is still > useful to look after this... If you have extra time, could you help on it?= Hi Xiang, I=E2=80=99m working on this. I have written a test case for this. And I=E2=80= =99m also working on setting up GitHub actions to run tests automatically. S= o far, I=E2=80=99ve got uncompressed tests works, but when lz4 is enable, al= l test (except 001) fail. I have not found out why. You may see my progress a= t https://github.com/huww98/erofs-utils/tree/experimental-tests. I will send= patches once everything is sorted out. > Also, without the detail of this, I think the fix might be folded into > the original patchset (could you resend it?). In addition, I think after You mean add a new commit [PATCH v6 3/3], or merge it into [PATCH v7 2/2]? I= send it as a separate patch set because it may be merged independent of the= cache.c optimization. > last_mapped_block is introduced, we might not need tail_blkaddr anymore, > not sure. But I'm very cautious about this in case of introducing any > new regression... I think we still need it, because already mapped bb may be dropped, last_map= _block does not always reflect tail_blkaddr. Hu Weiwen > Thanks, > Gao Xiang >=20 >>=20 >> [1]: https://lore.kernel.org/linux-erofs/20210118123431.22533-1-sehuww@ma= il.scut.edu.cn/ >>=20 >> Hu Weiwen >>=20 --Apple-Mail-5FE531C4-B5B1-4CAB-823C-0947073B8D9A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
=E5=9C=A8 2021=E5=B9=B41=E6=9C=8819=E6=97=A5=EF=BC=8C23:43=EF=BC=8CGao X= iang <hsiangkao@redhat.com> =E5=86=99=E9=81=93=EF=BC=9A

=EF=BB=BFHi Wei= wen,

On Tue, Jan 19, 2021 at 02:02:56PM +08= 00, =E8=83=A1=E7=8E=AE=E6=96=87 wrote:
<= span>Hi Xiang,

After further investgate, t= his bug will not reveal in any released version of
mkfs.erofs. Previous patch v5 [1] will map all= allocated bb when erofs_mapbh()
is called on an already mapped bb, which triggers this bug. befo= re that patch,
under t= he same condition, __erofs_battach() will only be called on bb which is
not mapped, thus no need t= o update `tail_blkaddr'.

Good t= o know this, thanks! I haven't looked into that (I will test it this<= br>weekend.) IMO, although this is not a regression, yet it seems it's= potential
harmful if we didn't notice this... So I think a p= roper testcase is still
useful to look after this... If you h= ave extra time, could you help on it?

=
Hi Xiang,

I=E2=80=99m working on this. I= have written a test case for this. And I=E2=80=99m also working on setting u= p GitHub actions to run tests automatically. So far, I=E2=80=99ve got uncomp= ressed tests works, but when lz4 is enable, all test (except 001) fail. I ha= ve not found out why. You may see my progress at https://github.com/huww9= 8/erofs-utils/tree/experimental-tests. I will send patches once everythi= ng is sorted out.

= Also, without the detail of this, I think the fix might be folded into
the original patchset (could you resend it?). In addition, I thin= k after

You mean add a new c= ommit [PATCH v6 3/3], or merge it into [PATCH v7 2/2]? I send it as a separa= te patch set because it may be merged independent of the cache.c optimizatio= n.

last_mapped_blo= ck is introduced, we might not need tail_blkaddr anymore,
no= t sure. But I'm very cautious about this in case of introducing anynew regression...

I thin= k we still need it, because already mapped bb may be dropped, last_map_block= does not always reflect tail_blkaddr.

Hu Weiwen

<= blockquote type=3D"cite">
Thanks,
Gao X= iang


<= /blockquote>
[1]: https://lore.kernel.org/lin= ux-erofs/20210118123431.22533-1-sehuww@mail.scut.edu.cn/

Hu Weiwen
<= span>
= --Apple-Mail-5FE531C4-B5B1-4CAB-823C-0947073B8D9A--