[CRIU] [PATCH CRIU 0/4] mount: fixes for slave mounts

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Sat Jan 30 01:31:05 PST 2016


On 01/29/2016 02:01 AM, Andrew Vagin wrote:
> On Wed, Jan 27, 2016 at 05:13:54PM +0300, Pavel Emelyanov wrote:
>> On 01/20/2016 06:42 PM, Pavel Tikhomirov wrote:
>>> Main problem I was trying to solve that migrating Virtuozzo container
>>> some slave mounts which at the same time were shared, become shared
>>> only. They lost "master:%d" in /proc/self/mountinfo output. It was
>>> because we made those mounts private before making them slave.
>>>
>>> https://jira.sw.ru/browse/PSBM-42829
>>>
>>> Pavel Tikhomirov (4):
>>>    mount: get over autodetected mounts in search for widest shared peer
>>>    mount: do not make external mounts to be private if not needed
>>>    mount: do not mark mount internaly shared if match is master not share
>>>    mount: if mount should have master we must not set mount private
>>>
>>>   mount.c | 26 ++++++++++++++++++++++----
>>>   1 file changed, 22 insertions(+), 4 deletions(-)
>>>
>>
>> Andrey, Tycho, what do we do with this set? Do you Ack all patches of
>> it, want Pavel to rework/fix or is it up to ... the maintainer :) ?
>
> I think we need to commit the second version of the second patch. It
> looks correct. I don't understand other patches.

Patch 1 just makes validate_shared() not to compare two different 
non-root mounts(in case of AUTODETECTED_MOUNT), imagine:

sudo mkdir /testmounts /testmounts/dir1 /testmounts/bind1 \
/testmounts/dir2 /testmounts/bind2 /testmounts/dir3 \
/testmounts/dir2/bind3
sudo mount --bind /testmounts/dir1 /testmounts/bind1
sudo mount --bind /testmounts/dir2 /testmounts/bind2
sudo mount --bind /testmounts/dir3 /testmounts/bind2/bind3

cat /proc/self/mountinfo | grep testmounts
234 37 253:1 /testmounts/dir1 /testmounts/bind1 rw,relatime shared:1 - 
ext4 /dev/mapper/root rw,data=ordered
285 37 253:1 /testmounts/dir2 /testmounts/bind2 rw,relatime shared:1 - 
ext4 /dev/mapper/root rw,data=ordered
448 285 253:1 /testmounts/dir3 /testmounts/bind2/bind3 rw,relatime 
shared:1 - ext4 /dev/mapper/root rw,data=ordered
451 37 253:1 /testmounts/dir3 /testmounts/dir2/bind3 rw,relatime 
shared:1 - ext4 /dev/mapper/root rw,data=ordered

All mounts are in shared group 1, but 234 and 285 have 
different(non-subpath) roots. After root for them is changed to 
AUTODETECTED_MOUNT on dump, validate_shared will print "have different 
set of mounts" for them.

Finally I managed to create some proof-of-concept test(see attached), 
without patch 1:

(00.005442)  54900: Error (mount.c:631): mnt: 
184:./tmpmy/root.mountcuvrkY/bind2 and 
183:./tmpmy/root.mountcuvrkY/bind1 have different set of mounts

with patch restores OK:

+ ../../criu restore -d -D dump -o restore.log -v4 --ext-mount-map=auto 
--enable-external-sharing --enable-external-masters
+ cat /proc/57433/mountinfo
+ sort -k 4
182 181 8:2 /dev /dev rw - ext4 /dev/sda2 rw,data=ordered
186 181 8:2 /proc /proc rw,nosuid,nodev,noexec,relatime - ext4 /dev/sda2 
rw,data=ordered
181 180 8:2 / / rw,relatime shared:65 - ext4 /dev/sda2 rw,data=ordered
185 181 8:2 /tmpmy/root.mountgsrIit/dir1 /tmpmy/root.mountgsrIit/bind1 
rw,relatime shared:68 - ext4 /dev/sda2 rw,data=ordered
184 181 8:2 /tmpmy/root.mountgsrIit/dir2 /tmpmy/root.mountgsrIit/bind2 
rw,relatime shared:67 - ext4 /dev/sda2 rw,data=ordered
183 181 8:2 /tmpmy/root.mountgsrIit/dir3 
/tmpmy/root.mountgsrIit/dir2/bind3 rw,relatime shared:66 - ext4 
/dev/sda2 rw,data=ordered
+ kill 57433

* Moreover, we need more general fix here in these check as statement 
"Check that all mounts in one shared group has the same set of children" 
is not always true e.g. in case of dumping such bindmounts:

sudo mount --bind /testmounts/dir1 /testmounts/bind1
sudo mount --bind /testmounts/dir1 /testmounts/bind1/bind2

>
> We can't use --ext-mount-map auto for Virtuozzo containers, because we
> have a "copy" of a container mount tree on the host side (/vz/root/101)
> and it exists only when a container is running.
>>
>> -- Pavel
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu

-- 
Best regards, Tikhomirov Pavel
Software Developer, Virtuozzo.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mount-test-add-different-root-non-subpath-shared-mou.patch
Type: text/x-patch
Size: 3428 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/criu/attachments/20160130/9a1f27b4/attachment.bin>


More information about the CRIU mailing list