Skip to content

Commit

Permalink
vfs: tolerate fs construction failures
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nfeske committed Feb 6, 2025
1 parent f023c95 commit 8ef6acb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions repos/os/include/vfs/dir_file_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 8ef6acb

Please sign in to comment.