diff --git a/server/filestore.go b/server/filestore.go index 3d076cd5..a200ab57 100644 --- a/server/filestore.go +++ b/server/filestore.go @@ -875,7 +875,11 @@ func (fs *fileStore) newMsgBlockForWrite() (*msgBlock, error) { } mb := &msgBlock{fs: fs, index: index, cexp: fs.fcfg.CacheExpire} + + // Lock should be held to quiet race detector. + mb.mu.Lock() mb.setupWriteCache(mbuf) + mb.mu.Unlock() // Now do local hash. key := sha256.Sum256(fs.hashKeyForBlock(index))