You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we try to create a diff of a container running on overlayfs with ctr utility, we immediately see the following in the kernel log:
kernel: [42256.430385] overlayfs: upperdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
kernel: [42256.430389] overlayfs: workdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
And later for that container we observe this "undefined behavior" as the RootFS of that container becoming partially not-writable (an attempt to create a file results in "No such file or directory" error).
My understanding is that this happens because Compare function of walkingDiff does temporary mounts:
And it does it for an 'Active' snapshot using the same workdir and upperdir, but for overlayfs you are not supposed to do this.
As a solution I see a conversion of a mount to a read-only one before passing it to Compare. It can be done by altering the mount options like so: workdir and upperdir options are removed and a path from upperdir option is moved to the leftmost in lowerdir option.
Steps to reproduce the issue
Run ctr snapshot diff <container id> for a container running on overlayfs and observe overlayfs complains about upperdir and workdir in the kernel log.
Describe the results you received and expected
Running ctr snapshot diff on overlayfs should not corrupt the RootFS of a running container.
Description
When we try to create a diff of a container running on overlayfs with
ctr
utility, we immediately see the following in the kernel log:And later for that container we observe this "undefined behavior" as the RootFS of that container becoming partially not-writable (an attempt to create a file results in "No such file or directory" error).
My understanding is that this happens because
Compare
function ofwalkingDiff
does temporary mounts:containerd/diff/walking/differ.go
Line 89 in 45e0e5a
And it does it for an 'Active' snapshot using the same workdir and upperdir, but for overlayfs you are not supposed to do this.
As a solution I see a conversion of a mount to a read-only one before passing it to
Compare
. It can be done by altering the mount options like so:workdir
andupperdir
options are removed and a path fromupperdir
option is moved to the leftmost inlowerdir
option.Steps to reproduce the issue
ctr snapshot diff <container id>
for a container running on overlayfs and observe overlayfs complains about upperdir and workdir in the kernel log.Describe the results you received and expected
Running
ctr snapshot diff
on overlayfs should not corrupt the RootFS of a running container.What version of containerd are you using?
containerd github.com/containerd/containerd 1.4.8+azure 7eba593
Any other relevant information
runc --version
:uname -a
:Show configuration if it is related to CRI plugin.
No response
The text was updated successfully, but these errors were encountered: