Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPavel Tikhomirov <ptikhomirov@virtuozzo.com>2020-10-14 15:56:52 +0300
committerAndrei Vagin <avagin@gmail.com>2022-04-29 03:53:52 +0300
commitf736d88c99925cf2d8bdac4dda680161d76bff94 (patch)
treedf75425c604667851d22b1f4d4a500ef4cce7cf2 /test
parentef53df471d44666330c7a7b58aad9e0673b7ca65 (diff)
zdtm: add propagation group with mount flags to mount_complex_sharing
Before mounts-v2 we have seen mounts loosing their mount readonly flags when they were in a propagation group, because CRIU "forgot" to set them, with new mount engine it should work now as all propagations are now created on the same path there all other normal mounts are created, and all mount flags are restored. This test actually mounts only one mount, other three are propagations, lets set mount ro flag for half of them. Cherry-picked from Virtuozzo criu: https://src.openvz.org/projects/OVZ/repos/criu/commits/22584993d FIXME: need to check options restored right as we don't have --check-mounts to do this job for us. Reviewed-by: Alexander Mikhalitsyn (Virtuozzo) <alexander@mihalicyn.com> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Diffstat (limited to 'test')
-rw-r--r--test/zdtm/static/mount_complex_sharing.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/test/zdtm/static/mount_complex_sharing.c b/test/zdtm/static/mount_complex_sharing.c
index efc1b14aa..b4463c41a 100644
--- a/test/zdtm/static/mount_complex_sharing.c
+++ b/test/zdtm/static/mount_complex_sharing.c
@@ -32,7 +32,8 @@ struct file {
* bind_root - root offset from bind source
* fstype - needed for non-binds, always tmpfs
* source - source for mounting
- * shflags - array of sharing options applied after mounting (ending with -1)
+ * flags - array of sharing options or mount flags applied after
+ * mounting (ending with -1)
* mounted - identifies implicitly propagated mounts
* files - array of files we need to create on mount (ending with zeroed file)
*/
@@ -42,7 +43,7 @@ struct mountinfo {
char *bind_root;
char *fstype;
char *source;
- int shflags[3];
+ int flags[3];
bool mounted;
struct file files[10];
};
@@ -70,6 +71,7 @@ struct mountinfo mounts[] = {
{"prop-shared", true},
{"prop-slave", true},
{"prop-slave-shared", true},
+ {"prop-mount-flags", true},
{NULL}
}
},
@@ -106,6 +108,11 @@ struct mountinfo mounts[] = {
{"shared-bind-4/prop-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true},
{"shared-bind-4/prop-slave", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true},
{"shared-bind-4/prop-slave-shared", -1, NULL, NULL, NULL, {MS_PRIVATE, MS_SHARED, -1}, true},
+
+ {"shared-bind-1/prop-mount-flags", 5, "subdir", NULL, NULL, {MS_RDONLY|MS_REMOUNT|MS_BIND, -1}, false},
+ {"shared-bind-2/prop-mount-flags", -1, NULL, NULL, NULL, {MS_RDONLY|MS_REMOUNT|MS_BIND, -1}, true},
+ {"shared-bind-3/prop-mount-flags", -1, NULL, NULL, NULL, {-1}, true},
+ {"shared-bind-4/prop-mount-flags", -1, NULL, NULL, NULL, {-1}, true},
};
/* clang-format on */
@@ -150,7 +157,7 @@ static int fill_content(struct mountinfo *mi)
static int mount_one(struct mountinfo *mi)
{
char source[PATH_MAX], target[PATH_MAX];
- int *shflags = mi->shflags, mflags = 0;
+ int *flags = mi->flags, mflags = 0;
char *fstype = NULL;
test_msg("Mounting %s %d %s %s %d\n", mi->mountpoint, mi->bind, mi->fstype, mi->source, mi->mounted);
@@ -158,7 +165,7 @@ static int mount_one(struct mountinfo *mi)
snprintf(target, sizeof(target), "%s/%s", dirname, mi->mountpoint);
if (mi->mounted)
- goto sharing;
+ goto apply_flags;
if (mi->bind != -1) {
snprintf(source, sizeof(source), "%s/%s/%s", dirname, mounts[mi->bind].mountpoint, mi->bind_root);
@@ -177,14 +184,14 @@ static int mount_one(struct mountinfo *mi)
if (fill_content(mi))
return -1;
-sharing:
- while (shflags[0] != -1) {
- test_msg("Making mount %s 0x%x\n", target, shflags[0]);
- if (mount(NULL, target, NULL, shflags[0], NULL)) {
- pr_perror("Failed to make mount %s 0x%x", target, shflags[0]);
+apply_flags:
+ while (flags[0] != -1) {
+ test_msg("Making mount %s 0x%x\n", target, flags[0]);
+ if (mount(NULL, target, NULL, flags[0], NULL)) {
+ pr_perror("Failed to make mount %s 0x%x", target, flags[0]);
return -1;
}
- shflags++;
+ flags++;
}
return 0;