On Tue, Jul 11, 2017 at 11:47:53AM +0300, Stanislav Kinsburskiy wrote: > The intention of this patch is to define different NFS mount cases and forbid > most ot them. > The reason behind this is that the only mount point we can migrate right now > is: > 1) created in init mount namespace > 2) shared (because it's default) > > All the other cases are not supported by spfs manager so far and migration > attempt can lead to different issues after restore is completed by CRIU. > > https://jira.sw.ru/browse/PSBM-66945 > > v2: > 1) Added check that all bind-mounts are in the same shared group for slave > mount. We need this to make sure, that all such mounts will be propagated > correctly. >
Reviewed-by: Andrei Vagin <[email protected]> Here is one inline comment > Signed-off-by: Stanislav Kinsburskiy <[email protected]> > --- > criu/mount.c | 79 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 78 insertions(+), 1 deletion(-) > > diff --git a/criu/mount.c b/criu/mount.c > index 6916974..26f3aa5 100644 > --- a/criu/mount.c > +++ b/criu/mount.c > @@ -746,6 +746,82 @@ static bool nfs_mount(const struct mount_info *m) > > } > > +static char *mnt_mark(const struct mount_info *m) > +{ > + static char *shared = "shared"; > + static char *private = "private"; > + static char *slave = "slave"; > + > + if (m->flags & MS_SHARED) > + return shared; > + > + if (m->flags & MS_SLAVE) > + return slave; both flags can be set together > + > + return private; > +} > + > +static bool unsupported_nfs_mount(const struct mount_info *m); > + > +static bool unsupported_nfs_bindmounts(const struct mount_info *m) > +{ > + const struct mount_info *bm; > + > + list_for_each_entry(bm, &m->mnt_bind, mnt_bind) { > + if (bm->shared_id != m->master_id) { > + pr_err("Bind-mount %s has another shared " > + "group, than %s: %d != %d\n", > + bm->mountpoint, m->mountpoint, > + bm->shared_id, m->master_id); > + return true; > + } > + if (unsupported_nfs_mount(bm)) > + return true; > + } > + return false; > +} > + > +static bool unsupported_nfs_mount(const struct mount_info *m) > +{ > + switch (m->nsid->type) { > + case NS_ROOT: > + if (m->flags & MS_SHARED) > + return false; > + > + pr_err("NFS mount [%s] in init mount namespace " > + "is marked as \"%s\".\n", > + m->mountpoint, mnt_mark(m)); > + pr_err("Only shared NFS mounts in init mount " > + "namespace are supported yet.\n"); > + break; > + case NS_OTHER: > + if (!(m->flags & MS_SLAVE)) { > + pr_err("NFS mount [%s] in non-init mount " > + "namespace is marked as \"%s\".\n", > + m->mountpoint, mnt_mark(m)); > + pr_err("Only slave NFS mounts in non-init " > + "mount namespace are supported yet.\n"); > + return true; > + } > + return unsupported_nfs_bindmounts(m); > + case NS_CRIU: > + pr_err("NFS mount [%s] in CRIU namespace is " > + "unsupported.\n", m->mountpoint); > + break; > + case NS_UNKNOWN: > + pr_err("Unknown NFS mount [%s] namespace type: %d\n", > + m->mountpoint, m->nsid->type); > + break; > + default: > + pr_err("Invalid NFS mount [%s] namespace type: %d\n", > + m->mountpoint, m->nsid->type); > + break; > + } > + > + > + return true; > +} > + > static bool unsupported_mount(const struct mount_info *m) > { > struct mount_info *parent = m->parent; > @@ -760,7 +836,8 @@ static bool unsupported_mount(const struct mount_info *m) > > return true; > } > - return false; > + > + return nfs_mount(m) ? unsupported_nfs_mount(m) : false; > } > > static int validate_mounts(struct mount_info *info, bool for_dump) > _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
