[CRIU] [PATCH v3 08/16] rst_info: artificial files list introduced

Stanislav Kinsburskiy skinsbursky at odin.com
Mon Dec 14 03:16:35 PST 2015



14.12.2015 12:10, Pavel Emelyanov пишет:
> On 12/10/2015 06:16 PM, Stanislav Kinsburskiy wrote:
>> This list is used to collect and handle some service files, which an be used
>> only during restore procedure for some service perations, and must be closed
>> before process is released.
> OK, but I see only opening code in here, where's the closing one?

I do close in post_open() callback.
If there is a better place, I would be glad to do it there.

>
>> AutoFS will use them to fix up mount points druing restore.
> Why can't we use existing fds list?

We can, if we put them at the end on the list.
But these files are special.
So, from my pow, it's better to have them in separated list. Especially 
the are going to be explicitly closed somewhere later.

>> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
>> ---
>>   files.c            |    8 ++++++++
>>   include/rst_info.h |    1 +
>>   2 files changed, 9 insertions(+)
>>
>> diff --git a/files.c b/files.c
>> index e6919cd..1a1c811 100644
>> --- a/files.c
>> +++ b/files.c
>> @@ -690,6 +690,7 @@ int prepare_fd_pid(struct pstree_item *item)
>>   	INIT_LIST_HEAD(&rst_info->eventpoll);
>>   	INIT_LIST_HEAD(&rst_info->tty_slaves);
>>   	INIT_LIST_HEAD(&rst_info->tty_ctty);
>> +	INIT_LIST_HEAD(&rst_info->artificial);
>>   
>>   	if (!fdinfo_per_id) {
>>   		img = open_image(CR_FD_FDINFO, O_RSTR, pid);
>> @@ -1105,6 +1106,13 @@ int prepare_fds(struct pstree_item *me)
>>   		ret = open_fdinfos(me->pid.virt, &rsti(me)->eventpoll, state);
>>   		if (ret)
>>   			break;
>> +
>> +		/* Artificial file descriptors are not transfered within images.
>> +		 * They are created on restore procedure for some internal
>> +		 * needs, like Autofs helper fds. */
>> +		ret = open_fdinfos(me->pid.virt, &rsti(me)->artificial, state);
>> +		if (ret)
>> +			break;
>>   	}
>>   
>>   	if (ret)
>> diff --git a/include/rst_info.h b/include/rst_info.h
>> index b72e5d0..74e01ee 100644
>> --- a/include/rst_info.h
>> +++ b/include/rst_info.h
>> @@ -31,6 +31,7 @@ struct rst_info {
>>   	struct list_head	eventpoll;
>>   	struct list_head	tty_slaves;
>>   	struct list_head	tty_ctty;
>> +	struct list_head	artificial;
>>   
>>   	void			*premmapped_addr;
>>   	unsigned long		premmapped_len;
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
>> .
>>



More information about the CRIU mailing list