[Devel] [PATCH 1/2] mounts: add unsupported mount helper
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Jun 20 18:46:27 MSK 2017
One minor nit below
On Tue, Jun 20, 2017 at 18:28, Stanislav Kinsburskiy wrote:
> Call it on mount points tree building and abort in case NFS is overmounted.
> This logic replaces the old one, which was checking for unsupported NFS monut
> in validate_mounts. And the reason is that call to validate_mounts depends on
> user argument, which is unsuitable for this case.
>
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> ---
> criu/mount.c | 35 ++++++++++++++++++++++-------------
> 1 file changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/criu/mount.c b/criu/mount.c
> index cc54e68..46ad66c 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -397,6 +397,25 @@ static bool mounts_equal(struct mount_info *a, struct mount_info *b)
> */
> static char *mnt_roots;
>
> +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 (m->parent && nfs_mount(parent)) {
m->parent is already dereferenced, so you may use just "parent"
instead of it.
> + pr_err("overmounted NFS (%s) is not supported yet:\n",
> + parent->mountpoint);
> + return true;
> + }
> + return false;
> +}
> +
> static struct mount_info *mnt_build_ids_tree(struct mount_info *list, struct mount_info *yard_mount)
> {
> struct mount_info *m, *root = NULL;
> @@ -457,6 +476,9 @@ static struct mount_info *mnt_build_ids_tree(struct mount_info *list, struct mou
>
> m->parent = parent;
> list_add_tail(&m->siblings, &parent->children);
> +
> + if (unsupported_mount(m))
> + return NULL;
> }
>
> if (!root) {
> @@ -739,16 +761,6 @@ static bool mnt_is_external(struct mount_info *m)
> return 0;
> }
>
> -static bool unsupported_nfs_mount(struct mount_info *m)
> -{
> - if (!list_empty(&m->children)) {
> - pr_err("overmounted NFS (%s) is not supported yet\n",
> - m->mountpoint);
> - return true;
> - }
> - return false;
> -}
> -
> static int validate_mounts(struct mount_info *info, bool for_dump)
> {
> struct mount_info *m, *t;
> @@ -819,9 +831,6 @@ skip_fstype:
> m->mnt_id, m->mountpoint);
> return -1;
> }
> -
> - if (!strcmp(m->fstype->name, "nfs") && unsupported_nfs_mount(m))
> - return -1;
> }
>
> return 0;
>
> _______________________________________________
> Devel mailing list
> Devel at openvz.org
> https://lists.openvz.org/mailman/listinfo/devel
More information about the Devel
mailing list