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:
Liav A
2024-02-10 12:49:31 +02:00
committed by Andrew Kaster
parent 53dd04e219
commit b63a1dda63
13 changed files with 23 additions and 14 deletions

View File

@@ -105,8 +105,9 @@ ErrorOr<void> SysFSInode::chown(UserID, GroupID)
return EPERM;
}
ErrorOr<void> SysFSInode::truncate(u64 size)
ErrorOr<void> SysFSInode::truncate_locked(u64 size)
{
VERIFY(m_inode_lock.is_locked());
return m_associated_component->truncate(size);
}