@@ -124,6 +124,14 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (_ *
124124 })
125125 }
126126
127+ rootfs := ""
128+ if len (mounts ) > 0 {
129+ rootfs = filepath .Join (r .Bundle , "rootfs" )
130+ if err := os .Mkdir (rootfs , 0711 ); err != nil {
131+ return nil , err
132+ }
133+ }
134+
127135 config := & proc.CreateConfig {
128136 ID : r .ID ,
129137 Bundle : r .Bundle ,
@@ -137,7 +145,6 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (_ *
137145 ParentCheckpoint : r .ParentCheckpoint ,
138146 Options : r .Options ,
139147 }
140- rootfs := filepath .Join (r .Bundle , "rootfs" )
141148 defer func () {
142149 if err != nil {
143150 if err2 := mount .UnmountAll (rootfs , 0 ); err2 != nil {
@@ -169,6 +176,7 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (_ *
169176 s .config .SystemdCgroup ,
170177 s .platform ,
171178 config ,
179+ rootfs ,
172180 )
173181 if err != nil {
174182 return nil , errdefs .ToGRPC (err )
@@ -632,7 +640,7 @@ func getTopic(ctx context.Context, e interface{}) string {
632640 return runtime .TaskUnknownTopic
633641}
634642
635- func newInit (ctx context.Context , path , workDir , runtimeRoot , namespace , criu string , systemdCgroup bool , platform rproc.Platform , r * proc.CreateConfig ) (* proc.Init , error ) {
643+ func newInit (ctx context.Context , path , workDir , runtimeRoot , namespace , criu string , systemdCgroup bool , platform rproc.Platform , r * proc.CreateConfig , rootfs string ) (* proc.Init , error ) {
636644 var options runctypes.CreateOptions
637645 if r .Options != nil {
638646 v , err := typeurl .UnmarshalAny (r .Options )
@@ -642,7 +650,6 @@ func newInit(ctx context.Context, path, workDir, runtimeRoot, namespace, criu st
642650 options = * v .(* runctypes.CreateOptions )
643651 }
644652
645- rootfs := filepath .Join (path , "rootfs" )
646653 runtime := proc .NewRunc (runtimeRoot , path , namespace , r .Runtime , criu , systemdCgroup )
647654 p := proc .New (r .ID , runtime , rproc.Stdio {
648655 Stdin : r .Stdin ,
0 commit comments