8000 stage0/gc: try to avoid double overlay mounts by lucab · Pull Request #3806 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

stage0/gc: try to avoid double overlay mounts #3806

Merged
merged 1 commit into from
Sep 21, 2017

Conversation

lucab
Copy link
Member
@lucab lucab commented Sep 20, 2017

Before Linux 4.13, it used to be possible to perform double overlayfs
mounts in place. This now fails at mount() with EBUSY.
We were abusing this feature to unconditionally ensure that the stage1
image overlay mount was present before calling gc entrypoint.
This improves stage0 logic to perform the stage1 image overlay mount
only if it doesn't already exist.

Fixes #3805

@lucab
Copy link
Member Author
lucab commented Sep 20, 2017

/cc @euank I quickly checked on alpha, and this seems to be the only place where kernel behavioral change introduced issues. You may want to cherry-pick and confirm via kola though.

/cc @iaguis you should be experiencing the same bug on Arch with 4.13.

@lucab lucab requested review from iaguis and euank September 20, 2017 11:48
@iaguis
Copy link
Member
iaguis commented Sep 20, 2017

/cc @iaguis you should be experiencing the same bug on Arch with 4.13.

4.13 hasn't yet hit the core repo.

rkt/gc.go Outdated
// This behavior was introduced in Linux 4.13, double-mounts were allowed
// in older kernels.
if err == syscall.EBUSY {
return false, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the double-mount be detected above by the if m.MountPoint == stage1Dir? In this case, the EBUSY could be a real error since the code above would have detected it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, this is probably a tautological check which won't be reached in normal cases. However I trust the kernel mount return code more than our mountinfo parser, so this helps avoiding GC being aborted by mistake in situations were it could have succeeded.
In the best cases this let the kernel catch corner-cases we didn't see, in the worst case we will error our in the next step trying to call stage1 GC.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a good argument for at least logging it even if we don't fail on it.

Copy link
Member
@euank euank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've verified this fixes the issue on my system, and the code change LGTM as well.

rkt/gc.go Outdated
// This behavior was introduced in Linux 4.13, double-mounts were allowed
// in older kernels.
if err == syscall.EBUSY {
return false, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a good argument for at least logging it even if we don't fail on it.

Before Linux 4.13, it used to be possible to perform double overlayfs
mounts in place. This now fails at mount() with EBUSY.
We were abusing this feature to unconditionally ensure that the stage1
image overlay mount was present before calling gc entrypoint.
This improves stage0 logic to perform the stage1 image overlay mount
only if it doesn't already exist.
@lucab lucab force-pushed the ups/overlay-double-mount branch from 566f9d2 to a778cd1 Compare September 21, 2017 09:34
@lucab
Copy link
Member Author
lucab commented Sep 21, 2017

I've added a log statement, but I've left the keep-going on EBUSY in. PTAL.

Copy link
Member
@iaguis iaguis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iaguis iaguis merged commit 020d59b into rkt:master Sep 21, 2017
@lucab
Copy link
Member Author
lucab commented Sep 21, 2017

@euank @dm0- can you please cherry-pick this on any CL channel with kernel 4.13?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0