aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zenstore/filecas.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp
index 4f5cf370e..64fcb2ffe 100644
--- a/zenstore/filecas.cpp
+++ b/zenstore/filecas.cpp
@@ -242,6 +242,10 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize
ChunkRemain -= ByteCount;
}
+ // We cannot rely on RAII to close the file handle since it would be closed
+ // *after* the lock is released due to the initialization order.
+ PayloadFile.Close();
+
AtomicIncrement(m_Stats.PutCount);
AtomicAdd(m_Stats.PutBytes, ChunkSize);