From 01b8d40ced03c38cb545bb83d568a5a951e0b609 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Wed, 27 Jul 2022 16:03:25 +0300 Subject: [PATCH] zdtm/mnt_root_ext: don't allow propagation from test mntns to criu mntns 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 --- test/zdtm/static/mnt_root_ext.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/zdtm/static/mnt_root_ext.c b/test/zdtm/static/mnt_root_ext.c index 6a2eb068c..305e87262 100644 --- a/test/zdtm/static/mnt_root_ext.c +++ b/test/zdtm/static/mnt_root_ext.c @@ -51,6 +51,14 @@ int main(int argc, char **argv) return 1; } + /* + * Make mounts in temporary mntns slave, to prevent propagation to criu mntns + */ + if (mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL)) { + pr_perror("make rslave"); + return 1; + } + /* * Populate to the tests root host's rootfs subdir */