[CRIU] [PATCH] mount: don't overmount a mount if it should be bind-mounted somewhere
Pavel Emelyanov
xemul at virtuozzo.com
Fri Apr 29 08:34:19 PDT 2016
On 04/29/2016 06:21 PM, Andrew Vagin wrote:
> On Fri, Apr 29, 2016 at 02:55:57PM +0300, Pavel Emelyanov wrote:
>> On 04/28/2016 11:08 PM, Andrey Vagin wrote:
>>> From: Andrew Vagin <avagin at virtuozzo.com>
>>>
>>> It's impossiable to make a bind-mount if a source is overmounted.
>>>
>>> Reported-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
>>> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
>>> ---
>>> criu/mount.c | 8 ++++++++
>>> 1 file changed, 8 insertions(+)
>>>
>>> diff --git a/criu/mount.c b/criu/mount.c
>>> index 0b1c2ba..9dcd7d2 100644
>>> --- a/criu/mount.c
>>> +++ b/criu/mount.c
>>> @@ -2554,6 +2554,14 @@ static bool can_mount_now(struct mount_info *mi)
>>> if (!mi->parent)
>>> return true;
>>>
>>> + if (strcmp(mi->parent->mountpoint, mi->mountpoint) == 0) {
>>> + struct mount_info *b;
>>> +
>>> + list_for_each_entry(b, &mi->parent->mnt_bind, mnt_bind)
>>> + if (!b->mounted)
>>> + return false;
>>
>> Source is overmounted and we say "can't mount now", that's OK. But where's
>> the guarantee that the source will stop being such, so we'll be able to truen
>> true from here?
>
> It's a good question, but it should not block this patch. Without this
> patch we don't returen false from here and then create a wrong bind
> mount. With this patch we don't do this mistake, but sometimes can
> return a error that we are not able to restore a mount tree.
Failing restore after successful dump is not nice :\
> I'm thinking what we should add into validate_mounts() to be sure that
> we will be able to restore a mount tree.
Yes, please. Let's don't dump this thing rather than don't restore.
>>
>>> + }
>>> +
>>> if (mi->external)
>>> goto shared;
>>>
>>>
>>
> .
>
More information about the CRIU
mailing list