[CRIU] [PATCH 3/3] mount: Move cgroup checks into callback

Pavel Emelyanov xemul at virtuozzo.com
Wed Jan 11 00:32:53 PST 2017


Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/filesystems.c | 12 ++++++++++++
 criu/mount.c       |  5 -----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/criu/filesystems.c b/criu/filesystems.c
index c79cf91..9268aaa 100644
--- a/criu/filesystems.c
+++ b/criu/filesystems.c
@@ -574,6 +574,17 @@ static int tracefs_parse(struct mount_info *pm)
 	return 1;
 }
 
+static bool cgroup_sb_equal(struct mount_info *a, struct mount_info *b)
+{
+	if (a->private && b->private &&
+			strcmp(a->private, b->private))
+		return false;
+	if (strcmp(a->options, b->options))
+		return false;
+
+	return true;
+}
+
 static int cgroup_parse(struct mount_info *pm)
 {
 	if (!(root_ns_mask & CLONE_NEWCGROUP))
@@ -720,6 +731,7 @@ static struct fstype fstypes[] = {
 		.name = "cgroup",
 		.code = FSTYPE__CGROUP,
 		.parse = cgroup_parse,
+		.sb_equal = cgroup_sb_equal,
 	}, {
 		.name = "aufs",
 		.code = FSTYPE__AUFS,
diff --git a/criu/mount.c b/criu/mount.c
index 473631c..c65fd6b 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -306,11 +306,6 @@ static bool mounts_sb_equal(struct mount_info *a, struct mount_info *b)
 	if (strcmp(a->options, b->options))
 		return false;
 
-	if (a->fstype->code == FSTYPE__CGROUP &&
-	    a->private && b->private &&
-	    strcmp(a->private, b->private))
-		return false;
-
 	return true;
 }
 
-- 
2.5.0



More information about the CRIU mailing list