Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23.0 backport] daemon: overlay2: Write layer metadata atomically #46704

Merged
merged 1 commit into from Oct 24, 2023

Conversation

thaJeztah
Copy link
Member

When the daemon process or the host running it is abruptly terminated, the layer metadata file can become inconsistent on the file system. Specifically, link and lower files may exist but be empty, leading to overlay mounting errors during layer extraction, such as: "failed to register layer: error creating overlay mount to : too many levels of symbolic links."

This commit introduces the use of AtomicWriteFile to ensure that the layer metadata files contain correct data when they exist on the file system.

(cherry picked from commit de2447c)

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

When the daemon process or the host running it is abruptly terminated,
the layer metadata file can become inconsistent on the file system.
Specifically, `link` and `lower` files may exist but be empty, leading
to overlay mounting errors during layer extraction, such as:
"failed to register layer: error creating overlay mount to <path>:
too many levels of symbolic links."

This commit introduces the use of `AtomicWriteFile` to ensure that the
layer metadata files contain correct data when they exist on the file system.

Signed-off-by: Mike <mike.sul@foundries.io>
(cherry picked from commit de2447c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@corhere corhere merged commit 1a92838 into moby:23.0 Oct 24, 2023
87 checks passed
@thaJeztah thaJeztah deleted the 23.0_backport_atomic-layer-data-write branch October 24, 2023 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants