ramfs: Add some WriteLocked assertions.

These would have caught the problem in #19360.
This commit is contained in:
Augustin Cavalier 2025-01-16 23:21:04 -05:00
parent 6d6a53f147
commit 48bfa9ee2f
4 changed files with 7 additions and 0 deletions

View File

@ -237,6 +237,8 @@ status_t
AttributeIndexImpl::Changed(Attribute *attribute, const uint8 *oldKey,
size_t oldLength)
{
fVolume->AssertWriteLocked();
status_t error = B_BAD_VALUE;
if (attribute && attribute->GetIndex() == this) {
// update the iterators and remove the attribute from the tree

View File

@ -147,6 +147,8 @@ LastModifiedIndex::CountEntries() const
status_t
LastModifiedIndex::Changed(Node *node, time_t oldModified)
{
fVolume->AssertWriteLocked();
status_t error = B_BAD_VALUE;
if (node) {
NodeTree::Iterator it;

View File

@ -145,6 +145,8 @@ SizeIndex::CountEntries() const
status_t
SizeIndex::Changed(Node *node, off_t oldSize)
{
fVolume->AssertWriteLocked();
status_t error = B_BAD_VALUE;
if (node) {
NodeTree::Iterator it;

View File

@ -163,6 +163,7 @@ public:
void ReadUnlock();
bool WriteLock();
void WriteUnlock();
inline void AssertWriteLocked() { ASSERT_WRITE_LOCKED_RW_LOCK(&fLocker); }
bool IteratorLock();
void IteratorUnlock();