[2/2] mount: handle a case when parent and child mounts in the same directory

Submitted by Andrei Vagin on May 5, 2016, 2:22 a.m.

Details

Message ID 1462414921-16804-2-git-send-email-avagin@openvz.org
State Rejected
Series "Series without cover letter"
Headers show

Commit Message

Andrei Vagin May 5, 2016, 2:22 a.m.
From: Andrew Vagin <avagin@virtuozzo.com>

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
---
 criu/mount.c | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/mount.c b/criu/mount.c
index a3c830f..6bfb152 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -634,6 +634,9 @@  static int validate_shared(struct mount_info *m)
 
 		ct_mpnt_rpath = ct->mountpoint + t_mpnt_l; /* path from t->mountpoint to ct->mountpoint */
 
+		if (ct_mpnt_rpath[0] == 0)
+			m_root_rpath++; /* skip the first "/" */
+
 		/*
 		 * Check whether ct can be is visible at m, i.e. the
 		 * ct's rpath starts (as path) with m's rpath.

Comments

Pavel Emelianov May 5, 2016, 12:24 p.m.
On 05/05/2016 05:22 AM, Andrey Vagin wrote:
> From: Andrew Vagin <avagin@virtuozzo.com>

Some better than empty comment is welcome.

> Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
> ---
>  criu/mount.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/criu/mount.c b/criu/mount.c
> index a3c830f..6bfb152 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -634,6 +634,9 @@ static int validate_shared(struct mount_info *m)
>  
>  		ct_mpnt_rpath = ct->mountpoint + t_mpnt_l; /* path from t->mountpoint to ct->mountpoint */
>  
> +		if (ct_mpnt_rpath[0] == 0)
> +			m_root_rpath++; /* skip the first "/" */
> +
>  		/*
>  		 * Check whether ct can be is visible at m, i.e. the
>  		 * ct's rpath starts (as path) with m's rpath.
>