Fix NODE_MAPPER reparenting error

This commit is contained in:
Mark
2019-10-29 13:54:07 +02:00
parent b02354e766
commit a36365c833
+5 -2
View File
@@ -432,19 +432,22 @@ static int vfs_mount_internal(struct vfs_node *at, void *blkdev, const char *fs_
if ((res = fs_class->mapper(fs, &fs_root_node)) < 0) {
panic("Node mapper function failed\n");
}
_assert(fs_root_node);
_assert(fs_root_node->vnode);
fs_root = fs_root_node->vnode;
// Reparent vnode to the actual mountpoint
fs_root->tree_node = at;
_assert(!at->child);
// Reparent fs_root_node children to the actual mountpoint
for (struct vfs_node *child = fs_root_node->child; child; child = child->cdr) {
struct vfs_node *child = fs_root_node->child;
while (child) {
struct vfs_node *cdr = child->cdr;
child->parent = at;
child->cdr = at->child;
at->child = child;
child = cdr;
}
// Root node can be freed