mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-04 15:53:44 +00:00
zdtm: check children of shared slaves restore
495 494 0:62 / /zdtm/static/shared_slave_mount_children.test/share rw,relatime shared:235 - tmpfs share rw 496 494 0:62 / /zdtm/static/shared_slave_mount_children.test/slave1 rw,relatime shared:236 master:235 - tmpfs share rw 497 494 0:62 / /zdtm/static/shared_slave_mount_children.test/slave2 rw,relatime shared:236 master:235 - tmpfs share rw 498 496 0:63 / /zdtm/static/shared_slave_mount_children.test/slave1/child rw,relatime shared:237 - tmpfs child rw 499 497 0:63 / /zdtm/static/shared_slave_mount_children.test/slave2/child rw,relatime shared:237 - tmpfs child rw Before the fix we had: (00.167574) 1: Error (criu/mount.c:1769): mnt: A few mount points can't be mounted (00.167577) 1: Error (criu/mount.c:1773): mnt: 498:496 / /tmp/.criu.mntns.o2Op5j/9-0000000000/zdtm/static/shared_slave_mount_children.test/slave1/child child (00.167580) 1: Error (criu/mount.c:1773): mnt: 497:494 / /tmp/.criu.mntns.o2Op5j/9-0000000000/zdtm/static/shared_slave_mount_children.test/slave2 share Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
parent
64586567ae
commit
24bd5fcfff
3 changed files with 127 additions and 0 deletions
|
|
@ -337,6 +337,7 @@ TST_DIR = \
|
|||
sk-unix-mntns \
|
||||
sk-unix01 \
|
||||
unsupported_children_collision \
|
||||
shared_slave_mount_children \
|
||||
|
||||
TST_DIR_FILE = \
|
||||
chroot \
|
||||
|
|
|
|||
125
test/zdtm/static/shared_slave_mount_children.c
Normal file
125
test/zdtm/static/shared_slave_mount_children.c
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "zdtmtst.h"
|
||||
|
||||
const char *test_doc = "Check non-uniform shares restore fine";
|
||||
const char *test_author = "Pavel Tikhomirov <ptikhomirov@virtuozzo.com>";
|
||||
|
||||
char *dirname;
|
||||
TEST_OPTION(dirname, string, "directory name", 1);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char share[PATH_MAX], slave1[PATH_MAX], slave2[PATH_MAX];
|
||||
char child[PATH_MAX];
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
if (mkdir(dirname, 0700)) {
|
||||
pr_perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount("zdtm_fs", dirname, "tmpfs", 0, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount(NULL, dirname, NULL, MS_PRIVATE, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(share, sizeof(share), "%s/share", dirname);
|
||||
if (mkdir(share, 0700)) {
|
||||
pr_perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount("share", share, "tmpfs", 0, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount(NULL, share, NULL, MS_SHARED, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(slave1, sizeof(slave1), "%s/slave1", dirname);
|
||||
if (mkdir(slave1, 0700)) {
|
||||
pr_perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount(share, slave1, NULL, MS_BIND, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount(NULL, slave1, NULL, MS_SLAVE, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount(NULL, slave1, NULL, MS_SHARED, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(slave2, sizeof(slave2), "%s/slave2", dirname);
|
||||
if (mkdir(slave2, 0700)) {
|
||||
pr_perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount(slave1, slave2, NULL, MS_BIND, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
snprintf(child, sizeof(child), "%s/slave1/child", dirname);
|
||||
if (mkdir(child, 0700)) {
|
||||
pr_perror("mkdir");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (mount("child", child, "tmpfs", 0, NULL)) {
|
||||
pr_perror("mount");
|
||||
return 1;
|
||||
}
|
||||
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
|
||||
if (umount(child)) {
|
||||
pr_perror("Unable to umount %s", child);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (umount(slave2)) {
|
||||
pr_perror("Unable to umount %s", slave2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (umount(slave1)) {
|
||||
pr_perror("Unable to umount %s", slave1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (umount(share)) {
|
||||
pr_perror("Unable to umount %s", share);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (umount(dirname)) {
|
||||
pr_perror("Unable to umount %s", dirname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pass();
|
||||
|
||||
return 0;
|
||||
}
|
||||
1
test/zdtm/static/shared_slave_mount_children.desc
Normal file
1
test/zdtm/static/shared_slave_mount_children.desc
Normal file
|
|
@ -0,0 +1 @@
|
|||
{'flavor': 'ns uns', 'flags': 'suid'}
|
||||
Loading…
Add table
Add a link
Reference in a new issue