Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3700126rdb; Wed, 27 Dec 2023 17:38:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7KHGK31n2YxuCDieaEhpFwUELzqjF7RCRDmKhRLqEOPTyTvyGXyET2ekc5vaKHnjVU7nT X-Received: by 2002:a05:6a20:bca7:b0:196:d90:aa62 with SMTP id fx39-20020a056a20bca700b001960d90aa62mr1252499pzb.121.1703727497503; Wed, 27 Dec 2023 17:38:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703727497; cv=none; d=google.com; s=arc-20160816; b=Xy+kf/EVa+Ds3sRsttkTNMMDPuR0ztclaUElnWqJUeJu7ZK1ZIvjx4kaRbdv9Z/4YP pEtQs1UE1zQ24R69ys1ud7LFmz/JJcR0v8SWmWtxisUO0nHJ7qvAogeMuGnZnmhaRL9L e3A3eYzVwJEP8xHVYZSKCqJ186o9vA5Cj+kl4tm1YE8uHGJ/GRboOWUiD/Bhx4sVl0PD A8tOtciFnkZmpixE4WXb8xBRnF3OUNA+/xeO5kFAHDcFCRZbWoXaJ+Xp+UEtioKg7CIb iWNocRyEJIaVq74YblIBvPG0W0/+faOS6zvsp9dG7/2zdG9qukfqrn1JdNCaFwNoloK1 3aWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Cwd3puWL1uh73pNRNp7Av0rxka+YLdftGPOJ8oTLK2c=; fh=3kaVOPShTC55oj708yh1yJALapWuogKx6Yvc3sQq9zY=; b=SNyPJm96TSA/bnu7hGVgCA78krCdvtZK4+CtfxnjJjIn0iXNzttb+bD4umqra99Fpq 1R4upuLK6xhWHfugzHOadbT1aEz+ccJ/8TrYLC+cHC4Kjma8yS1aaVv4SGA5dizIEbZo 1QYDCSaDWzCYdQmqjijf45wMCQIQP65OIWJmjCbP4sw+yoYCtebKplVLtGAW5/fd+jfW 7CEoaXZVR4H7ZXWss6C2tbToL2YJlOKgp0TvQXYM3cBnb45drsuMrVBF3CgLTQu3lkLp BXnL4AV5REVdSUdGzHeew+ztjkMo3tGOVcj4d1YDS2n6rkj2P12ZMnoIqDAvDmRFgqQU Qd4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12348-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12348-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ju10-20020a170903428a00b001cff290413bsi11839893plb.390.2023.12.27.17.38.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 17:38:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12348-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12348-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12348-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 29F6B2823A2 for ; Thu, 28 Dec 2023 01:38:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A52D1374; Thu, 28 Dec 2023 01:38:12 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE26010E6 for ; Thu, 28 Dec 2023 01:38:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4T0rjg1yJMzMprn; Thu, 28 Dec 2023 09:37:43 +0800 (CST) Received: from kwepemm000013.china.huawei.com (unknown [7.193.23.81]) by mail.maildlp.com (Postfix) with ESMTPS id 813261402E0; Thu, 28 Dec 2023 09:38:06 +0800 (CST) Received: from huawei.com (10.175.127.227) by kwepemm000013.china.huawei.com (7.193.23.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 28 Dec 2023 09:38:05 +0800 From: Zhihao Cheng To: , , , , CC: , Subject: [PATCH RFC 00/17] ubifs: Add filesystem repair support Date: Thu, 28 Dec 2023 09:40:55 +0800 Message-ID: <20231228014112.2836317-1-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.31.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm000013.china.huawei.com (7.193.23.81) UBIFS repair provides a way to fix inconsistent UBIFS image(which is corrupted by hardware exceptions or UBIFS realization bugs) and makes filesystem become consistent, just like fsck tools(eg. fsck.ext4, fsck.f2fs, fsck.fat, etc.) do. About why do we need it, how it works, what it can fix or it can not fix, when and how to use it, see more details in Documentation/filesystems/ubifs/repair.rst (Patch 17). Testing on UBIFS repair refers to https://bugzilla.kernel.org/show_bug.cgi?id=218327 Whatever, we finally have a way to fix inconsistent UBFIS image instead of formatting UBI when UBIFS becomes inconsistent. Zhihao Cheng (17): ubifs: repair: Load filesystem info from volume ubifs: repair: Scan nodes from volume ubifs: repair: Remove deleted nodes from valid node tree ubifs: repair: Add valid nodes into file ubifs: repair: Filter invalid files ubifs: repair: Extract reachable directory entries tree ubifs: repair: Check and correct files' information ubifs: repair: Record used LEBs ubifs: repair: Re-write data ubifs: repair: Create new root dir if there are no scanned files ubifs: repair: Build TNC ubifs: Extract a helper function to create lpt ubifs: repair: Build LPT ubifs: repair: Clean up log and orphan area ubifs: repair: Write master node ubifs: Enable ubifs_repair in '/sys/kernel/debug/ubifs/repair_fs' Documentation: ubifs: Add ubifs repair whitepaper Documentation/filesystems/index.rst | 3 +- .../authentication.rst} | 0 Documentation/filesystems/ubifs/index.rst | 11 + .../filesystems/{ubifs.rst => ubifs/main.rst} | 0 Documentation/filesystems/ubifs/repair.rst | 235 ++ MAINTAINERS | 5 +- fs/ubifs/Makefile | 2 +- fs/ubifs/debug.c | 57 +- fs/ubifs/debug.h | 2 + fs/ubifs/journal.c | 39 +- fs/ubifs/lpt.c | 140 +- fs/ubifs/repair.c | 2651 +++++++++++++++++ fs/ubifs/repair.h | 176 ++ fs/ubifs/sb.c | 24 +- fs/ubifs/super.c | 10 +- fs/ubifs/ubifs.h | 113 +- 16 files changed, 3315 insertions(+), 153 deletions(-) rename Documentation/filesystems/{ubifs-authentication.rst => ubifs/authentication.rst} (100%) create mode 100644 Documentation/filesystems/ubifs/index.rst rename Documentation/filesystems/{ubifs.rst => ubifs/main.rst} (100%) create mode 100644 Documentation/filesystems/ubifs/repair.rst create mode 100644 fs/ubifs/repair.c create mode 100644 fs/ubifs/repair.h -- 2.31.1