-
Notifications
You must be signed in to change notification settings - Fork 632
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
zdtm/static/mnt_root_ext FAIL at CRIU restore #1941
Comments
2022-07-21T15:14:33.8797192Z Linux 363034b0c4e9 5.15.0-1014-azure #17~20.04.1-Ubuntu SMP Thu Jun 23 20:01:51 UTC 2022 x86_64 GNU/Linux |
Error is from do_mount_root_v2, where we do mount+MS_BIND. One idea I have is that as we don't have (intentionally as we don't want unexpected mounts to appear inside container) MS_REC, bindmount may fail due to children mounts over container root source on host. I will try to reproduce it to check if it's the case. |
I can reproduce it on my machine using alpine docker on Ubuntu 20.04. Your idea seems correct, the error is because we don't have MS_REC and there is locked children mount When I only run uns test, the error disappears. I don't have much understanding about mounting, I think maybe we use MNT_DETACH to lazy umount (in test/umount2.c) and when bind mount happens, the mountpoint is not lazily umounted yet. |
Strange, but the test |
If root mount in criu mntns is slave, it would be slave of host mount where criu is stored, so if someone mounts something in subdir of {criu-dir}/test/ on host while tests are running this mount can influence the test as it appears on top of root mount in criu mntns. 1) With mount-compat this mount can get into restored test mntns, which means wrong restore, as this mount was not there on dump. 2) With mount-v2 this mount would just fail container restore. Fixes: checkpoint-restore#1941 Signed-off-by: Pavel Tikhomirov <[email protected]>
If root mount in criu mntns is slave, it would be slave of host mount where criu is stored, so if someone mounts something in subdir of {criu-dir}/test/ on host while tests are running this mount can influence the test as it appears on top of root mount in criu mntns. 1) With mount-compat this mount can get into restored test mntns, which means wrong restore, as this mount was not there on dump. 2) With mount-v2 this mount would just fail container restore, as root container mount is mounted non-recursively to protect from unexpected mounts appear after restore. Fixes: checkpoint-restore#1941 Signed-off-by: Pavel Tikhomirov <[email protected]>
That's how I manage to "reproduce" it on Fedora:
It requires someone to create "self" bind-mount in subdir of I'd prefer to fix it by just making Not sure if it is the original problem, if it is - not sure why someone creates mounts in our directories (other test?)... |
I mean when I run without specific flavor, zdtm run ns test first, uns later, I get the error. It's not 100% but the chance is high. When I run only uns test, I can't reproduce. So I guess lazy umount may be the cause. |
This test specifically wants to create external bind-mount of "/" from criu mntns to test mntns, and it wants "/" in criu mntns to be a shared mount so that "external" mount in the test mntns is it's slave. This is to triger specific dirname() resolution which happens only when sharing restore is involved for external mounts, and only if rootfs is involved. But initially I missed that when we create external mount in test's temporary mntns it creates a propagation in criu mntns on top of root mount. This mount may influence other tests restore as child mount in root mount converts to locked child mount in criu service mntns (for uns flavour) and when criu would restore root container mount it would fail with EINVAL on non recursive bind with locked children. To fix this mess we just need to prohibit propagating from tests temporary mntns to criu mntns by making mounts slave. Fixes: checkpoint-restore#1941 Signed-off-by: Pavel Tikhomirov <[email protected]>
@minhbq-99 I managed to reproduce, exactly what you were talking about: manual alpine-criu docker container on ubuntu-22.04, thanks! And graph-trace of the reproduce is:
Meaning that we fail here, you were right:
Let's see on mountinfo at the time of failure:
There is actually a child mount, which we know becomes locked on restore from graph-trace... The problem is in mnt_root_ext test as this test creates this mnt_root_ext.test mount via propagation by accident. I've updated PR #1945 with a new fix (old fix fixes other possible problem but I believe we still need it). |
This test specifically wants to create external bind-mount of "/" from criu mntns to test mntns, and it wants "/" in criu mntns to be a shared mount so that "external" mount in the test mntns is it's slave. This is to triger specific dirname() resolution which happens only when sharing restore is involved for external mounts, and only if rootfs is involved. But initially I missed that when we create external mount in test's temporary mntns it creates a propagation in criu mntns on top of root mount. This mount may influence other tests restore as child mount in root mount converts to locked child mount in criu service mntns (for uns flavour) and when criu would restore root container mount it would fail with EINVAL on non recursive bind with locked children. To fix this mess we just need to prohibit propagating from tests temporary mntns to criu mntns by making mounts slave. Fixes: #1941 Signed-off-by: Pavel Tikhomirov <[email protected]>
This test specifically wants to create external bind-mount of "/" from criu mntns to test mntns, and it wants "/" in criu mntns to be a shared mount so that "external" mount in the test mntns is it's slave. This is to triger specific dirname() resolution which happens only when sharing restore is involved for external mounts, and only if rootfs is involved. But initially I missed that when we create external mount in test's temporary mntns it creates a propagation in criu mntns on top of root mount. This mount may influence other tests restore as child mount in root mount converts to locked child mount in criu service mntns (for uns flavour) and when criu would restore root container mount it would fail with EINVAL on non recursive bind with locked children. To fix this mess we just need to prohibit propagating from tests temporary mntns to criu mntns by making mounts slave. Fixes: checkpoint-restore#1941 Signed-off-by: Pavel Tikhomirov <[email protected]>
This test specifically wants to create external bind-mount of "/" from criu mntns to test mntns, and it wants "/" in criu mntns to be a shared mount so that "external" mount in the test mntns is it's slave. This is to triger specific dirname() resolution which happens only when sharing restore is involved for external mounts, and only if rootfs is involved. But initially I missed that when we create external mount in test's temporary mntns it creates a propagation in criu mntns on top of root mount. This mount may influence other tests restore as child mount in root mount converts to locked child mount in criu service mntns (for uns flavour) and when criu would restore root container mount it would fail with EINVAL on non recursive bind with locked children. To fix this mess we just need to prohibit propagating from tests temporary mntns to criu mntns by making mounts slave. Fixes: #1941 Signed-off-by: Pavel Tikhomirov <[email protected]>
https://github.com/checkpoint-restore/criu/runs/7452327660?check_suite_focus=true
The text was updated successfully, but these errors were encountered: