From patchwork Wed Sep 29 03:55:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "yebin (H)" X-Patchwork-Id: 1534206 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HK2N52kwgz9svs for ; Wed, 29 Sep 2021 13:45:57 +1000 (AEST) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4HK2N44Dzzz4xLs for ; Wed, 29 Sep 2021 13:45:56 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4HK2N44CGcz4xbL; Wed, 29 Sep 2021 13:45:56 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4HK2N448Vhz4xLs for ; Wed, 29 Sep 2021 13:45:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244057AbhI2Drf (ORCPT ); Tue, 28 Sep 2021 23:47:35 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:12967 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239845AbhI2Dre (ORCPT ); Tue, 28 Sep 2021 23:47:34 -0400 Received: from dggeme754-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HK2LV0CvnzWVgX; Wed, 29 Sep 2021 11:44:34 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggeme754-chm.china.huawei.com (10.3.19.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Wed, 29 Sep 2021 11:45:52 +0800 From: Ye Bin To: , , CC: , , Ye Bin Subject: [PATCH -next] jbd2: discard last transaction when commit block checksum broken in v2v3 Date: Wed, 29 Sep 2021 11:55:28 +0800 Message-ID: <20210929035528.1990993-1-yebin10@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggeme754-chm.china.huawei.com (10.3.19.100) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Now, we meet an issue that commit block has broken checksum when cold reboot device, that lead to mount failed. The reason maybe only some sector store on disk, and then device power off. But we calculate checksum with whole logic block.The data stored on disk can only ensure the atomicity of sector level. Actually, we already replay previous transactions. We can just discard last transaction. As now, descriptor/revocation/commit/superblock has it's own checksum. Fixes:80b3767fbe15("jbd2: don't wipe the journal on a failed journal checksum") Signed-off-by: Ye Bin --- fs/jbd2/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 35302bc192eb..a3dd7b757b3d 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -2080,7 +2080,7 @@ int jbd2_journal_load(journal_t *journal) if (jbd2_journal_recover(journal)) goto recovery_error; - if (journal->j_failed_commit) { + if (journal->j_failed_commit && !jbd2_journal_has_csum_v2or3(journal)) { printk(KERN_ERR "JBD2: journal transaction %u on %s " "is corrupt.\n", journal->j_failed_commit, journal->j_devname);