kernel: Add reference counting for mounts
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This will make sure we cannot unmount a file system while there is another one mounted inside it.
This commit is contained in:
parent
3a73d49aa1
commit
d7c563aebd
@ -13,7 +13,14 @@ Result<SharedPtr<VFS::Inode>> MountInode::create(SharedPtr<VFS::Inode> source, S
|
|||||||
auto parent = TRY(source->find(".."));
|
auto parent = TRY(source->find(".."));
|
||||||
TRY(fs->set_mount_dir(parent));
|
TRY(fs->set_mount_dir(parent));
|
||||||
|
|
||||||
|
source->add_handle();
|
||||||
|
|
||||||
g_mounts.append(inode.ptr());
|
g_mounts.append(inode.ptr());
|
||||||
|
|
||||||
return (SharedPtr<VFS::Inode>)inode;
|
return (SharedPtr<VFS::Inode>)inode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MountInode::~MountInode()
|
||||||
|
{
|
||||||
|
m_source->remove_handle();
|
||||||
|
}
|
||||||
|
@ -137,7 +137,7 @@ class MountInode : public VFS::Inode, public LinkedListNode<MountInode>
|
|||||||
return m_mount_root_inode->replace_entry(inode, name);
|
return m_mount_root_inode->replace_entry(inode, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~MountInode() = default;
|
virtual ~MountInode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SharedPtr<VFS::Inode> m_source;
|
SharedPtr<VFS::Inode> m_source;
|
||||||
|
Loading…
Reference in New Issue
Block a user