Detect overlay2 support on pre-4.0 kernels#35527
Conversation
|
@kolyshkin @friism @dmcgowan I think this os roughly what's needed, but would need testing, and can use some eyes; opened this so that we can discuss |
There was a problem hiding this comment.
Logic is reversed, should be if opts.overrideKernelCheck
There was a problem hiding this comment.
Oh! Yes, last-minute change before I pushed, thought to keep the Warning in place so made it an if/else; updating
daemon/graphdriver/overlay2/check.go
Outdated
There was a problem hiding this comment.
What is the error that gets returned when it is not supported?
There was a problem hiding this comment.
I saw @kolyshkin tested this;
| CentOS version | Kernel version | Compile date | Error |
|---|---|---|---|
| 7.1 | 3.10.0-229.1.2.el7.x86_64 | ? | failed to mount overlay: invalid argument |
| 7.1 | 3.10.0-229.20.1.el7.x86_64 | ? | failed to mount overlay: invalid argument |
| 7.2 | 3.10.0-327.el7.x86_64 | Nov 19 2015 | nil |
| 7.2 | 3.10.0-327.36.3.el7.x86_64 | Oct 24 2016 | nil |
| 7.3 | 3.10.0-514.26.2.el7.x86_64 | Jul 4 2017 | nil |
daemon/graphdriver/overlay2/check.go
Outdated
daemon/graphdriver/overlay2/check.go
Outdated
daemon/graphdriver/overlay2/check.go
Outdated
There was a problem hiding this comment.
Maybe use a for loop here instead? Something like
for _, dir := range []string{"lower1", "lower2", "upper", "work", "merged"} {
if err := os.Mkdir(filepath.Join(td, dir), 0755); err != nil {
return err
}
}There was a problem hiding this comment.
Yes, I like that (I used the other check in this file as a starting point, but that looks better 👍)
daemon/graphdriver/overlay2/check.go
Outdated
There was a problem hiding this comment.
No need to use defer here, I think it can just be unmounted right away
There was a problem hiding this comment.
Perhaps this hunk need to be removed
f320429 to
de08f78
Compare
daemon/graphdriver/overlay2/check.go
Outdated
There was a problem hiding this comment.
@kolyshkin curious to know if this was tested with selinux enabled? just wanted to make sure the writing to tmp works.
@andrewhsu good question! I did my checks on the box with selinux disabled, but by looking at the code I see that directories are created under the graphdriver "home" dir which should succeed as long as docker+selinux is confgured properly. The above is purely theoretical though; I'll do some real checks |
|
Oops I guess we should either do something like - if err := supportsMultipleLowerDir(home); err != nil {
+ if err := supportsMultipleLowerDir(filepath.Dir(home)); err != nil {or move the creation of the driver home to above this check (and make sure to remove the dir on error path). I like the former version more. Update: in fact at this point even the driver home's parent dir (i.e. /var/lib/docker) might not be available, so maybe it's easy to create a dir and do the check |
|
@kolyshkin looking at the code, if fsMagic, err := graphdriver.GetFSMagic(home) |
|
Oh, never mind that takes the parent directory |
The overlay2 storage-driver requires multiple lower dir support for overlayFs. Support for this feature was added in kernel 4.x, but some distros (RHEL 7.4, CentOS 7.4) ship with an older kernel with this feature backported. This patch adds feature-detection for multiple lower dirs, and will perform this feature-detection on pre-4.x kernels with overlayFS support. With this patch applied, daemons running on a kernel with multiple lower dir support will now select "overlay2" as storage-driver, instead of falling back to "overlay". Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
de08f78 to
955c1f8
Compare
|
@kolyshkin updated; could you check with SELinux? (given that it now will check Alternatively, we should create |
By looking at the code, it seems it is checking Anyway, it works! |
|
The test to start dockerd was done
A relevant quote from the logsNov 29 02:46:02 kir-ce71 dockerd[7988]: time="2017-11-29T02:46:02.898726143Z" level=info msg="Loading containers: done." Test sequence:System info: |
fixes #34368
The overlay2 storage-driver requires multiple lower dir support for overlayFs. Support for this feature was added in kernel 4.x, but some distros (RHEL 7.4, CentOS 7.4) ship with an older kernel with this feature backported.
This patch adds feature-detection for multiple lower dirs, and will perform this feature-detection on pre-4.x kernels with overlayFS support.
With this patch applied, daemons running on a kernel with multiple lower dir support will now select "overlay2" as storage-driver, instead of falling back to "overlay".
- Description for the changelog