1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 11:44:58 +00:00

Kernel/FileSystem: Avoid double locking m_inode_lock in the Ext2 driver

This commit is contained in:
Liav A 2024-02-23 17:18:25 +02:00 committed by Andrew Kaster
parent b63a1dda63
commit fff49ab6d3
3 changed files with 11 additions and 2 deletions

View file

@ -97,6 +97,12 @@ ErrorOr<void> Inode::truncate(u64 size)
ErrorOr<size_t> Inode::write_bytes(off_t offset, size_t length, UserOrKernelBuffer const& target_buffer, OpenFileDescription* open_description)
{
MutexLocker locker(m_inode_lock);
return prepare_and_write_bytes_locked(offset, length, target_buffer, open_description);
}
ErrorOr<size_t> Inode::prepare_and_write_bytes_locked(off_t offset, size_t length, UserOrKernelBuffer const& target_buffer, OpenFileDescription* open_description)
{
VERIFY(m_inode_lock.is_locked());
TRY(prepare_to_write_data());
return write_bytes_locked(offset, length, target_buffer, open_description);
}