[04/19] unix: image -- Shift mnt_id index

Submitted by Cyrill Gorcunov on Sept. 14, 2018, 2:08 p.m.

Details

Message ID 20180914140842.6462-5-gorcunov@gmail.com
State New
Series "unix: Add support for bindmounted dgram sockets"
Headers show

Commit Message

Cyrill Gorcunov Sept. 14, 2018, 2:08 p.m.
The index 17 is used in vz7 images, so
while this member is not yet in stable
criu lets shift it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 criu/sk-unix.c       | 6 ++++++
 images/sk-unix.proto | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index f835fad80099..6f79b182b0c3 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -2056,6 +2056,12 @@  static int init_unix_sk_info(struct unix_sk_info *ui, UnixSkEntry *ue)
 	ui->is_connected	= 0;
 	ui->peer_queue_restored = 0;
 
+	/* Compatibility with old images */
+	if (ui->ue->has_old_mnt_id) {
+		ui->ue->has_mnt_id = true;
+		ui->ue->mnt_id = ui->ue->old_mnt_id;
+	}
+
 	memzero(&ui->peer_resolve, sizeof(ui->peer_resolve));
 	memzero(&ui->d, sizeof(ui->d));
 
diff --git a/images/sk-unix.proto b/images/sk-unix.proto
index c59644f6eadd..fc033997a8a8 100644
--- a/images/sk-unix.proto
+++ b/images/sk-unix.proto
@@ -50,5 +50,9 @@  message unix_sk_entry {
 	optional bool			deleted		= 15;
 
 	optional uint32			ns_id		= 16;
-	optional sint32			mnt_id		= 17 [default = -1];
+	/*
+	 * field 17 is reserved for vz7 use
+	 */
+	optional sint32			old_mnt_id	= 17 [default = -1];
+	optional sint32			mnt_id		= 18 [default = -1];
 }

Comments

Andrey Vagin Sept. 18, 2018, 11:48 p.m.
On Fri, Sep 14, 2018 at 05:08:27PM +0300, Cyrill Gorcunov wrote:
> The index 17 is used in vz7 images, so
> while this member is not yet in stable
> criu lets shift it.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
>  criu/sk-unix.c       | 6 ++++++
>  images/sk-unix.proto | 6 +++++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/criu/sk-unix.c b/criu/sk-unix.c
> index f835fad80099..6f79b182b0c3 100644
> --- a/criu/sk-unix.c
> +++ b/criu/sk-unix.c
> @@ -2056,6 +2056,12 @@ static int init_unix_sk_info(struct unix_sk_info *ui, UnixSkEntry *ue)
>  	ui->is_connected	= 0;
>  	ui->peer_queue_restored = 0;
>  
> +	/* Compatibility with old images */
> +	if (ui->ue->has_old_mnt_id) {
> +		ui->ue->has_mnt_id = true;
> +		ui->ue->mnt_id = ui->ue->old_mnt_id;
> +	}
> +
>  	memzero(&ui->peer_resolve, sizeof(ui->peer_resolve));
>  	memzero(&ui->d, sizeof(ui->d));
>  
> diff --git a/images/sk-unix.proto b/images/sk-unix.proto
> index c59644f6eadd..fc033997a8a8 100644
> --- a/images/sk-unix.proto
> +++ b/images/sk-unix.proto
> @@ -50,5 +50,9 @@ message unix_sk_entry {
>  	optional bool			deleted		= 15;
>  
>  	optional uint32			ns_id		= 16;
> -	optional sint32			mnt_id		= 17 [default = -1];
> +	/*
> +	 * field 17 is reserved for vz7 use
> +	 */
> +	optional sint32			old_mnt_id	= 17 [default = -1];
> +	optional sint32			mnt_id		= 18 [default = -1];

What is a difference between old_mnt_id and mnt_id?

>  }
> -- 
> 2.17.1
>
Cyrill Gorcunov Sept. 19, 2018, 6:44 a.m.
On Tue, Sep 18, 2018 at 04:48:50PM -0700, Andrey Vagin wrote:
...
> >  
> > diff --git a/images/sk-unix.proto b/images/sk-unix.proto
> > index c59644f6eadd..fc033997a8a8 100644
> > --- a/images/sk-unix.proto
> > +++ b/images/sk-unix.proto
> > @@ -50,5 +50,9 @@ message unix_sk_entry {
> >  	optional bool			deleted		= 15;
> >  
> >  	optional uint32			ns_id		= 16;
> > -	optional sint32			mnt_id		= 17 [default = -1];
> > +	/*
> > +	 * field 17 is reserved for vz7 use
> > +	 */
> > +	optional sint32			old_mnt_id	= 17 [default = -1];
> > +	optional sint32			mnt_id		= 18 [default = -1];
> 
> What is a difference between old_mnt_id and mnt_id?

It is 1:1 map for vanilla criu but happen to clash with number
I already used in vz7 and happen to miss updating vanilla those
time. In result common ground for both criu instance is index 18
but vanilla criu should support old images and there we may
meet index 17. Thus after this patch index 17 is simply obsolete
but supported.

	Cyrill