Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

[18.09 backport] overlay2: use index=off if possible (fix EBUSY on mount) #84

Merged
merged 2 commits into from
Nov 21, 2018

Conversation

thaJeztah
Copy link
Member

backport of moby#37993 for 18.09
fixes moby#37970

git checkout -b 18.09_backport_ovr2_index ce-engine/18.09
git cherry-pick -s -S -x a55d32546a8556f9e6cabbc99836b573b9944f0c
git cherry-pick -s -S -x 8422d85087bfa770b62ef4e1daaca95ee6783d86

cherry-pick was clean, no conflicts

This simplifies the code a lot.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit a55d325)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
As pointed out in moby#37970,
Docker overlay driver can't work with index=on feature of
the Linux kernel "overlay" filesystem. In case the global
default is set to "yes", Docker will fail with EBUSY when
trying to mount, like this:

> error creating overlay mount to ...../merged: device or resource busy

and the kernel log should contain something like:

> overlayfs: upperdir is in-use by another mount, mount with
> '-o index=off' to override exclusive upperdir protection.

A workaround is to set index=off in overlay kernel module
parameters, or even recompile the kernel with
CONFIG_OVERLAY_FS_INDEX=n in .config. Surely this is not
always practical or even possible.

The solution, as pointed out my Amir Goldstein (as well as
the above kernel message:) is to use 'index=off' option
when mounting.

NOTE since older (< 4.13rc1) kernels do not support "index="
overlayfs parameter, try to figure out whether the option
is supported. In case it's not possible to figure out,
assume it is not.

NOTE the default can be changed anytime (by writing to
/sys/module/overlay/parameters/index) so we need to always
use index=off.

[v2: move the detection code to Init()]
[v3: don't set index=off if stat() failed]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 8422d85)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah added this to the 18.09.0 milestone Oct 11, 2018
@thaJeztah thaJeztah changed the title [18.09-backport] overlay fixes [18.09-backport] overlay2: use index=off if possible (fix EBUSY on mount) Oct 11, 2018
@thaJeztah
Copy link
Member Author

ping @kolyshkin @dmcgowan PTAL

@thaJeztah thaJeztah changed the title [18.09-backport] overlay2: use index=off if possible (fix EBUSY on mount) [18.09 backport] overlay2: use index=off if possible (fix EBUSY on mount) Oct 13, 2018
@thaJeztah thaJeztah modified the milestones: 18.09.0, 18.09.1 Nov 8, 2018
@dmcgowan
Copy link

LGTM

@kolyshkin
Copy link

LGTM

@seemethere seemethere merged commit 27b0fee into docker-archive:18.09 Nov 21, 2018
@thaJeztah thaJeztah deleted the 18.09_backport_ovr2_index branch November 21, 2018 22:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants