Kernel: Fix all broken locks from new mutexes

This commit is contained in:
2024-02-28 22:39:02 +02:00
parent 1971813336
commit d94f6388b7
66 changed files with 681 additions and 647 deletions

View File

@@ -3,6 +3,7 @@
#include <BAN/Vector.h>
#include <kernel/Device/Device.h>
#include <kernel/FS/TmpFS/FileSystem.h>
#include <kernel/Lock/Mutex.h>
#include <kernel/Semaphore.h>
namespace Kernel
@@ -29,7 +30,7 @@ namespace Kernel
{ }
private:
mutable SpinLock m_device_lock;
mutable Mutex m_device_lock;
BAN::Vector<BAN::RefPtr<Device>> m_devices;

View File

@@ -106,7 +106,7 @@ namespace Kernel
};
private:
RecursiveSpinLock m_lock;
Mutex m_mutex;
BAN::RefPtr<BlockDevice> m_block_device;

View File

@@ -9,7 +9,8 @@
#include <kernel/API/DirectoryEntry.h>
#include <kernel/Credentials.h>
#include <kernel/SpinLock.h>
#include <kernel/Debug.h>
#include <kernel/Lock/Mutex.h>
#include <sys/socket.h>
#include <sys/types.h>
@@ -157,7 +158,7 @@ namespace Kernel
virtual BAN::ErrorOr<long> ioctl_impl(int request, void* arg) { return BAN::Error::from_errno(ENOTSUP); }
protected:
mutable RecursivePrioritySpinLock m_lock;
mutable PriorityMutex m_mutex;
private:
BAN::WeakPtr<SharedFileData> m_shared_region;

View File

@@ -2,7 +2,6 @@
#include <kernel/FS/Inode.h>
#include <kernel/Semaphore.h>
#include <kernel/SpinLock.h>
namespace Kernel
{

View File

@@ -4,9 +4,8 @@
#include <BAN/Iteration.h>
#include <kernel/FS/FileSystem.h>
#include <kernel/FS/TmpFS/Inode.h>
#include <kernel/LockGuard.h>
#include <kernel/Lock/LockGuard.h>
#include <kernel/Memory/PageTable.h>
#include <kernel/SpinLock.h>
namespace Kernel
{
@@ -119,7 +118,7 @@ namespace Kernel
private:
const dev_t m_rdev;
RecursiveSpinLock m_lock;
Mutex m_mutex;
BAN::HashMap<ino_t, BAN::RefPtr<TmpInode>> m_inode_cache;
BAN::RefPtr<TmpDirectoryInode> m_root_inode;
@@ -155,7 +154,7 @@ namespace Kernel
template<TmpFuncs::with_block_buffer_callback F>
void TmpFileSystem::with_block_buffer(size_t index, F callback)
{
LockGuard _(m_lock);
LockGuard _(m_mutex);
paddr_t block_paddr = find_block(index);
PageTable::with_fast_page(block_paddr, [&] {
BAN::ByteSpan buffer(reinterpret_cast<uint8_t*>(PageTable::fast_page()), PAGE_SIZE);
@@ -166,7 +165,7 @@ namespace Kernel
template<TmpFuncs::for_each_inode_callback F>
void TmpFileSystem::for_each_inode(F callback)
{
LockGuard _(m_lock);
LockGuard _(m_mutex);
for (auto& [_, inode] : m_inode_cache)
{
switch (callback(inode))

View File

@@ -3,7 +3,7 @@
#include <BAN/String.h>
#include <BAN/Vector.h>
#include <kernel/FS/FileSystem.h>
#include <kernel/SpinLock.h>
#include <kernel/Lock/Mutex.h>
namespace Kernel
{
@@ -42,7 +42,7 @@ namespace Kernel
MountPoint* mount_from_root_inode(BAN::RefPtr<Inode>);
private:
SpinLock m_lock;
Mutex m_mutex;
FileSystem* m_root_fs = nullptr;
BAN::Vector<MountPoint> m_mount_points;
};