diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2024-11-11 17:08:05 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-11-11 10:32:46 +0100 |
commit | a251dd9c71006c66a02064210ae103ed7ac59444 (patch) | |
tree | 6417b927c425c7c1e8bd8573a5a9e506036f1cd5 /ubifs-utils/fsck.ubifs/fsck.ubifs.c | |
parent | c5ca3893ea854e8d8b5916bc492db8523db70122 (diff) |
fsck.ubifs: Check and handle unreachable files
This is the 9/18 step of fsck. Check and handle unreachable files, the
checking rule is same as rebuild mode which has been implemented in
file_is_reachable, but the methods of handling are different:
1. Move unreachable regular file into disconnected list, let subsequent
steps to handle them with lost+found.
2. Delete unreachable non-regular file.
3. Delete unreachable directory entries.
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils/fsck.ubifs/fsck.ubifs.c')
-rw-r--r-- | ubifs-utils/fsck.ubifs/fsck.ubifs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ubifs-utils/fsck.ubifs/fsck.ubifs.c b/ubifs-utils/fsck.ubifs/fsck.ubifs.c index ac94ba4..6a718fd 100644 --- a/ubifs-utils/fsck.ubifs/fsck.ubifs.c +++ b/ubifs-utils/fsck.ubifs/fsck.ubifs.c @@ -453,6 +453,14 @@ static int do_fsck(void) goto free_used_lebs; } + log_out(c, "Check and handle unreachable files"); + err = handle_dentry_tree(c); + if (err) { + exit_code |= FSCK_ERROR; + goto free_disconnected_files; + } + +free_disconnected_files: destroy_file_list(c, &FSCK(c)->disconnected_files); free_used_lebs: kfree(FSCK(c)->used_lebs); @@ -495,6 +503,7 @@ int main(int argc, char *argv[]) * Step 6: Traverse tnc and construct files * Step 7: Update files' size * Step 8: Check and handle invalid files + * Step 9: Check and handle unreachable files */ err = do_fsck(); if (err && FSCK(c)->try_rebuild) { |