[CRIU] [PATCH 14/15] mount: create target directory for autofs-nested mounts
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Thu Dec 3 05:30:04 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 | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/mount.c b/mount.c
index 03bd3c0..a1dccfe 100644
--- a/mount.c
+++ b/mount.c
@@ -1977,6 +1977,20 @@ static int do_new_mount(struct mount_info *mi)
if (remount_ro)
sflags &= ~MS_RDONLY;
+ if (!strcmp(mi->parent->fstype->name, "autofs") &&
+ strcmp(mi->mountpoint, mi->parent->mountpoint)) {
+ /*
+ * 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