From 7e56cf18006410f0fd164cbf8938a9a7d33244ce Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 3 Nov 2019 13:56:55 +0100 Subject: [PATCH] Ext2FS: Lock the filesystem during initialization and during sync If we get preempted during initialization, we really don't want to try doing a sync on a partially-initialized filesystem. --- Kernel/FileSystem/Ext2FileSystem.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 5dd74d109c..096d444223 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -68,6 +68,7 @@ const ext2_group_desc& Ext2FS::group_descriptor(GroupIndex group_index) const bool Ext2FS::initialize() { + LOCKER(m_lock); bool success = const_cast(device()).read_blocks(2, 1, (u8*)&m_super_block); ASSERT(success); @@ -484,6 +485,7 @@ void Ext2FS::flush_block_group_descriptor_table() void Ext2FS::flush_writes() { + LOCKER(m_lock); if (m_super_block_dirty) { flush_super_block(); m_super_block_dirty = false;