mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Merge pull request #10725 from SocialistDalao:bug_fix_container_new
PiperOrigin-RevId: 660484072
This commit is contained in:
@@ -243,6 +243,9 @@ func New(conf *config.Config, args Args) (*Container, error) {
|
||||
// Lock the container metadata file to prevent concurrent creations of
|
||||
// containers with the same id.
|
||||
if err := c.Saver.LockForNew(); err != nil {
|
||||
// As we have not allocated any resources yet, we revoke the clean-up operation.
|
||||
// Otherwise, we may accidently destroy an existing container.
|
||||
cu.Release()
|
||||
return nil, fmt.Errorf("cannot lock container metadata file: %w", err)
|
||||
}
|
||||
defer c.Saver.UnlockOrDie()
|
||||
|
||||
Reference in New Issue
Block a user