From 48b81e872c93be5473992f17110cfaec5d3017b2 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Wed, 22 May 2019 15:48:21 -0700 Subject: [PATCH] Do not return error when rootfs already exists. Signed-off-by: Lantao Liu --- runtime/v1/shim/service.go | 2 +- runtime/v2/runc/container.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/v1/shim/service.go b/runtime/v1/shim/service.go index af4ffe1e9..6e87f052a 100644 --- a/runtime/v1/shim/service.go +++ b/runtime/v1/shim/service.go @@ -127,7 +127,7 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (_ * rootfs := "" if len(mounts) > 0 { rootfs = filepath.Join(r.Bundle, "rootfs") - if err := os.Mkdir(rootfs, 0711); err != nil { + if err := os.Mkdir(rootfs, 0711); err != nil && !os.IsExist(err) { return nil, err } } diff --git a/runtime/v2/runc/container.go b/runtime/v2/runc/container.go index 92ca16f2e..ae8fb0043 100644 --- a/runtime/v2/runc/container.go +++ b/runtime/v2/runc/container.go @@ -68,7 +68,7 @@ func NewContainer(ctx context.Context, platform rproc.Platform, r *task.CreateTa rootfs := "" if len(mounts) > 0 { rootfs = filepath.Join(r.Bundle, "rootfs") - if err := os.Mkdir(rootfs, 0711); err != nil { + if err := os.Mkdir(rootfs, 0711); err != nil && !os.IsExist(err) { return nil, err } }