[CRIU] [PATCH 7/9] mount: Sanitize the path recalculation between submounts
Pavel Emelyanov
xemul at parallels.com
Tue Nov 11 06:50:59 PST 2014
Do paths conversions and checks step-by-step and add many comments
what we do in each step and why.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
mount.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/mount.c b/mount.c
index de081af..264b72c 100644
--- a/mount.c
+++ b/mount.c
@@ -481,9 +481,21 @@ static int validate_shared(struct mount_info *m)
if (!issubpath(ct_mpnt_rpath, m_root_rpath))
continue;
+ /*
+ * The ct has peer in m but with the mount path deeper according
+ * to m's depth relavie to t. Thus -- trim this difference from
+ * ct's mountpoint path.
+ */
+
+ ct_mpnt_rpath += len;
+
+ /*
+ * Find in m the mountpoint that fully matches with ct (with the
+ * described above path corrections).
+ */
+
list_for_each_entry_safe(cm, tmp, &m->children, siblings) {
- /* B */
- if (strcmp(ct_mpnt_rpath + len, cm->mountpoint + m_mpnt_l))
+ if (strcmp(ct_mpnt_rpath, cm->mountpoint + m_mpnt_l))
continue;
if (!mounts_equal(cm, ct, false)) {
--
1.8.4.2
More information about the CRIU
mailing list