mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-28 13:31:27 +08:00
avoid dead lock
This commit is contained in:
parent
38efc6f572
commit
53ca7e66ef
@ -46,7 +46,7 @@ func (dn *DataNode) getOrCreateDisk(diskType string) *Disk {
|
||||
c, found := dn.children[NodeId(diskType)]
|
||||
if !found {
|
||||
c = NewDisk(diskType)
|
||||
dn.LinkChildNode(c)
|
||||
dn.doLinkChildNode(c)
|
||||
}
|
||||
disk := c.(*Disk)
|
||||
return disk
|
||||
|
@ -210,6 +210,10 @@ func (n *NodeImpl) GetMaxVolumeId() needle.VolumeId {
|
||||
func (n *NodeImpl) LinkChildNode(node Node) {
|
||||
n.Lock()
|
||||
defer n.Unlock()
|
||||
n.doLinkChildNode(node)
|
||||
}
|
||||
|
||||
func (n *NodeImpl) doLinkChildNode(node Node) {
|
||||
if n.children[node.Id()] == nil {
|
||||
n.children[node.Id()] = node
|
||||
n.UpAdjustDiskUsageDelta(node.GetDiskUsages())
|
||||
|
Loading…
Reference in New Issue
Block a user