[PATCH RFC 00/17] ubifs: Add filesystem repair support

From: Zhihao Cheng
Date: Wed Dec 27 2023 - 20:38:16 EST


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