diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2024-11-11 17:01:22 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-11-11 10:32:46 +0100 |
commit | cf844f788d34e1facf142910b955554c69eb8f9b (patch) | |
tree | 1da22bb52854b759515661b41ea1fb4b53524a91 /ubifs-utils/libubifs/ubifs.h | |
parent | 3f8ee068870a046b0dcf2921ed7ee375f405e49f (diff) |
fsck.ubifs: Replay journal
This is the 2/18 step of fsck. Replay journal, update TNC & LPT.
There could be following steps and possible errors:
Step 1. scan log LEB, get all bud LEBs
a. corrupted scanning data in log area: danger mode with rebuild_fs and
normal mode with 'yes' answer will turn to rebuild filesystem, other
modes will exit.
Step 2. scan bud LEBs, get all nodes
a. corrupted scanning data in bud LEB: danger mode and normal mode with
'yes' answer will drop bud LEB and set %FR_LPT_INCORRECT for lpt
status, other modes will exit.
Step 3. apply nodes, record latest isize into size_tree
Step 4. apply nodes, update TNC & LPT
a. corrupted data searched from TNC: skip node and set %FR_LPT_INCORRECT
lpt status for danger mode and normal mode with 'yes' answer, other
modes will exit.
b. corrupted index node read from TNC: danger mode with rebuild_fs and
normal mode with 'yes' answer will turn to rebuild filesystem, other
modes will exit.
c. corrupted lpt: Set %FR_LPT_CORRUPTED for lpt status. Ignore the
error.
d. incorrect lpt: Set %FR_LPT_INCORRECT for lpt status. Ignore the
error.
e. If lpt status is not empty, skip updating lpt.
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils/libubifs/ubifs.h')
-rw-r--r-- | ubifs-utils/libubifs/ubifs.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ubifs-utils/libubifs/ubifs.h b/ubifs-utils/libubifs/ubifs.h index 6f96555..ae812ff 100644 --- a/ubifs-utils/libubifs/ubifs.h +++ b/ubifs-utils/libubifs/ubifs.h @@ -1286,7 +1286,7 @@ struct ubifs_info { bool (*can_ignore_failure_cb)(const struct ubifs_info *c, unsigned int reason); bool (*handle_failure_cb)(const struct ubifs_info *c, - unsigned int reason); + unsigned int reason, void *priv); }; extern atomic_long_t ubifs_clean_zn_cnt; @@ -1542,6 +1542,11 @@ enum { FR_LPT_CORRUPTED = 4, /* LPT is corrupted */ FR_LPT_INCORRECT = 8 /* Space statistics are wrong */ }; +/* Partial failure reasons in common libs, which are handled by fsck. */ +enum { + FR_H_BUD_CORRUPTED = 0, /* Bud LEB is corrupted */ + FR_H_TNC_DATA_CORRUPTED, /* Data searched from TNC is corrupted */ +}; /* Callback functions for failure(which can be handled by fsck) happens. */ static inline void set_failure_reason_callback(const struct ubifs_info *c, unsigned int reason) @@ -1596,10 +1601,10 @@ static inline bool can_ignore_failure_callback(const struct ubifs_info *c, return false; } static inline bool handle_failure_callback(const struct ubifs_info *c, - unsigned int reason) + unsigned int reason, void *priv) { if (c->handle_failure_cb) - return c->handle_failure_cb(c, reason); + return c->handle_failure_cb(c, reason, priv); return false; } |