Fix: DataTree::resizeNumBytes was locking the same shared_mutex twice, which sometimes caused a deadlock. See https://github.com/cryfs/cryfs/issues/3

This commit is contained in:
Sebastian Messmer 2016-02-09 01:16:32 +01:00
parent 69a7f0528a
commit 4519eada1e

View File

@ -298,7 +298,7 @@ void DataTree::resizeNumBytes(uint64_t newNumBytes) {
uint32_t newLastLeafSize = newNumBytes - (newNumLeaves-1)*_nodeStore->layout().maxBytesPerLeaf();
LastLeaf(_rootNode.get())->resize(newLastLeafSize);
}
ASSERT(newNumBytes == numStoredBytes(), "We resized to the wrong number of bytes ("+std::to_string(numStoredBytes())+" instead of "+std::to_string(newNumBytes)+")");
ASSERT(newNumBytes == _numStoredBytes(), "We resized to the wrong number of bytes ("+std::to_string(numStoredBytes())+" instead of "+std::to_string(newNumBytes)+")");
}
optional_ownership_ptr<DataLeafNode> DataTree::LastLeaf(DataNode *root) {