@@ -160,6 +160,7 @@ func compileMounts(spec *specs.Spec) []specs.Mount {
160
160
161
161
// p9MountOptions creates a slice of options for a p9 mount.
162
162
func p9MountOptions (fd int , fa FileAccessType ) []string {
163
+ log .Infof ("Creating 9p mount options" )
163
164
opts := []string {
164
165
"trans=fd" ,
165
166
"rfdno=" + strconv .Itoa (fd ),
@@ -270,37 +271,39 @@ func addSubmountOverlay(ctx context.Context, inode *fs.Inode, submounts []string
270
271
271
272
// mountExpFS should be executed after root create ramfs stub
272
273
func mountExpFS (ctx context.Context , layerFDs []int , submounts []string ) (* fs.Inode , error ) {
273
- var currentNode * fs.Inode
274
-
275
- if submounts != nil {
276
- msrc := fs .NewPseudoMountSource (ctx )
277
- mountTree , err := ramfs .MakeDirectoryTree (ctx , msrc , submounts )
278
- if err != nil {
279
- return nil , fmt .Errorf ("creating mount tree: %v" , err )
280
- }
281
- currentNode = mountTree
282
- }
283
-
284
- flags := fs.MountSourceFlags {ReadOnly : true }
285
- imgFS := mustFindFilesystem ("imgfs" )
286
-
287
- for index , lfd := range layerFDs {
288
- imgfsNode , err := imgFS .Mount (ctx , "imgfs-layer-" + strconv .Itoa (index ), flags , "packageFD=" + strconv .Itoa (lfd ), nil )
289
- if err != nil {
290
- return nil , fmt .Errorf ("mounting imgfs layer %v, layerFD %v, err: %v" , index , lfd , err )
291
- }
292
- if currentNode != nil {
293
- if currentNode , err = fs .NewOverlayRoot (ctx , imgfsNode , currentNode , flags ); err != nil {
294
- return nil , fmt .Errorf ("creating imgfs overlay: %v" , err )
295
- }
296
- } else {
297
- currentNode = imgfsNode
298
- }
299
- }
300
- if currentNode == nil {
301
- return nil , fmt .Errorf ("container fs: currentNode is nil" )
302
- }
303
- return currentNode , nil
274
+ var currentNode * fs.Inode
275
+ log .Infof ("imgfs - mounting imgfs in mountExpFS" )
276
+
277
+ if submounts != nil {
278
+ msrc := fs .NewPseudoMountSource (ctx )
279
+ mountTree , err := ramfs .MakeDirectoryTree (ctx , msrc , submounts )
280
+ if err != nil {
281
+ return nil , fmt .Errorf ("creating mount tree: %v" , err )
282
+ }
283
+ currentNode = mountTree
284
+ }
285
+
286
+ flags := fs.MountSourceFlags {ReadOnly : true }
287
+ imgFS := mustFindFilesystem ("imgfs" )
288
+
289
+ for index , lfd := range layerFDs {
290
+ imgfsNode , err := imgFS .Mount (ctx , "imgfs-layer-" + strconv .Itoa (index ), flags , "packageFD=" + strconv .Itoa (lfd ), nil )
291
+ if err != nil {
292
+ return nil , fmt .Errorf ("mounting imgfs layer %v, layerFD %v, err: %v" , index , lfd , err )
293
+ }
294
+ if currentNode != nil {
295
+ if currentNode , err = fs .NewOverlayRoot (ctx , imgfsNode , currentNode , flags ); err != nil {
296
+ return nil , fmt .Errorf ("creating imgfs overlay: %v" , err )
297
+ }
298
+ } else {
299
+ currentNode = imgfsNode
300
+ }
301
+ }
302
+
303
+ if currentNode == nil {
304
+ return nil , fmt .Errorf ("container fs: currentNode is nil" )
305
+ }
306
+ return currentNode , nil
304
307
}
305
308
306
309
// subtargets takes a set of Mounts and returns only the targets that are
@@ -637,7 +640,7 @@ func (c *containerMounter) setupFS(conf *Config, procArgs *kernel.CreateProcessA
637
640
638
641
// Set namespace here so that it can be found in rootCtx.
639
642
rootProcArgs .MountNamespace = mns
640
-
643
+ log . Infof ( "imgfs - About to mount submounts in setupFS" )
641
644
if err := c .mountSubmounts (rootCtx , conf , mns ); err != nil {
642
645
return nil , err
643
646
}
@@ -649,6 +652,7 @@ func (c *containerMounter) createMountNamespace(ctx context.Context, conf *Confi
649
652
if err != nil {
650
653
return nil , fmt .Errorf ("creating filesystem for container: %v" , err )
651
654
}
655
+ log .Infof ("imgfs - About to create a new Mount namespace" )
652
656
mns , err := fs .NewMountNamespace (ctx , rootInode )
653
657
if err != nil {
654
658
return nil , fmt .Errorf ("creating new mount namespace for container: %v" , err )
@@ -663,6 +667,7 @@ func (c *containerMounter) mountSubmounts(ctx context.Context, conf *Config, mns
663
667
for _ , m := range c .mounts {
664
668
log .Debugf ("Mounting %q to %q, type: %s, options: %s" , m .Source , m .Destination , m .Type , m .Options )
665
669
if hint := c .hints .findMount (m ); hint != nil && hint .isSupported () {
670
+ log .Infof ("imgfs - mounting with hint in mountSubmounts" )
666
671
if err := c .mountSharedSubmount (ctx , mns , root , m , hint ); err != nil {
667
672
return fmt .Errorf ("mount shared mount %q to %q: %v" , hint .name , m .Destination , err )
668
673
}
@@ -697,6 +702,7 @@ func (c *containerMounter) checkDispenser() error {
697
702
// mountSharedMaster mounts the master of a volume that is shared among
698
703
// containers in a pod. It returns the root mount's inode.
699
704
func (c * containerMounter ) mountSharedMaster (ctx context.Context , conf * Config , hint * mountHint ) (* fs.Inode , error ) {
705
+ log .Infof ("Mounting shared master" )
700
706
// Map mount type to filesystem name, and parse out the options that we are
701
707
// capable of dealing with.
702
708
fsName , opts , useOverlay , err := c .getMountNameAndOptions (conf , hint .mount )
@@ -806,6 +812,7 @@ func (c *containerMounter) getMountNameAndOptions(conf *Config, m specs.Mount) (
806
812
}
807
813
808
814
case bind :
815
+ log .Infof ("imgfs - about to create p9 options" )
809
816
fd := c .fds .remove ()
810
817
fsName = "9p"
811
818
// Non-root bind mounts are always shared.
@@ -814,6 +821,7 @@ func (c *containerMounter) getMountNameAndOptions(conf *Config, m specs.Mount) (
814
821
useOverlay = conf .Overlay && ! mountFlags (m .Options ).ReadOnly
815
822
816
823
case imgfs :
824
+ log .Infof ("imgfs - got here in switch" )
817
825
fsName = m .Type
818
826
opts = []string {"packageFD=" + strconv .Itoa (conf .PackageFD )}
819
827
useOverlay = true // ImgFS will always use overlay
@@ -833,6 +841,7 @@ func (c *containerMounter) getMountNameAndOptions(conf *Config, m specs.Mount) (
833
841
func (c * containerMounter ) mountSubmount (ctx context.Context , conf * Config , mns * fs.MountNamespace , root * fs.Dirent , m specs.Mount ) (* fs.Inode , * fs.Dirent , error ) {
834
842
// Map mount type to filesystem name, and parse out the options that we are
835
843
// capable of dealing with.
844
+ log .Infof ("mounting submount" )
836
845
fsName , opts , useOverlay , err := c .getMountNameAndOptions (conf , m )
837
846
if err != nil {
838
847
return nil , nil , err
@@ -917,6 +926,7 @@ func (c *containerMounter) mountSharedSubmount(ctx context.Context, mns *fs.Moun
917
926
// addRestoreMount adds a mount to the MountSources map used for restoring a
918
927
// checkpointed container.
919
928
func (c * containerMounter ) addRestoreMount (conf * Config , renv * fs.RestoreEnvironment , m specs.Mount ) error {
929
+ log .Infof ("Adding restore mount" )
920
930
fsName , opts , useOverlay , err := c .getMountNameAndOptions (conf , m )
921
931
if err != nil {
922
932
return err
@@ -946,6 +956,7 @@ func (c *containerMounter) createRestoreEnvironment(conf *Config) (*fs.RestoreEn
946
956
MountSources : make (map [string ][]fs.MountArgs ),
947
957
}
948
958
959
+ log .Infof ("imgfs - Creating/restoring enviornement" )
949
960
// Add root mount.
950
961
fd := c .fds .remove ()
951
962
opts := p9MountOptions (fd , conf .FileAccess )
0 commit comments