[CRIU] [PATCH v7 11/15] mount: copy private field to "bind mount" mount_info structure

Pavel Emelyanov xemul at virtuozzo.com
Wed Mar 16 05:21:07 PDT 2016


On 03/16/2016 03:12 PM, Stanislav Kinsburskiy wrote:
> 
> 
> 16.03.2016 11:24, Pavel Emelyanov пишет:
>> On 03/14/2016 05:59 PM, Stanislav Kinsburskiy wrote:
>>> Mount private field can be initialized on actual mount operation, and then
>>> used later with a bind-mount.
>>> Thus, if have to be copied.
>> I guess, I've asked this before, but this thing is still unclear.
>>
>> If we have an autofs mount and bind mount of this mount. How would this
>> thing get restored? First mount will be mount-ed as autofs and the
>> 2nd mountpoint will be mount --bind? Or will they both be mount-ed as
>> autofs mounts?
> 
> The former.
> In do_mount_one() actual mount is node only for one mountinfo 
> (do_new_mount call). All the bind mounts are mounted via 
> mount(...MS_BIND...) (do_bind_mount).

OK, so if all but the first mi are MS_BIND-ed, what's the point in copying
the private field into them?

>>> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
>>> ---
>>>   criu/mount.c |    7 +++++++
>>>   1 file changed, 7 insertions(+)
>>>
>>> diff --git a/criu/mount.c b/criu/mount.c
>>> index ea5aae7..51af24a 100644
>>> --- a/criu/mount.c
>>> +++ b/criu/mount.c
>>> @@ -2368,6 +2368,13 @@ static int do_bind_mount(struct mount_info *mi)
>>>   	private = !mi->master_id && !shared;
>>>   	cut_root = cut_root_for_bind(mi->root, mi->bind->root);
>>>   
>>> +	/* Mount private can be initialized on mount() callback, which is
>>> +	 * called only once.
>>> +	 * It have to be copied to all it's sibling structures to provide users
>>> +	 * of it with actual data.
>>> +	 */
>>> +	mi->private = mi->bind->private;
>>> +
>>>   	if (list_empty(&mi->bind->children))
>>>   		mnt_path = mi->bind->mountpoint;
>>>   	else {
>>>
>>> _______________________________________________
>>> CRIU mailing list
>>> CRIU at openvz.org
>>> https://lists.openvz.org/mailman/listinfo/criu
>>> .
>>>
> 
> .
> 



More information about the CRIU mailing list