Commit cedd1025 authored by Pavel Emelyanov's avatar Pavel Emelyanov

mount: Sanitize the path recalculation between submounts

Do paths conversions and checks step-by-step and add many comments
what we do in each step and why.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
parent 991c0287
......@@ -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)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment