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

Submitted by Andrei Vagin on May 5, 2016, 2:21 p.m.

Details

Message ID 1462458081-32677-1-git-send-email-avagin@openvz.org
State Accepted
Series "Series without cover letter"
Commit b8758b986f72b1673530d942184127dc396d231a
Headers show

Commit Message

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

if mountpoints of ct and t are equal we can't build absolute path
in ct_mpnt_rpath, so let's skip the first "/" in m_root_rpath

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

Patch hide | download patch | download mbox

diff --git a/criu/mount.c b/criu/mount.c
index a3c830f..13d3603 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -635,6 +635,14 @@  static int validate_shared(struct mount_info *m)
 		ct_mpnt_rpath = ct->mountpoint + t_mpnt_l; /* path from t->mountpoint to ct->mountpoint */
 
 		/*
+		 * if mountpoints of ct and t are equal we can't build
+		 * absolute path in ct_mpnt_rpath, so let's skip the first "/"
+		 * in m_root_rpath
+		 */
+		if (ct_mpnt_rpath[0] == 0)
+			m_root_rpath++;
+
+		/*
 		 * 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 6, 2016, 12:18 p.m.
Applied, thanks