From patchwork Tue Aug 11 11:44:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 11709123 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A1DFD14E3 for ; Tue, 11 Aug 2020 11:44:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93AA720768 for ; Tue, 11 Aug 2020 11:44:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728837AbgHKLo5 (ORCPT ); Tue, 11 Aug 2020 07:44:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:32910 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728454AbgHKLo5 (ORCPT ); Tue, 11 Aug 2020 07:44:57 -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 39A15AD75 for ; Tue, 11 Aug 2020 11:45:17 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 0/4] btrfs-progs: check: add the ability to repair extent item generation corruption Date: Tue, 11 Aug 2020 19:44:47 +0800 Message-Id: <20200811114451.28862-1-wqu@suse.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Although we have introduced the check ability to detect bad extent item generation, there is no repair ability. I thought it would be rare to hit, but real world cases prove I'm a total idiot. So this patchset will add the ability to repair, for both lowmem mode and original mode, along with enhanced test images. There is also a bug fix for original mode, which fails to detect such problem if it's a tree block. Changelog: v2: - Fix a type in the subject of the 4th patch - Fix a bracket for for a logical and and bit and The old code is fine and bit and has higher priority, but the bracket is intended to make that higher priority more obvious. Qu Wenruo (4): btrfs-progs: check/lowmem: add the ability to repair extent item generation btrfs-progs: check/original: don't reset extent generation for check_block() btrfs-progs: check/original: add the ability to repair extent item generation btrfs-progs: tests/fsck: enhance invalid extent item generation test cases check/main.c | 77 ++++++++++++++- check/mode-common.c | 59 ++++++++++++ check/mode-common.h | 3 + check/mode-lowmem.c | 89 ++++++++++++++++-- ...xz => bad_extent_item_gen_for_data.img.xz} | Bin .../bad_extent_item_gen_for_tree_block.img.xz | Bin 0 -> 1804 bytes .../test.sh | 19 ---- 7 files changed, 216 insertions(+), 31 deletions(-) rename tests/fsck-tests/044-invalid-extent-item-generation/{bad_extent_item_gen.img.xz => bad_extent_item_gen_for_data.img.xz} (100%) create mode 100644 tests/fsck-tests/044-invalid-extent-item-generation/bad_extent_item_gen_for_tree_block.img.xz delete mode 100755 tests/fsck-tests/044-invalid-extent-item-generation/test.sh