mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(master): fix some potential deadlock issues.
Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
parent
68d6fd7229
commit
4aa22112e5
@ -819,8 +819,6 @@ func (c *Cluster) checkDataNodeHeartbeat() {
|
||||
|
||||
func (c *Cluster) checkMetaNodeHeartbeat() {
|
||||
tasks := make([]*proto.AdminTask, 0)
|
||||
c.volMutex.RLock()
|
||||
defer c.volMutex.RUnlock()
|
||||
|
||||
c.metaNodes.Range(func(addr, metaNode interface{}) bool {
|
||||
node := metaNode.(*MetaNode)
|
||||
@ -828,6 +826,9 @@ func (c *Cluster) checkMetaNodeHeartbeat() {
|
||||
task := node.createHeartbeatTask(c.masterAddr(), c.fileStatsEnable)
|
||||
hbReq := task.Request.(*proto.HeartBeatRequest)
|
||||
|
||||
c.volMutex.RLock()
|
||||
defer c.volMutex.RUnlock()
|
||||
|
||||
for _, vol := range c.vols {
|
||||
if vol.FollowerRead {
|
||||
hbReq.FLReadVols = append(hbReq.FLReadVols, vol.Name)
|
||||
|
||||
@ -880,8 +880,6 @@ func (partition *DataPartition) getMinus() (minus float64) {
|
||||
}
|
||||
|
||||
func (partition *DataPartition) activeUsedSimilar() bool {
|
||||
partition.RLock()
|
||||
defer partition.RUnlock()
|
||||
liveReplicas := partition.liveReplicas(defaultDataPartitionTimeOutSec)
|
||||
used := liveReplicas[0].Used
|
||||
minus := float64(0)
|
||||
|
||||
@ -819,9 +819,6 @@ func (mp *MetaPartition) getMinusOfMaxInodeID() (minus float64) {
|
||||
}
|
||||
|
||||
func (mp *MetaPartition) activeMaxInodeSimilar() bool {
|
||||
mp.RLock()
|
||||
defer mp.RUnlock()
|
||||
|
||||
minus := float64(0)
|
||||
var sentry float64
|
||||
replicas := mp.getLiveReplicas()
|
||||
|
||||
@ -739,10 +739,9 @@ func (mm *monitorMetrics) setMpInconsistentErrorMetric() {
|
||||
deleteMps[k] = v
|
||||
delete(mm.inconsistentMps, k)
|
||||
}
|
||||
mm.cluster.volMutex.RLock()
|
||||
defer mm.cluster.volMutex.RUnlock()
|
||||
|
||||
for _, vol := range mm.cluster.vols {
|
||||
vols := mm.cluster.copyVols()
|
||||
for _, vol := range vols {
|
||||
if (vol.Status == proto.VolStatusMarkDelete && !vol.Forbidden) || (vol.Status == proto.VolStatusMarkDelete && vol.Forbidden && vol.DeleteExecTime.Sub(time.Now()) <= 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user