Skip to content

Commit

Permalink
lock and sync container before checking mountpoint
Browse files Browse the repository at this point in the history
when checking for a container's mountpoint, you must lock and sync
the container or the result may be "".

Fixes: containers#2304

Signed-off-by: baude <bbaude@redhat.com>
  • Loading branch information
baude committed Feb 11, 2019
1 parent acf2e91 commit 82ee58e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libpod/kube.go
Expand Up @@ -421,7 +421,13 @@ func generateKubeSecurityContext(c *Container) (*v1.SecurityContext, error) {
}

if c.User() != "" {
// It is *possible* that
if !c.batched {
c.lock.Lock()
defer c.lock.Unlock()
}
if err := c.syncContainer(); err != nil {
return nil, errors.Wrapf(err, "unable to sync container during YAML generation")
}
logrus.Debugf("Looking in container for user: %s", c.User())
u, err := lookup.GetUser(c.state.Mountpoint, c.User())
if err != nil {
Expand Down

0 comments on commit 82ee58e

Please sign in to comment.