[CRIU] [RFC PATCH 5/5] mount: create target directory for autofs-nested mounts

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Mon Nov 23 09:22:57 PST 2015


In case of remounting AutoFS-nested mount points, target dentry doesn't exist
and has to be created.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 mount.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/mount.c b/mount.c
index 7a391ca..7e25338 100644
--- a/mount.c
+++ b/mount.c
@@ -2373,6 +2373,19 @@ static int do_new_mount(struct mount_info *mi)
 	if (remount_ro)
 		sflags &= ~MS_RDONLY;
 
+	if (!strcmp(mi->parent->fstype->name, "autofs")) {
+		/*
+		 * This is autofs mount.
+		 * We have to create mount target manually.
+		 */
+		pr_info("Creating autofs nested mount point dentry: %s (%d)\n", mi->mountpoint, getpid());
+		if (mkdir(mi->mountpoint, 0555) < 0) {
+			pr_perror("Failed to create %s path for autofs mount (%d)",
+					mi->mountpoint, errno);
+			return -1;
+		}
+	}
+
 	if (do_mount(src, mi->mountpoint, tp->name, sflags, mi->options) < 0) {
 		pr_perror("Can't mount at %s", mi->mountpoint);
 		return -1;



More information about the CRIU mailing list