|
@@ -112,6 +112,8 @@ var (
|
|
|
|
|
|
useNaiveDiffLock sync.Once
|
|
useNaiveDiffLock sync.Once
|
|
useNaiveDiffOnly bool
|
|
useNaiveDiffOnly bool
|
|
|
|
+
|
|
|
|
+ indexOff string
|
|
)
|
|
)
|
|
|
|
|
|
func init() {
|
|
func init() {
|
|
@@ -227,7 +229,18 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
|
|
return nil, fmt.Errorf("Storage Option overlay2.size only supported for backingFS XFS. Found %v", backingFs)
|
|
return nil, fmt.Errorf("Storage Option overlay2.size only supported for backingFS XFS. Found %v", backingFs)
|
|
}
|
|
}
|
|
|
|
|
|
- logger.Debugf("backingFs=%s, projectQuotaSupported=%v", backingFs, projectQuotaSupported)
|
|
|
|
|
|
+ // figure out whether "index=off" option is recognized by the kernel
|
|
|
|
+ _, err = os.Stat("/sys/module/overlay/parameters/index")
|
|
|
|
+ switch {
|
|
|
|
+ case err == nil:
|
|
|
|
+ indexOff = "index=off,"
|
|
|
|
+ case os.IsNotExist(err):
|
|
|
|
+ // old kernel, no index -- do nothing
|
|
|
|
+ default:
|
|
|
|
+ logger.Warnf("Unable to detect whether overlay kernel module supports index parameter: %s", err)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ logger.Debugf("backingFs=%s, projectQuotaSupported=%v, indexOff=%q", backingFs, projectQuotaSupported, indexOff)
|
|
|
|
|
|
return d, nil
|
|
return d, nil
|
|
}
|
|
}
|
|
@@ -576,7 +589,7 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e
|
|
for i, s := range splitLowers {
|
|
for i, s := range splitLowers {
|
|
absLowers[i] = path.Join(d.home, s)
|
|
absLowers[i] = path.Join(d.home, s)
|
|
}
|
|
}
|
|
- opts := fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", strings.Join(absLowers, ":"), path.Join(dir, "diff"), path.Join(dir, "work"))
|
|
|
|
|
|
+ opts := indexOff + "lowerdir=" + strings.Join(absLowers, ":") + ",upperdir=" + path.Join(dir, "diff") + ",workdir=" + path.Join(dir, "work")
|
|
mountData := label.FormatMountLabel(opts, mountLabel)
|
|
mountData := label.FormatMountLabel(opts, mountLabel)
|
|
mount := unix.Mount
|
|
mount := unix.Mount
|
|
mountTarget := mergedDir
|
|
mountTarget := mergedDir
|
|
@@ -605,7 +618,7 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e
|
|
// fit within a page and relative links make the mount data much
|
|
// fit within a page and relative links make the mount data much
|
|
// smaller at the expense of requiring a fork exec to chroot.
|
|
// smaller at the expense of requiring a fork exec to chroot.
|
|
if len(mountData) > pageSize {
|
|
if len(mountData) > pageSize {
|
|
- opts = fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", string(lowers), path.Join(id, "diff"), path.Join(id, "work"))
|
|
|
|
|
|
+ opts = indexOff + "lowerdir=" + string(lowers) + ",upperdir=" + path.Join(id, "diff") + ",workdir=" + path.Join(id, "work")
|
|
mountData = label.FormatMountLabel(opts, mountLabel)
|
|
mountData = label.FormatMountLabel(opts, mountLabel)
|
|
if len(mountData) > pageSize {
|
|
if len(mountData) > pageSize {
|
|
return nil, fmt.Errorf("cannot mount layer, mount label too large %d", len(mountData))
|
|
return nil, fmt.Errorf("cannot mount layer, mount label too large %d", len(mountData))
|