mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Kernel/FileSystem: Enforce locking of m_inode_lock when truncating Inode
Such operation is almost equivalent to writing on an Inode, so lock the Inode m_inode_lock exclusively. All FileSystem Inode implementations then override a new method called truncate_locked which should implement the actual truncating.
This commit is contained in:
@@ -88,6 +88,12 @@ void Inode::will_be_destroyed()
|
||||
(void)flush_metadata();
|
||||
}
|
||||
|
||||
ErrorOr<void> Inode::truncate(u64 size)
|
||||
{
|
||||
MutexLocker locker(m_inode_lock);
|
||||
return truncate_locked(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);
|
||||
|
||||
Reference in New Issue
Block a user