aboutsummaryrefslogtreecommitdiff
path: root/ubifs-utils/fsck.ubifs/problem.c
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2024-11-11 17:08:05 +0800
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-11-11 10:32:46 +0100
commita251dd9c71006c66a02064210ae103ed7ac59444 (patch)
tree6417b927c425c7c1e8bd8573a5a9e506036f1cd5 /ubifs-utils/fsck.ubifs/problem.c
parentc5ca3893ea854e8d8b5916bc492db8523db70122 (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/problem.c')
-rw-r--r--ubifs-utils/fsck.ubifs/problem.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ubifs-utils/fsck.ubifs/problem.c b/ubifs-utils/fsck.ubifs/problem.c
index 9222cba..0395a34 100644
--- a/ubifs-utils/fsck.ubifs/problem.c
+++ b/ubifs-utils/fsck.ubifs/problem.c
@@ -58,6 +58,7 @@ static const struct fsck_problem problem_table[] = {
{PROBLEM_FIXABLE | PROBLEM_MUST_FIX | PROBLEM_DROP_DATA, "Encrypted file has no encryption information"}, // FILE_HAS_NO_ENCRYPT
{PROBLEM_FIXABLE | PROBLEM_MUST_FIX, "File is disconnected(regular file without dentries)"}, // FILE_IS_DISCONNECTED
{PROBLEM_FIXABLE | PROBLEM_MUST_FIX | PROBLEM_DROP_DATA, "Root dir should not have a dentry"}, // FILE_ROOT_HAS_DENT
+ {PROBLEM_FIXABLE | PROBLEM_MUST_FIX | PROBLEM_DROP_DATA, "Dentry is unreachable"}, // DENTRY_IS_UNREACHABLE
};
static const char *get_question(const struct fsck_problem *problem,
@@ -84,6 +85,7 @@ static const char *get_question(const struct fsck_problem *problem,
case XATTR_HAS_WRONG_HOST:
case FILE_HAS_NO_ENCRYPT:
case FILE_ROOT_HAS_DENT:
+ case DENTRY_IS_UNREACHABLE:
return "Delete it?";
case FILE_HAS_INCONSIST_TYPE:
case FILE_HAS_TOO_MANY_DENT:
@@ -198,6 +200,18 @@ static void print_problem(const struct ubifs_info *c,
host->ino.is_xattr ? "(xattr)" : "");
break;
}
+ case DENTRY_IS_UNREACHABLE:
+ {
+ const struct invalid_file_problem *ifp = (const struct invalid_file_problem *)priv;
+ const struct scanned_dent_node *dent_node = (const struct scanned_dent_node *)ifp->priv;
+
+ log_out(c, "problem: %s, ino %lu, unreachable dentry %s, type %s%s",
+ problem->desc, ifp->file->inum,
+ c->encrypted && !ifp->file->ino.is_xattr ? "<encrypted>" : dent_node->name,
+ ubifs_get_type_name(dent_node->type),
+ key_type(c, &dent_node->key) == UBIFS_XENT_KEY ? "(xattr)" : "");
+ break;
+ }
default:
log_out(c, "problem: %s", problem->desc);
break;