Commit dca4f4f2 authored by Stanislav Kinsburskiy's avatar Stanislav Kinsburskiy Committed by Pavel Emelyanov

autofs: restore stage introduced

AutoFS mount point is managed by user space daemon, which receives requests
from kernel via pipe, passed on mount operation.
Kernel hold write end, while user space process - read end.
Thus, for successfull AutoFS migration, this connection has to be restored.

Autofs restore is tricky. Mount point is created by init process in pair with
per-mount context to be able to fix up actual kernel-userspace pipe
connection, when all the mount points are restored.

The problems with restoring pipe connection are:

1) It has to be done from actual AutoFS mount point master process context,
because pipe and pgrp values are taken from current in kernel.
2) Actual mounts are created by "init" process, and mount point owner (master)
have to set later.
3) To update mount point master one requires an opened write end of the pipe.

To provide AutoFS mount point master with resources, mentioned above, the
following was implemented:

1) If mount master doesn't have write pipe end opened, it is created as a
clone of read pipe end file descriptor and added to master's fds list. This
end is required to reconfigure mount point master.
2) Another pipe fle is created with explicit "post_open" callback, which is
used for actual mount point reconfiguration.
3) Mount point in created by init process. Mount data, required to restore
the owner, is copied to shared memory location by post-mount callback.
Signed-off-by: 's avatarStanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent e670a1c0
This diff is collapsed.
......@@ -10,6 +10,8 @@ bool is_autofs_pipe(unsigned long inode);
struct mount_info;
int autofs_parse(struct mount_info *pm);
int autofs_dump(struct mount_info *pm);
int autofs_mount(struct mount_info *mi, const char *source, const
char *filesystemtype, unsigned long mountflags);
#include <linux/auto_fs.h>
......
......@@ -1721,7 +1721,7 @@ static struct fstype fstypes[] = {
.code = FSTYPE__AUTOFS,
.parse = autofs_parse,
.dump = autofs_dump,
.restore = always_fail,
.mount = autofs_mount,
},
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment