[Devel] [PATCH vz7 v2] mounts: add unsupported mount helper

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Tue Jun 20 18:44:06 MSK 2017


Call it on mount points tree building and abort in case NFS is overmounted.
This logic replaces the old one, which was checking for unsupported NFS monut
in validate_mounts. And the reason is that call to validate_mounts depends on
user argument, which is unsuitable for this case.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 criu/mount.c |   27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/criu/mount.c b/criu/mount.c
index 942515e..46ad66c 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -397,6 +397,25 @@ static bool mounts_equal(struct mount_info *a, struct mount_info *b)
  */
 static char *mnt_roots;
 
+static bool nfs_mount(const struct mount_info *m)
+{
+	return !strcmp(m->fstype->name, "nfs") ||
+	       !strcmp(m->fstype->name, "nfs4");
+
+}
+
+static bool unsupported_mount(const struct mount_info *m)
+{
+	struct mount_info *parent = m->parent;
+
+	if (m->parent && nfs_mount(parent)) {
+		pr_err("overmounted NFS (%s) is not supported yet:\n",
+				parent->mountpoint);
+		return true;
+	}
+	return false;
+}
+
 static struct mount_info *mnt_build_ids_tree(struct mount_info *list, struct mount_info *yard_mount)
 {
 	struct mount_info *m, *root = NULL;
@@ -457,6 +476,9 @@ static struct mount_info *mnt_build_ids_tree(struct mount_info *list, struct mou
 
 		m->parent = parent;
 		list_add_tail(&m->siblings, &parent->children);
+
+		if (unsupported_mount(m))
+			return NULL;
 	}
 
 	if (!root) {
@@ -809,11 +831,6 @@ skip_fstype:
 					m->mnt_id, m->mountpoint);
 			return -1;
 		}
-
-		if (!strcmp(m->fstype->name, "nfs") && !list_empty(&m->children)) {
-			pr_err("overmounted NFS (%s) is not supported yet\n", m->mountpoint);
-			return -1;
-		}
 	}
 
 	return 0;



More information about the Devel mailing list