summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kernel/FileSystem/Inode.h2
-rw-r--r--Kernel/Memory/SharedInodeVMObject.cpp1
2 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h
index 3974d96350..de22fa74ee 100644
--- a/Kernel/FileSystem/Inode.h
+++ b/Kernel/FileSystem/Inode.h
@@ -19,6 +19,7 @@
#include <Kernel/Forward.h>
#include <Kernel/Library/ListedRefCounted.h>
#include <Kernel/Locking/Mutex.h>
+#include <Kernel/Memory/SharedInodeVMObject.h>
namespace Kernel {
@@ -32,6 +33,7 @@ class Inode : public ListedRefCounted<Inode, LockType::Spinlock>
friend class VirtualFileSystem;
friend class FileSystem;
friend class InodeFile;
+ friend class Kernel::Memory::SharedInodeVMObject; // FIXME: Remove when write_bytes becomes non-virtual
public:
virtual ~Inode();
diff --git a/Kernel/Memory/SharedInodeVMObject.cpp b/Kernel/Memory/SharedInodeVMObject.cpp
index 3c20012718..2f1e3e27cb 100644
--- a/Kernel/Memory/SharedInodeVMObject.cpp
+++ b/Kernel/Memory/SharedInodeVMObject.cpp
@@ -53,6 +53,7 @@ ErrorOr<void> SharedInodeVMObject::sync(off_t offset_in_pages, size_t pages)
u8 page_buffer[PAGE_SIZE];
MM.copy_physical_page(*physical_page, page_buffer);
+ MutexLocker locker(m_inode->m_inode_lock);
TRY(m_inode->write_bytes(page_index * PAGE_SIZE, PAGE_SIZE, UserOrKernelBuffer::for_kernel_buffer(page_buffer), nullptr));
}