Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devel #14

Closed
wants to merge 213 commits into from
Closed

devel #14

wants to merge 213 commits into from

Conversation

avagin
Copy link
Owner

@avagin avagin commented Feb 5, 2016

No description provided.

@avagin avagin force-pushed the coverity_scan branch 2 times, most recently from 8ed8e7f to 38625f3 Compare February 5, 2016 23:04
@xemul
Copy link
Collaborator

xemul commented Feb 6, 2016

Huh? I thought we develop on the mailing list :)

@avagin
Copy link
Owner Author

avagin commented Feb 7, 2016

@xemul This is my github;). You are welcome to send pull-requests to https://github.com/avagin/criu and Mr Jenkins will validate them. I'm not going to merge any pull-requests, they can be used only to run tests.

You can create a pull-request for one branch from your repo and then Mr Jenkins will validate it each time when you push something into it.

@avagin avagin force-pushed the coverity_scan branch 2 times, most recently from 4b0d4fb to 68996ad Compare February 18, 2016 21:35
@avagin avagin force-pushed the master branch 24 times, most recently from 0e72efe to 4600f73 Compare February 20, 2016 07:18
Snorch and others added 22 commits February 25, 2022 13:10
Will use this for cross mount namespace bindmounts.

Note: don't need separate kdat for mount-v2, as MOVE_MOUNT_SET_GROUP
were added much later than open_tree and all related fixups.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Will use openat2 + RESOLVE_NO_XDEV to detect mountpoints.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This helper would be useful to get mountpoints of source path of
external mounts without parsing host mountinfo. When we restore
mountpoint-external mount and we need to copy sharing from source via
MOVE_MOUNT_SET_GROUP, it would require from us to give it real
mountpoint of source path to be able to copy sharing group.

This uses openat2 RESOLVE_NO_XDEV feature which detects crossing
mountpoint boundary instead of potentially slow mountinfo parsing.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This can be useful to check options which depend on some kernel features
listed in kdat.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This patch only adds an option, no engine behind it yet.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/503f9ad2c

Changes: allow --mount-v2 option only on restore and only if
MOVE_MOUNT_SET_GROUP is supported (this also requires change in
unittest/mock.c), change id in rpc criu_opts.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This is a preparation of mounts-v2 new algorithm for mount restore, we
add an alternative mountpoints to each mount, so that if we mount mounts
in these mountpoints they will be "plain": each mount in separate
sub-directory of root_yard, mounts will be mounted without tree. Tree
reconstruction will be done in separate step.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/5e6de171a

Changes: improve get_plain_mountpoint().

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Fixes: d0d1179 ("mount: move functions about mounts from proc_parse.h")

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Export root_yard_mp and it's mntns_roots.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Design of mounts-v2:

  As a preparation step we classify mounts in groups by (shared_id,
  master_id) in new resolve_shared_mounts_v2 (just after reading images).

  New function prepare_mnt_ns_v2 is our main entry point when switching
  from old mount engine to new one actually happens.

  First we pre-create each mount namespace nearly empty, only with root
  yard in place (pre_create_mount_namespaces).

  We walk the mount tree and mount each mount similar to old mount
  engine but not in mount tree but as a sub-directory of root yard
  (plain mountpoint) in service (criu) mount namespace. Also we
  bind this mount from service mntns to real mntns just after creation.
  (do_mount_in_right_mntns)

  Note: this way we initially have the final mount which would be
  visible to restored container user with right mnt_id for the sake of
  e.g. creating unix sockets on it (for unix socket bindmounts), and
  both have copy of the mount in service mntns so that old code which
  accesses files on mounts through service mntns still can acces them.

  New can_mount_now_v2 is now free from heuristics we had for restoring
  shared groups, we will restore them later via MOVE_MOUNT_SET_GROUP,
  for now everything is private.

  Now when all plain mount are created in real mount namespaces, we can
  move them to the tree for each namespace. Also we open fds on the
  mountpoint: one mp_fd_id before moving and another mnt_fd_id after,
  so that we can access each file later from final mntns via those fds.
  (assemble_mount_namespaces)

  New restore_mount_sharing_options walks each root sharing group and
  their descendants with dfs tree walk. It creates sharing for the first
  mount in the sharing group and then sets the same sharing on all other
  mounts in this group.

  Sharing creation for fist mount is two step:

  a) If mount has master_id we either copy shared_id from parent sharing
  group or from external source and then make mount slave thus
  converting it to right master_id.
  b) Next if mount has shared_id we just make us shared, creating right
  shared_id.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/596651d02

Changes:
- Split all "exporting" to separate preparational patches
- Rework cr_time
- Switch to MOVE_MOUNT_SET_GROUP
- Use resolve_mountpoint for external mounts (for MOVE_MOUNT_SET_GROUP)
- Mounting plain mounts both in service and in restored-final mntns
- Call MOVE_MOUNT_SET_GROUP from usernsd
- Rework can_mount_now_v2 to handle bind of both root and external.
- Use sys_move_mount for mount assembling.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/e4a430e1f

Changes: prepend --mounts-v2 to r_opts in zdtm.py so that we can disable
this option with --no-mounts-v2 from test desc files.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
These test simply checks that sharing between two mounts in container:
1) external mount and 2) it's bind persists (case when bind has the same
mountpoint).

Note: on old mount engine mounts inside container become also shared
with mount in criu mount namespace (outside container) after c/r which
is not right.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/76a09e850

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Mounts-v2 engine should fix multiple problems of old engine relative to
sharing options, lets add a test for such problems.

Add all four types of shared groups: 1) private, 2) shared, 3) slave
and 4) slave+shared for mounts. Propagate them into sharing and after
propagation change sharing with four ways: 1) don't change, 2) make
private, 3) make slave and 4) make private + make shared.

This brings 16 cases of different sharing options for mount propagation,
lets check that they all are restored fine.

Lets create mounts from description to make it easier to improve this
test in future.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/8bcd0034d

FIXME: need to check options restored right as we don't have
--check-mounts to do this job for us.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Before mounts-v2 we have seen mounts loosing their mount readonly flags
when they were in a propagation group, because CRIU "forgot" to set
them, with new mount engine it should work now as all propagations are
now created on the same path there all other normal mounts are created,
and all mount flags are restored.

This test actually mounts only one mount, other three are propagations,
lets set mount ro flag for half of them.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/22584993d

FIXME: need to check options restored right as we don't have
--check-mounts to do this job for us.

Reviewed-by: Alexander Mikhalitsyn (Virtuozzo) <alexander@mihalicyn.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
We can have tracefs separate mount from debugfs and that's why the
/sys/kernel/debug external mount now has children and this thing is not
supported to be bind in container with children, because we don't wan't
external mounts to introduce some unexpected extra external mounts so we
bind them without MS_REC in mount-v2 unlike in old mount engine.

We can either bind without MS_REC when constructing test or provide all
children mount as separate external mounts to criu, let's just disable
for now.

Cherry-picked from Virtuozzo criu:
https://src.openvz.org/projects/OVZ/repos/criu/commits/87875c023

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
It is nice to have at least one test for device-external mounts for
mount-v2.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Let's run zdtm in jenkins with --mounts-v2 option and same for
device-external mount test from others.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 5, 2022

Codecov Report

❗ No coverage uploaded for pull request base (master@e1e2670). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 518cd3a differs from pull request most recent head 80e3418. Consider uploading reports for the commit 80e3418 to get more accurate results

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #14   +/-   ##
=========================================
  Coverage          ?   69.16%           
=========================================
  Files             ?      128           
  Lines             ?    32084           
  Branches          ?        0           
=========================================
  Hits              ?    22191           
  Misses            ?     9893           
  Partials          ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1e2670...80e3418. Read the comment docs.

@avagin avagin force-pushed the master branch 3 times, most recently from 9141e3c to 1028581 Compare August 21, 2023 05:48
@github-actions
Copy link

A friendly reminder that this PR had no activity for 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.