lib,oci: drop stateLock when possible

Should fix a possible deadlock in, at least, ListPodSandbox.
There seems to be no reason to hold stateLock when doing operations on
the memory_store for containers and sandboxes.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-12-15 15:31:55 +01:00
parent 2fa1f3f74a
commit ecc572e7cf
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
3 changed files with 14 additions and 35 deletions

View file

@ -25,8 +25,9 @@ func (c *memoryStore) Add(id string, cont *Sandbox) {
// Get returns a sandbox from the store by id.
func (c *memoryStore) Get(id string) *Sandbox {
var res *Sandbox
c.RLock()
res := c.s[id]
res = c.s[id]
c.RUnlock()
return res
}