vfs: tolerate fs construction failures

When trying to apply dynamic config updates to the VFS, don't rely on
the assumption that one file-system instance exists for each XML node
because a malconfigured file-system route may result in a skipped
file-system construction. Print a diagnostic message instead.

Encountered while working on issue #5445
This commit is contained in:
Norman Feske 2025-02-06 15:10:48 +01:00 committed by Christian Helmuth
parent 0174e24f5c
commit b6cd11abc8

View File

@ -872,10 +872,15 @@ class Vfs::Dir_file_system : public File_system
for (unsigned i = 0; i < node.num_sub_nodes(); i++, curr = curr->next) {
Xml_node const &sub_node = node.sub_node(i);
if (!curr) {
error("VFS config update missed file system for ", sub_node);
return;
}
/* check if type of XML node matches current file-system type */
if (sub_node.has_type(curr->type()) == false) {
Genode::error("VFS config update failed (node type '",
sub_node.type(), "' != fs type '", curr->type(),"')");
if (!curr || sub_node.has_type(curr->type()) == false) {
error("VFS config update failed (node type '",
sub_node.type(), "' != fs type '", curr->type(),"')");
return;
}