[CRIU] [PATCH v4 04/17] protobuf: autofs mount entry introduced

Pavel Emelyanov xemul at parallels.com
Tue Jan 19 05:37:23 PST 2016


On 01/07/2016 07:09 PM, Stanislav Kinsburskiy wrote:
> This entry will be used to carry all the autofs parameters, required to
> restore mount point.
> 
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> ---
>  include/mount.h    |    3 +++
>  mount.c            |   14 ++++++++++++++
>  protobuf/mnt.proto |   16 ++++++++++++++++
>  3 files changed, 33 insertions(+)
> 
> diff --git a/include/mount.h b/include/mount.h
> index b3bbdce..d2ccd64 100644
> --- a/include/mount.h
> +++ b/include/mount.h
> @@ -5,6 +5,7 @@
>  
>  #include "asm/types.h"
>  #include "list.h"
> +#include "protobuf/mnt.pb-c.h"
>  
>  struct proc_mountinfo;
>  struct pstree_item;
> @@ -84,6 +85,8 @@ struct mount_info {
>  	struct list_head	postpone;
>  
>  	void			*private;	/* associated filesystem data */
> +
> +	AutofsEntry		*autofs;

Why not use the void *private field?

>  };
>  
>  extern struct mount_info *mntinfo;
> diff --git a/mount.c b/mount.c
> index f7df464..645c4b4 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -1873,6 +1873,8 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img)
>  	} else
>  		me.root = pm->root;
>  
> +	me.autofs = pm->autofs;
> +
>  	if (pb_write_one(img, &me, PB_MNT))
>  		return -1;
>  
> @@ -2759,6 +2761,15 @@ static int get_mp_mountpoint(MntEntry *me, struct mount_info *mi, char *root, in
>  	return 0;
>  }
>  
> +static int get_mp_autofs(MntEntry *me, struct mount_info *mi)
> +{
> +	mi->autofs = xmalloc(sizeof(*mi->autofs));
> +	if (!mi->autofs)
> +		return -1;
> +	mi->autofs = me->autofs;

Leans xmalloc-ed mem above.

> +	return 0;
> +}
> +
>  static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
>  {
>  	MntEntry *me = NULL;
> @@ -2835,6 +2846,9 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
>  		if (get_mp_mountpoint(me, pm, root, root_len))
>  			goto err;
>  
> +		if (get_mp_autofs(me, pm))
> +			goto err;
> +
>  		pr_debug("\tRead %d mp @ %s\n", pm->mnt_id, pm->mountpoint);
>  	}
>  
> diff --git a/protobuf/mnt.proto b/protobuf/mnt.proto
> index fe1e4bb..2b697c6 100644
> --- a/protobuf/mnt.proto
> +++ b/protobuf/mnt.proto
> @@ -22,6 +22,20 @@ enum fstype {
>  	AUTOFS			= 18;
>  };
>  
> +message autofs_entry {
> +	required int32		fd			= 1;
> +	required int32		pgrp			= 2;
> +	required int32		timeout			= 3;
> +	required int32		minproto		= 4;
> +	required int32		maxproto		= 5;
> +	required int32		mode			= 6;
> +
> +	optional int32		uid			= 7;
> +	optional int32		gid			= 8;
> +
> +	optional int32		read_fd			= 9;

Why two fd entries here? On just fd and the other one is read_fd.

> +}
> +
>  message mnt_entry {
>  	required uint32		fstype			= 1;
>  	required uint32		mnt_id			= 2;
> @@ -45,4 +59,6 @@ message mnt_entry {
>  
>  	optional bool		deleted			= 16;
>  	optional uint32		sb_flags		= 17 [(criu).hex = true];
> +
> +	optional autofs_entry	autofs			= 18;

Plz, describe how this field will be managed for mountpoints
sharing the same superblock (e.g. mount and bind-mount of it)?

>  }
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> .
> 



More information about the CRIU mailing list