@@ -364,6 +364,16 @@ func (o *snapshotter) checkTurboOCI(labels map[string]string) (bool, string, str
364364 return false , "" , ""
365365}
366366
367+ func (o * snapshotter ) isPrepareRootfs (info snapshots.Info ) bool {
368+ if _ , ok := info .Labels [label .TargetSnapshotRef ]; ok {
369+ return false
370+ }
371+ if info .Labels [label .SnapshotType ] == "image" {
372+ return false
373+ }
374+ return true
375+ }
376+
367377func (o * snapshotter ) createMountPoint (ctx context.Context , kind snapshots.Kind , key string , parent string , opts ... snapshots.Opt ) (_ []mount.Mount , retErr error ) {
368378
369379 ctx , t , err := o .ms .TransactionContext (ctx , true )
@@ -384,6 +394,7 @@ func (o *snapshotter) createMountPoint(ctx context.Context, kind snapshots.Kind,
384394 if err != nil {
385395 return nil , err
386396 }
397+ log .G (ctx ).Infof ("sn: %s, labels:[%+v]" , id , info .Labels )
387398 defer func () {
388399 // the transaction rollback makes created snapshot invalid, just clean it.
389400 if retErr != nil && rollback {
@@ -495,8 +506,8 @@ func (o *snapshotter) createMountPoint(ctx context.Context, kind snapshots.Kind,
495506 writeType := o .getWritableType (ctx , parentID , info )
496507
497508 // If Preparing for rootfs, find metadata from its parent (top layer), launch and mount backstore device.
498- if _ , ok := info . Labels [ label . TargetSnapshotRef ]; ! ok {
499- log .G (ctx ).Infof ("Preparing rootfs. writeType: %s" , writeType )
509+ if o . isPrepareRootfs ( info ) {
510+ log .G (ctx ).Infof ("Preparing rootfs(%s) . writeType: %s" , s . ID , writeType )
500511 if writeType != RoDir {
501512 stype = storageTypeLocalBlock
502513 if err := o .constructOverlayBDSpec (ctx , key , true ); err != nil {
@@ -515,8 +526,8 @@ func (o *snapshotter) createMountPoint(ctx context.Context, kind snapshots.Kind,
515526 parentIsAccelLayer := parentInfo .Labels [label .AccelerationLayer ] == "yes"
516527 needRecordTrace := info .Labels [label .RecordTrace ] == "yes"
517528 recordTracePath := info .Labels [label .RecordTracePath ]
518- log .G (ctx ).Infof ("Prepare rootfs (parentIsAccelLayer: %t, needRecordTrace: %t, recordTracePath: %s)" ,
519- parentIsAccelLayer , needRecordTrace , recordTracePath )
529+ log .G (ctx ).Infof ("Prepare rootfs (sn: %s, parentIsAccelLayer: %t, needRecordTrace: %t, recordTracePath: %s)" ,
530+ id , parentIsAccelLayer , needRecordTrace , recordTracePath )
520531
521532 if parentIsAccelLayer {
522533 log .G (ctx ).Infof ("get accel-layer in parent (id: %s)" , id )
0 commit comments