diff options
author | Huang Xiaojia <huangxiaojia2@huawei.com> | 2024-11-11 17:08:14 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-11-11 10:32:46 +0100 |
commit | fda7068da735d3e574bc46b70d3af62a5db8e908 (patch) | |
tree | 69d9e10d411a291305da3542ea644a35c50aec7f /ubifs-utils/fsck.ubifs/fsck.ubifs.c | |
parent | b064a78fb9a9503a4bf87a5149ca8fe5711b2cff (diff) |
fsck.ubifs: Check and create the lost+found
This is the 16/18 step of fsck. Check whether the lost+found is existed,
create a new one if it is not found. This step makes sure that disconnected
file can be recovered under the lost+found.
Signed-off-by: Huang Xiaojia <huangxiaojia2@huawei.com>
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 | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ubifs-utils/fsck.ubifs/fsck.ubifs.c b/ubifs-utils/fsck.ubifs/fsck.ubifs.c index b97c8e3..550d3f9 100644 --- a/ubifs-utils/fsck.ubifs/fsck.ubifs.c +++ b/ubifs-utils/fsck.ubifs/fsck.ubifs.c @@ -526,8 +526,20 @@ static int do_fsck(void) log_out(c, "Check and create root dir"); err = check_and_create_root(c); - if (err) + if (err) { + exit_code |= FSCK_ERROR; + goto free_disconnected_files_2; + } + + if (list_empty(&FSCK(c)->disconnected_files)) + return err; + + log_out(c, "Check and create lost+found"); + err = check_and_create_lost_found(c); + if (err) { exit_code |= FSCK_ERROR; + goto free_disconnected_files_2; + } free_disconnected_files_2: destroy_file_list(c, &FSCK(c)->disconnected_files); @@ -583,6 +595,7 @@ int main(int argc, char *argv[]) * Step 13: Commit problem fixing modifications * Step 14: Check and correct the index size * Step 15: Check and create root dir + * Step 16: Check and create lost+found */ err = do_fsck(); if (err && FSCK(c)->try_rebuild) { |