Skip to content

Conversation

@mike-sul
Copy link
Contributor

This is the band aid to address issue #42964.

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.

The steps to reproduce the issue are described here #42964.

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 <[email protected]>
@thaJeztah
Copy link
Member

/cc @dmcgowan

Copy link
Member

@neersighted neersighted left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Member

Wanted to have a quick check if AtomicWriteFile uses the same filesystem as the file to be created (we've had other utilities that used the host's temp-dir, which sometimes is on a different filesystem), but looks like we should be good AFAICS;

f, err := os.CreateTemp(filepath.Dir(filename), ".tmp-"+filepath.Base(filename))

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

JoergZeidler added a commit to omnect/meta-omnect that referenced this pull request Jul 26, 2024
…ng power cut (#476)

During power cycle tests, we have found multiple sporadically issues in
case docker image pull operations and a device power cut.
Similar issues are reported here
(moby/moby#42964) and a fix was provided here
(moby/moby#46471).

Signed-off-by: Joerg Zeidler <[email protected]>
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.

6 participants