BFS: Write-lock the stream inode in BPlusTree::MakeEmpty().

I was experimenting with forcing the CheckVisitor to always rebuild all
indices, when I got a KDL from a Tracker process that I had running
a query in the background. The fault address was invalid (0x7b4493418),
and the stack trace was bfs_read_query -> GetNextMatching ->
TreeIterator::Traverse. That method read-locks inodes, and it looks
like query references to inodes are managed correctly.

This seems like the most plausible culprit for missing locks. I didn't
manage to reproduce the KDL, unfortunately, but hopefully this resolves
it nonetheless.
This commit is contained in:
Augustin Cavalier
2025-02-26 17:09:30 -05:00
parent 4bfbc6ebba
commit cf2838a3eb
@@ -853,6 +853,7 @@ BPlusTree::MakeEmpty()
{
// Put all nodes into the free list in order
Transaction transaction(fStream->GetVolume(), fStream->BlockNumber());
fStream->WriteLockInTransaction(transaction);
// Reset the header, and root node
CachedNode cached(this);