fix(master): fix dead lock for flashnode

close:#22985995

Signed-off-by: chihe <chihe@oppo.com>
This commit is contained in:
chihe 2025-01-17 16:35:51 +08:00 committed by zhumingze1108
parent 5e57eb1ecd
commit 12917180d4

View File

@ -4145,12 +4145,13 @@ func (c *Cluster) allFlashNodes() (flashNodes []proto.NodeView) {
flashNodes = make([]proto.NodeView, 0)
c.flashNodeTopo.flashNodeMap.Range(func(addr, node interface{}) bool {
flashNode := node.(*FlashNode)
isWritable := flashNode.isWriteable()
flashNode.RLock()
flashNodes = append(flashNodes, proto.NodeView{
ID: flashNode.ID,
Addr: flashNode.Addr,
Status: flashNode.IsActive,
IsWritable: flashNode.isWriteable(),
IsWritable: isWritable,
})
flashNode.RUnlock()
return true