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=-8.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 CC681C43467 for ; Mon, 12 Oct 2020 15:29:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E7522080D for ; Mon, 12 Oct 2020 15:29:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389975AbgJLP3Q (ORCPT ); Mon, 12 Oct 2020 11:29:16 -0400 Received: from mx2.suse.de ([195.135.220.15]:47516 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388984AbgJLP3Q (ORCPT ); Mon, 12 Oct 2020 11:29:16 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 418E2ACAC; Mon, 12 Oct 2020 15:29:14 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 7D9401E12F5; Mon, 12 Oct 2020 17:29:13 +0200 (CEST) Date: Mon, 12 Oct 2020 17:29:13 +0200 From: Jan Kara To: =?utf-8?B?5bi45Yek5qWg?= Cc: "Theodore Y. Ts'o" , Andreas Dilger , Jan Kara , linux-ext4 , Fengnan Chang Subject: Re: [PATCH v4] jbd2: avoid transaction reuse after reformatting Message-ID: <20201012152913.GI23665@quack2.suse.cz> References: <20201007081319.16341-1-jack@suse.cz> <20201009021651.GI235506@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri 09-10-20 19:06:41, 常凤楠 wrote: > Hi Jan: > Thank you for your suggestions,I tested the new version of > the patch,I think there still have some prblems. 1. Looks > like you think jbd2_has_feature_checksum can determine that CRC is > enabled,but this is different from jbd2_journal_has_csum_v2or3. so when > csum is v2 or v3, this is still have problem. 2. This patch > looks fixed the situations of descriptor and revoke block, commit block > is not considered. Maybe it’s because my previous modification was > problematic,I have a new idea, how about check crc first and compare > timestap,if check crc is failed, then compare timestap, this way the risk > will be much smaller. What do you think? Hum, you're right that commit block checking will not work with v2/v3 checksums. Thanks for catching that! I like the order of checks you propose to fix the problem, I'll update the patch. Thanks! Honza > ------------------ Original ------------------ > From: "Theodore Y. Ts'o" Date: Fri, Oct 9, 2020 10:16 AM > To: "Andreas Dilger" Cc: "Jan Kara" Subject: Re: [PATCH v4] jbd2: avoid transaction reuse after reformatting > > > > On Thu, Oct 08, 2020 at 02:13:02PM -0600, Andreas Dilger wrote: > > On Oct 7, 2020, at 2:13 AM, Jan Kara > > > > > From: changfengnan > > > > > When ext4 is formatted with lazy_journal_init=1 and transactions from > > > the previous filesystem are still on disk, it is possible that they are > > > considered during a recovery after a crash. Because the checksum seed > > > has changed, the CRC check will fail, and the journal recovery fails > > > with checksum error although the journal is otherwise perfectly valid. > > > Fix the problem by checking commit block time stamps to determine > > > whether the data in the journal block is just stale or whether it is > > > indeed corrupt. > > > > > > Reported-by: kernel test robot > > Signed-off-by: Fengnan Chang > > Signed-off-by: Jan Kara > > > Reviewed-by: Andreas Dilger > > > NB: one trivial formatting cleanup if patch is refreshed > > > > Applied, thanks.  I fixed the trivial format cleanup you pointed out, > plus a whitespace fix pointed out by checkpatch. > >                         - Ted -- Jan Kara SUSE Labs, CR