aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/blockstore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-09-29 12:39:42 +0200
committerGitHub Enterprise <[email protected]>2025-09-29 12:39:42 +0200
commit1d1c14ca657523abaf5807821f6961f3868ad4e0 (patch)
tree6260f6c6653cc29ceb9312b49067c2ab15aa1dc5 /src/zenstore/blockstore.cpp
parentGetCacheChunk value request respects RawHash (#518) (diff)
downloadzen-1d1c14ca657523abaf5807821f6961f3868ad4e0.tar.xz
zen-1d1c14ca657523abaf5807821f6961f3868ad4e0.zip
fix race condition in BlockStoreFile::Flush (#525)
Bugfix: Flush of blockstore file could sometimes cause an error due to a race condition
Diffstat (limited to 'src/zenstore/blockstore.cpp')
-rw-r--r--src/zenstore/blockstore.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp
index b8fa03305..ec7924553 100644
--- a/src/zenstore/blockstore.cpp
+++ b/src/zenstore/blockstore.cpp
@@ -171,9 +171,9 @@ BlockStoreFile::Flush(uint64_t FinalSize)
if (FinalSize != (uint64_t)-1)
{
uint64_t ExpectedSize = 0;
- if (!m_CachedFileSize.compare_exchange_weak(ExpectedSize, FinalSize))
+ while (!m_CachedFileSize.compare_exchange_weak(ExpectedSize, FinalSize))
{
- ZEN_ASSERT(m_CachedFileSize.load() == FinalSize);
+ ZEN_ASSERT(ExpectedSize <= FinalSize);
}
}
}