From f5310652d30e72fe88a3edc70b2911397c28b7e4 Mon Sep 17 00:00:00 2001 From: Pei Su Date: Wed, 27 Jan 2016 16:34:10 +0800 Subject: [PATCH] fix dead lock in volume store dereference Signed-off-by: Pei Su --- volume/store/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volume/store/store.go b/volume/store/store.go index bd5691c642..b871902fd8 100644 --- a/volume/store/store.go +++ b/volume/store/store.go @@ -293,6 +293,7 @@ func (s *VolumeStore) Dereference(v volume.Volume, ref string) { defer s.locks.Unlock(v.Name()) s.globalLock.Lock() + defer s.globalLock.Unlock() refs, exists := s.refs[v.Name()] if !exists { return @@ -303,7 +304,6 @@ func (s *VolumeStore) Dereference(v volume.Volume, ref string) { s.refs[v.Name()] = append(s.refs[v.Name()][:i], s.refs[v.Name()][i+1:]...) } } - s.globalLock.Unlock() } // Refs gets the current list of refs for the given volume