[CRIU] [PATCH v4 07/17] autofs: dump stage introduced
Stanislav Kinsburskiy
skinsbursky at odin.com
Tue Jan 19 08:38:23 PST 2016
19.01.2016 14:58, Pavel Emelyanov пишет:
> On 01/07/2016 07:09 PM, Stanislav Kinsburskiy wrote:
>> AutoFS mount point is managed by user space daemon, which receives requests
>> from kernel via pipe, passed on mount operation.
>> Kernel hold write end, while user space process - read end.
>> Thus, for successfull AutoFS migration, this connection has to be restored.
>>
>> The major trick for dump stage is that mount points are collected (parsed)
>> from initial pid namespace, which leads to real pgrp value in AutoFS options
>> instead of virtual one. This have to be fixed.
>>
>> Note: we don't care about virtual pgrp in case of catatonic mounts
>>
>> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
>> ---
>> autofs.c | 24 ++++++++++++++++++++++++
>> include/autofs.h | 1 +
>> mount.c | 1 +
>> 3 files changed, 26 insertions(+)
>>
>> diff --git a/autofs.c b/autofs.c
>> index c2aafa6..1f7509f 100644
>> --- a/autofs.c
>> +++ b/autofs.c
>> @@ -300,3 +300,27 @@ int autofs_parse(struct mount_info *pm, bool for_dump)
>>
>> return 0;
>> }
>> +
>> +int autofs_dump(struct mount_info *pm)
>> +{
>> + AutofsEntry *entry = pm->autofs;
>> + struct mount_info *mi;
>> +
>> + if (entry->fd == AUTOFS_CATATONIC_FD)
>> + return 0;
>> +
>> + /* We need to get virtual pgrp to restore mount */
>> + entry->pgrp = pid_to_virt(entry->pgrp);
>> + if (!entry->pgrp) {
>> + pr_err("failed to find pstree item with pid %d\n",
>> + entry->pgrp);
>> + pr_err("Non-catatonic mount without master?\n");
>> + return -1;
>> + }
>> +
>> + /* Fix pgrp for all bind-mounts */
>> + list_for_each_entry(mi, &pm->mnt_bind, mnt_bind)
>> + mi->autofs->pgrp = entry->pgrp;
> Do they all have mi->autofs? This pointer is set in dump_one_mountpoint()
> and by the time you get here for the first pm, all the others still
> have NULL there.
>
Yes, all of them has it, because it's allocated on "parse stage" for all
the mounts, which is called before.
More information about the CRIU
mailing list