1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

overlay[2]: rm fs checks

Now that we do check if overlay is working by performing an actual
overlayfs mount, there's no need in extra checks for the kernel version
or the filesystem type. Actual mount check is sufficient.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2019-11-14 08:13:12 -08:00
parent 649e4c8889
commit e226aea280
2 changed files with 0 additions and 45 deletions

View file

@ -136,20 +136,6 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
return nil, graphdriver.ErrNotSupported return nil, graphdriver.ErrNotSupported
} }
fsMagic, err := graphdriver.GetFSMagic(testdir)
if err != nil {
return nil, err
}
if fsName, ok := graphdriver.FsNames[fsMagic]; ok {
backingFs = fsName
}
switch fsMagic {
case graphdriver.FsMagicAufs, graphdriver.FsMagicBtrfs, graphdriver.FsMagicEcryptfs, graphdriver.FsMagicNfsFs, graphdriver.FsMagicOverlay, graphdriver.FsMagicZfs:
logrus.WithField("storage-driver", "overlay").Errorf("'overlay' is not supported over %s", backingFs)
return nil, graphdriver.ErrIncompatibleFS
}
supportsDType, err := fsutils.SupportsDType(testdir) supportsDType, err := fsutils.SupportsDType(testdir)
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -27,7 +27,6 @@ import (
"github.com/docker/docker/pkg/locker" "github.com/docker/docker/pkg/locker"
"github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
units "github.com/docker/go-units" units "github.com/docker/go-units"
rsystem "github.com/opencontainers/runc/libcontainer/system" rsystem "github.com/opencontainers/runc/libcontainer/system"
@ -132,12 +131,6 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
return nil, err return nil, err
} }
// require kernel 4.0.0 to ensure multiple lower dirs are supported
v, err := kernel.GetKernelVersion()
if err != nil {
return nil, err
}
// Perform feature detection on /var/lib/docker/overlay2 if it's an existing directory. // Perform feature detection on /var/lib/docker/overlay2 if it's an existing directory.
// This covers situations where /var/lib/docker/overlay2 is a mount, and on a different // This covers situations where /var/lib/docker/overlay2 is a mount, and on a different
// filesystem than /var/lib/docker. // filesystem than /var/lib/docker.
@ -152,30 +145,6 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
return nil, graphdriver.ErrNotSupported return nil, graphdriver.ErrNotSupported
} }
fsMagic, err := graphdriver.GetFSMagic(testdir)
if err != nil {
return nil, err
}
if fsName, ok := graphdriver.FsNames[fsMagic]; ok {
backingFs = fsName
}
switch fsMagic {
case graphdriver.FsMagicAufs, graphdriver.FsMagicEcryptfs, graphdriver.FsMagicNfsFs, graphdriver.FsMagicOverlay, graphdriver.FsMagicZfs:
logger.Errorf("'overlay2' is not supported over %s", backingFs)
return nil, graphdriver.ErrIncompatibleFS
case graphdriver.FsMagicBtrfs:
// Support for OverlayFS on BTRFS was added in kernel 4.7
// See https://btrfs.wiki.kernel.org/index.php/Changelog
if kernel.CompareKernelVersion(*v, kernel.VersionInfo{Kernel: 4, Major: 7, Minor: 0}) < 0 {
if !opts.overrideKernelCheck {
logger.Errorf("'overlay2' requires kernel 4.7 to use on %s", backingFs)
return nil, graphdriver.ErrIncompatibleFS
}
logger.Warn("Using pre-4.7.0 kernel for overlay2 on btrfs, may require kernel update")
}
}
supportsDType, err := fsutils.SupportsDType(testdir) supportsDType, err := fsutils.SupportsDType(testdir)
if err != nil { if err != nil {
return nil, err return nil, err