Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 3b8e87f

Browse files
committed
XPod.Stats: Change p.statusLock to p.resourceLock
p.sandbox is protected by p.resourceLock but not p.statusLock. Signed-off-by: Hui Zhu <teawater@hyper.sh>
1 parent 9021a93 commit 3b8e87f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

daemon/pod/pod.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,17 @@ func (p *XPod) ContainerInfo(cid string) (*apitypes.ContainerInfo, error) {
293293
}
294294

295295
func (p *XPod) Stats() *runvtypes.PodStats {
296-
//use channel, don't block in statusLock
296+
//use channel, don't block in resourceLock
297297
ch := make(chan *runvtypes.PodStats, 1)
298298

299-
p.statusLock.Lock()
299+
p.resourceLock.Lock()
300300
if p.sandbox == nil {
301301
ch <- nil
302302
}
303303
go func(sb *hypervisor.Vm) {
304304
ch <- sb.Stats()
305305
}(p.sandbox)
306-
p.statusLock.Unlock()
306+
p.resourceLock.Unlock()
307307

308308
return <-ch
309309
}

0 commit comments

Comments
 (0)