Re: [PATCH RFC 00/17] ubifs: Add filesystem repair support
From: Zhihao Cheng
Date: Wed Jan 03 2024 - 07:44:34 EST
在 2024/1/3 11:18, Zhihao Cheng 写道:
在 2024/1/3 4:45, Richard Weinberger 写道:
----- Ursprüngliche Mail -----
Von: "chengzhihao1" <chengzhihao1@xxxxxxxxxx>
I come up with another way to implement fsck.ubifs:
There are three modes:
1. common mode(no options): Ask user whether to fix as long as a problem
is detected.
Makes sense.
2. safe mode(-a option): Auto repair as long as no data/files lost(eg.
nlink, isize, xattr_cnt, which can be corrected without dropping nodes),
otherwise returns error code.
Makes sense.
3. dangerous mode(-y option): Fix is always successful, unless
superblock is corrupted. There are 2 situations:
Please not use "-y". Usually "-y" stands for "answer yes to all
questions".
But selecting names for command line flags is currently my least concern.
a) TNC is valid: fsck will print which file is dropped and which
file's data is dropped
Sounds also good.
b) TNC is invalid: fsck will scan all nodes without referencing TNC,
same as this patchset does
I'd make this a distinct mode.
It can be used to rebuild index and LEB property trees.
This is basically a "drop trees and rebuild" mode.
OK, then fsck will have four modes.
How about merging 3(a) and 3(b) as one mode(dangerous mode)? If fsck can
get a good TNC(all non-leaf index nodes are valid), fsck executes as
3(a) describes. If fsck cannot find a good TNC, fsck executes as 3(b)
and reminds user that "TNC is damaged, nodes dropping is not awared".