Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp398578pxb; Thu, 26 Aug 2021 05:55:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8YSySqO2ne3hU6v4RmzpHFFvTZc2NEZBA34MMn7TC4w1CiDDfpYGNFoT4dD9AfhdEr7+7 X-Received: by 2002:a02:5bc5:: with SMTP id g188mr3428525jab.136.1629982535635; Thu, 26 Aug 2021 05:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629982535; cv=none; d=google.com; s=arc-20160816; b=D0XSgfm9o0N9h5f0+1RvTvLi2VClWSZfUzJof04e/u4X0yijZCJTFhow3OAqu+fgeM o/dPw6hWdyWgo7NdXj25eecPwiWmTEUxiUKUdiCOsZCghuSwgpatUNNjkgDcZdIyQQXF 93XPyKqfJwYw2RGpW1Dh80fVEQq2gX84px9Y7VwPjEjxPE6qnGWiY7JVgPXbhElKP/ty Rm4A8IbhscLm0up/wik7TP/45Q5SDgO4JyMeQV0qBPTQQaTiQQvbU46ESLpenSfSLyyP P3d1EJdf1Zs8MPReVBDrD40CXCOXJNFhhUE1JQzpruN5hsb+w9iSSVDmZN0cvzgtNIWB Bfvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=lK9KJC+Qv+qKVYpS4TUxTy5Md7PmtmU3YzVs78GV8so=; b=vzkVFaqLyvAKro9nT+GXp7qObG/6ZOjaWtbQhjP4mjm2EV+LqxDeVtQW6n3voNb9rB Kk1QENMt+3lKAmgY/LDDj8KhcGQhldLEe6MBa8D//J7v44iDAf4kQHu2GMC79vKhRB1f O2XdoxTMvKgOxJSEsx6n5KIWyFYrDLBdDMXJgXkfRcGAXDOx38ehhmU6OnLxWSlWRBkj 7eyRZLSiZPab4TWt4n4PeSKmggKH5Apld/m2oFgpf89BPzFzAMX6jGmJOF23Gyc5lNqO RzqVu6ED2BYdE4t32o5HZeZxo0u0gcq0sf164Bq3UbyVgTRCqQEBbz93+nkB7idJPEro R6TQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f14si2547623jaj.115.2021.08.26.05.55.19; Thu, 26 Aug 2021 05:55:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242295AbhHZMyr (ORCPT + 99 others); Thu, 26 Aug 2021 08:54:47 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:18042 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242579AbhHZMyr (ORCPT ); Thu, 26 Aug 2021 08:54:47 -0400 Received: from dggeme752-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GwN3g6ZNHzbjGv; Thu, 26 Aug 2021 20:50:07 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggeme752-chm.china.huawei.com (10.3.19.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Thu, 26 Aug 2021 20:53:58 +0800 From: Zhang Yi To: CC: , , , , Subject: [PATCH v4 0/6] ext4: fix a inode checksum error Date: Thu, 26 Aug 2021 21:04:06 +0800 Message-ID: <20210826130412.3921207-1-yi.zhang@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggeme752-chm.china.huawei.com (10.3.19.98) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org We find a checksum error and a inode corruption problem while doing stress test, this 6 patches address to fix them. The first patch is relate to the error simulation, and the 2-5 patches are prepare to do the fix. The last patch fix these two issue. - Checksum error EXT4-fs error (device sda): ext4_lookup:1784: inode #131074: comm cat: iget: checksum invalid - Inode corruption e2fsck 1.46.0 (29-Jan-2020) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Entry 'foo' in / (2) has deleted/unused inode 17. Clear? yes Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Inode bitmap differences: -17 Fix? yes Free inodes count wrong for group #0 (32750, counted=32751). Fix? yes Free inodes count wrong (32750, counted=32751). Fix? yes Changes since v3: - Postpone initialization to ext4_do_update_inode() may cause zeroout newly set xattr entry. So switch to do initialization in __ext4_get_inode_loc(). Changes since v2: - Instead of using WARN_ON_ONCE to prevent ext4_do_update_inode() return before filling the inode buffer, keep the error and postpone the report after the updating in the third patch. - Fix some language mistacks in the last patch. Changes since v1: - Add a patch to prevent ext4_do_update_inode() return before filling the inode buffer. - Do not use BH_New flag to indicate the empty buffer, postpone the zero and uptodate logic into ext4_do_update_inode() before filling the inode buffer. Thanks, Yi. Zhang Yi (6): ext4: move inode eio simulation behind io completeion ext4: remove an unnecessary if statement in __ext4_get_inode_loc() ext4: make the updating inode data procedure atomic ext4: factor out ext4_fill_raw_inode() ext4: move ext4_fill_raw_inode() related functions ext4: prevent getting empty inode buffer fs/ext4/inode.c | 490 +++++++++++++++++++++++++----------------------- 1 file changed, 257 insertions(+), 233 deletions(-) -- 2.31.1