mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
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.
This commit is contained in:
parent
81c4dcadf1
commit
7e56cf1800
1 changed files with 2 additions and 0 deletions
|
@ -68,6 +68,7 @@ const ext2_group_desc& Ext2FS::group_descriptor(GroupIndex group_index) const
|
||||||
|
|
||||||
bool Ext2FS::initialize()
|
bool Ext2FS::initialize()
|
||||||
{
|
{
|
||||||
|
LOCKER(m_lock);
|
||||||
bool success = const_cast<DiskDevice&>(device()).read_blocks(2, 1, (u8*)&m_super_block);
|
bool success = const_cast<DiskDevice&>(device()).read_blocks(2, 1, (u8*)&m_super_block);
|
||||||
ASSERT(success);
|
ASSERT(success);
|
||||||
|
|
||||||
|
@ -484,6 +485,7 @@ void Ext2FS::flush_block_group_descriptor_table()
|
||||||
|
|
||||||
void Ext2FS::flush_writes()
|
void Ext2FS::flush_writes()
|
||||||
{
|
{
|
||||||
|
LOCKER(m_lock);
|
||||||
if (m_super_block_dirty) {
|
if (m_super_block_dirty) {
|
||||||
flush_super_block();
|
flush_super_block();
|
||||||
m_super_block_dirty = false;
|
m_super_block_dirty = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue