[CRIU] [PATCH 2/2] cgroup: umount cg_yard after opening it

Pavel Emelyanov xemul at parallels.com
Mon Aug 4 02:47:03 PDT 2014


On 07/16/2014 05:54 PM, Pavel Emelyanov wrote:
> On 07/16/2014 05:46 PM, Andrew Vagin wrote:
>> Signed-off-by: Andrew Vagin <avagin at openvz.org>
>> ---
>>  cgroup.c | 14 +++++++-------
>>  1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/cgroup.c b/cgroup.c
>> index 71ac271..5128911 100644
>> --- a/cgroup.c
>> +++ b/cgroup.c
>> @@ -38,7 +38,6 @@ static unsigned int n_sets;
>>  static CgSetEntry **rst_sets;
>>  static unsigned int n_controllers;
>>  static CgControllerEntry **controllers;
>> -static char *cg_yard;
>>  static struct cg_set *root_cgset; /* Set root item lives in */
>>  static struct cg_set *criu_cgset; /* Set criu process lives in */
>>  static u32 cg_set_ids = 1;
>> @@ -654,13 +653,7 @@ int prepare_task_cgroup(struct pstree_item *me)
>>  
>>  void fini_cgroup(void)
>>  {
>> -	if (!cg_yard)
>> -		return;
>> -
>>  	close_service_fd(CGROUP_YARD);
>> -	umount2(cg_yard, MNT_DETACH);
>> -	rmdir(cg_yard);
>> -	xfree(cg_yard);
>>  }
>>  
>>  static int prepare_cgroup_dirs(char *paux, size_t off, CgroupDirEntry **ents, size_t n_ents)
>> @@ -706,6 +699,7 @@ static int prepare_cgroup_sfd(CgroupEntry *ce)
>>  {
>>  	int off, i;
>>  	char paux[PATH_MAX];
>> +	char *cg_yard;
>>  
>>  	pr_info("Preparing cgroups yard\n");
>>  
>> @@ -792,6 +786,12 @@ static int prepare_cgroup_sfd(CgroupEntry *ce)
> 
> O_o should the umount2 happen here? Or at least open_detach_mount()?

Andrey?

>>  	return 0;
>>  
>>  err:
>> +	if (cg_yard) {
>> +		umount2(cg_yard, MNT_DETACH);
>> +		rmdir(cg_yard);
>> +		xfree(cg_yard);
>> +	}
>> +
>>  	fini_cgroup();
>>  	return -1;
>>  }
>>
> 



More information about the CRIU mailing list