Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Commit

Permalink
fix race condition when umounting
Browse files Browse the repository at this point in the history
this part of code raise a race condition, where previous container start
failed and call unmount, where after the next container starts and
unmount removes the mount entry.(gc takes 1 second after calling unmount).
We don't need to call umount in this case as the gc will always run if container
is being removed  which gc thread will clean unused mount entries.
  • Loading branch information
Daishan Peng authored and Craig Jellick committed Feb 15, 2018
1 parent b740cdf commit 36a8da7
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions core/compute/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ func DoInstanceActivate(instance model.Instance, host model.Host, progress *prog
return errors.Wrap(err, constants.DoInstanceActivateError+"failed to get image tag")
}

started := false

instanceName := instance.Name
parts := strings.Split(instance.UUID, "-")
if len(parts) == 0 {
Expand Down Expand Up @@ -80,11 +78,6 @@ func DoInstanceActivate(instance model.Instance, host model.Host, progress *prog
return errors.Wrap(err, constants.DoInstanceActivateError+"failed to set up volumes")
}

defer func() {
if !started {
unmountRancherFlexVolume(instance)
}
}()
if err := setupRancherFlexVolume(instance, &hostConfig); err != nil {
return errors.Wrap(err, constants.DoInstanceActivateError+"failed to set up rancher flex volumes")
}
Expand Down Expand Up @@ -142,7 +135,6 @@ func DoInstanceActivate(instance model.Instance, host model.Host, progress *prog
}

logrus.Infof("rancher id [%v]: Container with docker id [%v] has been started", instance.ID, containerID)
started = true
return nil
}

Expand Down

0 comments on commit 36a8da7

Please sign in to comment.