From 5c5e82907aba56d7d8478a3ccc43caa0d011399b Mon Sep 17 00:00:00 2001 From: Maurice van Veen Date: Tue, 18 Nov 2025 10:43:40 +0100 Subject: [PATCH] (2.14) [FIXED] Filestore delete map race Signed-off-by: Maurice van Veen --- server/filestore.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/filestore.go b/server/filestore.go index a9a215e0e10..5e5ed7e040a 100644 --- a/server/filestore.go +++ b/server/filestore.go @@ -10669,8 +10669,14 @@ func (fs *fileStore) deleteBlocks() DeleteBlocks { // deleteMap returns all interior deletes for each block based on the mb.dmap. // Specifically, this will not contain any deletes for blocks that have been removed. // This is useful to know whether a tombstone is still relevant and marked as deleted by an active block. -// All blocks should be at least read locked. +// No locks should be held. func (fs *fileStore) deleteMap() (dmap avl.SequenceSet) { + fs.mu.RLock() + defer fs.mu.RUnlock() + + fs.readLockAllMsgBlocks() + defer fs.readUnlockAllMsgBlocks() + for _, mb := range fs.blks { if mb.dmap.Size() > 0 { mb.dmap.Range(func(seq uint64) bool {