[Devel,vz7,v2,1/2] mounts: add unsupported mount helper

Submitted by Stanislav Kinsburskiy on June 20, 2017, 4:02 p.m.

Details

Message ID 20170620160204.52263.69260.stgit@skinsbursky-vz7.qa.sw.ru
State New
Series "mounts: fix check for overmounted NFS"
Headers show

Commit Message

Stanislav Kinsburskiy June 20, 2017, 4:02 p.m.
Call it on mount points validation and abort in case NFS is overmounted.
This patch also adds nfs_mount helper, which fixes the issue with skipping
this check for NFSv4 mount point.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 criu/mount.c |   23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/mount.c b/criu/mount.c
index 942515e..667b279 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -739,6 +739,25 @@  static bool mnt_is_external(struct mount_info *m)
 	return 0;
 }
 
+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 (parent && nfs_mount(parent)) {
+		pr_err("overmounted NFS (%s) is not supported yet:\n",
+				parent->mountpoint);
+		return true;
+	}
+	return false;
+}
+
 static int validate_mounts(struct mount_info *info, bool for_dump)
 {
 	struct mount_info *m, *t;
@@ -810,10 +829,8 @@  skip_fstype:
 			return -1;
 		}
 
-		if (!strcmp(m->fstype->name, "nfs") && !list_empty(&m->children)) {
-			pr_err("overmounted NFS (%s) is not supported yet\n", m->mountpoint);
+		if (unsupported_mount(m))
 			return -1;
-		}
 	}
 
 	return 0;