Skip to content

[24.0 backport] daemon: overlay2: Write layer metadata atomically#46703

Merged
corhere merged 1 commit intomoby:24.0from
thaJeztah:24.0_backport_atomic-layer-data-write
Oct 24, 2023
Merged

[24.0 backport] daemon: overlay2: Write layer metadata atomically#46703
corhere merged 1 commit intomoby:24.0from
thaJeztah:24.0_backport_atomic-layer-data-write

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>
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.

4 participants