[3/5] mount: save real_root for external mounts

Submitted by Pavel Tikhomirov on March 1, 2017, 1:17 p.m.

Details

Message ID 20170301131745.22606-4-ptikhomirov@virtuozzo.com
State New
Series "mount: handle external mount bindmounts"
Headers show

Commit Message

Pavel Tikhomirov March 1, 2017, 1:17 p.m.
need it to check if we can bindmount from external mount

https://jira.sw.ru/browse/PSBM-46753
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 criu/mount.c     | 3 ++-
 images/mnt.proto | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/mount.c b/criu/mount.c
index f5835d3..bd2497b 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -1306,6 +1306,7 @@  static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img)
 		 * for reverse mapping details.
 		 */
 		me.root	= pm->external;
+		me.real_root = pm->root;
 		me.has_ext_mount = true;
 		me.ext_mount = true;
 	} else
@@ -2416,7 +2417,7 @@  static int get_mp_root(MntEntry *me, struct mount_info *mi)
 {
 	char *ext = NULL;
 
-	mi->root = xstrdup(me->root);
+	mi->root = xstrdup(me->real_root ? : me->root);
 	if (!mi->root)
 		return -1;
 
diff --git a/images/mnt.proto b/images/mnt.proto
index 50cd8af..1360b69 100644
--- a/images/mnt.proto
+++ b/images/mnt.proto
@@ -53,4 +53,5 @@  message mnt_entry {
 
 	optional bool		deleted			= 16;
 	optional uint32		sb_flags		= 17 [(criu).hex = true];
+	optional string		real_root		= 18;
 }

Comments

Andrey Vagin March 1, 2017, 11:52 p.m.
On Wed, Mar 01, 2017 at 04:17:43PM +0300, Pavel Tikhomirov wrote:
> need it to check if we can bindmount from external mount
> 
> https://jira.sw.ru/browse/PSBM-46753
> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
> ---
>  criu/mount.c     | 3 ++-
>  images/mnt.proto | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/criu/mount.c b/criu/mount.c
> index f5835d3..bd2497b 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -1306,6 +1306,7 @@ static int dump_one_mountpoint(struct mount_info *pm, struct cr_img *img)
>  		 * for reverse mapping details.
>  		 */
>  		me.root	= pm->external;
> +		me.real_root = pm->root;
>  		me.has_ext_mount = true;
>  		me.ext_mount = true;
>  	} else
> @@ -2416,7 +2417,7 @@ static int get_mp_root(MntEntry *me, struct mount_info *mi)
>  {
>  	char *ext = NULL;
>  
> -	mi->root = xstrdup(me->root);
> +	mi->root = xstrdup(me->real_root ? : me->root);
>  	if (!mi->root)
>  		return -1;
>  
> diff --git a/images/mnt.proto b/images/mnt.proto
> index 50cd8af..1360b69 100644
> --- a/images/mnt.proto
> +++ b/images/mnt.proto
> @@ -53,4 +53,5 @@ message mnt_entry {
>  
>  	optional bool		deleted			= 16;
>  	optional uint32		sb_flags		= 17 [(criu).hex = true];
> +	optional string		real_root		= 18;

I think it is better to add "external"

>  }
> -- 
> 2.9.3
>