@@ -89,9 +89,6 @@ func transformMounts(ctx context.Context, vmi vm.Instance, id string, ms []*type
8989 udi = - 1
9090 )
9191 for i , opt := range m .Options {
92- if strings .Contains (opt , "{{" ) {
93- continue
94- }
9592 if strings .HasPrefix (opt , "upperdir=" ) {
9693 udi = i
9794 } else if strings .HasPrefix (opt , "workdir=" ) {
@@ -100,11 +97,18 @@ func transformMounts(ctx context.Context, vmi vm.Instance, id string, ms []*type
10097 // TODO: Handle virtio for lowers?
10198 }
10299 if wdi > - 1 && udi > - 1 {
103- // Having the upper as virtiofs may return invalid argument, avoid
104- // transforming and attempt to perform the mounts on the host if
105- // supported.
106- return nil , fmt .Errorf ("cannot use virtiofs for upper dir in overlay: %w" , errdefs .ErrNotImplemented )
107- } else if wdi == - 1 || udi == - 1 {
100+ //
101+ // If any upperdir or workdir isn't transformed, they both
102+ // should fall back to virtiofs passthroughfs. But...
103+ //
104+ if ! strings .Contains (m .Options [wdi ], "{{" ) ||
105+ ! strings .Contains (m .Options [udi ], "{{" ) {
106+ // Having the upper as virtiofs may return invalid argument, avoid
107+ // transforming and attempt to perform the mounts on the host if
108+ // supported.
109+ return nil , fmt .Errorf ("cannot use virtiofs for upper dir in overlay: %w" , errdefs .ErrNotImplemented )
110+ }
111+ } else {
108112 log .G (ctx ).WithField ("options" , m .Options ).Warnf ("overlayfs missing workdir or upperdir" )
109113 }
110114
0 commit comments