[CRIU] [PATCH] autofs: use temporary value for virtual pgrp on dump

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Fri Apr 22 06:35:11 PDT 2016



22.04.2016 15:34, Pavel Emelyanov пишет:
> On 04/20/2016 07:31 PM, Stanislav Kinsburskiy wrote:
>> Otherwise information about real pid is lost in case of pid_to_virt returned
>> zero.
> But if pid_to_virt returns zero, the autofs_create_entry returns -1 and dump
> gets aborted, so why do we care?
>

This is required to output the real pid in error message instead of 
always outputting zero (result of pid_to_virt).
IOW, would be nice to know the process pid we failed to find in the tree.

>> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
>> ---
>>   criu/autofs.c |    7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/criu/autofs.c b/criu/autofs.c
>> index 8befc62..816a386 100644
>> --- a/criu/autofs.c
>> +++ b/criu/autofs.c
>> @@ -290,7 +290,7 @@ static int autofs_create_entry(struct mount_info *pm, AutofsEntry *entry)
>>   		entry->has_gid = true;
>>   
>>   	if (entry->fd != AUTOFS_CATATONIC_FD) {
>> -		int found, read_fd;
>> +		int found, read_fd, virt_pgrp;
>>   
>>   		read_fd = autofs_find_read_fd(entry->pgrp, pipe_ino);
>>   		if (read_fd < 0)
>> @@ -310,13 +310,14 @@ static int autofs_create_entry(struct mount_info *pm, AutofsEntry *entry)
>>   		}
>>   
>>   		/* We need to get virtual pgrp to restore mount */
>> -		entry->pgrp = pid_to_virt(entry->pgrp);
>> -		if (!entry->pgrp) {
>> +		virt_pgrp = pid_to_virt(entry->pgrp);
>> +		if (!virt_pgrp) {
>>   			pr_err("failed to find pstree item with pid %d\n",
>>   					entry->pgrp);
>>   			pr_err("Non-catatonic mount without master?\n");
>>   			return -1;
>>   		}
>> +		entry->pgrp = virt_pgrp;
>>   	}
>>   	return 0;
>>   }
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
>> .
>>



More information about the CRIU mailing list