mount: better handling of mount propagation

Submitted by Pavel Tikhomirov on July 10, 2018, 4:02 p.m.

Details

Reviewer None
Submitted July 10, 2018, 4:02 p.m.
Last Updated July 11, 2018, 3:47 a.m.
Revision 1

Cover Letter

- Main purpose of these series is to fix and improve mounts code, now we
fail to dump customer's CT if it has e.g.:

mkdir /test
mount -t tmpfs test /test --make-private
mount --make-shared /test
cd /test
mkdir dir bind
mount --rbind dir bind
mount --rbind dir bind

cat /proc/self/mountinfo | grep test
150 707 0:48 / /test rw,relatime shared:942 - tmpfs test rw
569 150 0:48 /dir /test/bind rw,relatime shared:942 - tmpfs test rw
570 569 0:48 /dir /test/bind rw,relatime shared:942 - tmpfs test rw
571 150 0:48 /dir /test/dir rw,relatime shared:942 - tmpfs test rw

569 and 570 are shared and have the same root so validate_shared fails:

mnt: 569:./test/bind and 570:./test/bind have different set of mounts

https://jira.sw.ru/browse/PSBM-78703

- Side purpose is to prepare for a future fixes to restore shared options
for propagated mounts right (we need propagation groups for it).

Pavel Tikhomirov (9):
  mount: add helper to check unsupported children collision
  zdtm: add a test for unsupported children collision
  mount: fix can_mount_now to wait children of master's share properly
  zdtm: check children of shared slaves restore
  mount: put all mounts which propagate from each other to a list
  mount: improve can_mount_now using propagation groups
  mount: use propagation groups in propagate_mount replacing excess
    search
  mount: remove validate_shared as now we allow non-uniform sharings
  zdtm: add a test for non-uniform shares

 criu/include/mount.h                          |   2 +
 criu/mount.c                                  | 374 ++++++++++--------
 test/zdtm/static/Makefile                     |   3 +
 .../static/non_uniform_share_propagation.c    | 131 ++++++
 .../static/non_uniform_share_propagation.desc |   1 +
 .../zdtm/static/shared_slave_mount_children.c | 125 ++++++
 .../static/shared_slave_mount_children.desc   |   1 +
 .../static/unsupported_children_collision.c   | 110 ++++++
 .../unsupported_children_collision.desc       |   1 +
 9 files changed, 586 insertions(+), 162 deletions(-)
 create mode 100644 test/zdtm/static/non_uniform_share_propagation.c
 create mode 100644 test/zdtm/static/non_uniform_share_propagation.desc
 create mode 100644 test/zdtm/static/shared_slave_mount_children.c
 create mode 100644 test/zdtm/static/shared_slave_mount_children.desc
 create mode 100644 test/zdtm/static/unsupported_children_collision.c
 create mode 100644 test/zdtm/static/unsupported_children_collision.desc
  

Revisions