[v4,02/17] filemap: collect mapped file fs type

Submitted by Stanislav Kinsburskiy on May 20, 2016, 11:36 a.m.

Details

Message ID 20160520113655.360872.49803.stgit@skinsbursky-vz7-gold.qa.sw.ru
State Rejected
Series "NFS migration support"
Headers show

Commit Message

Stanislav Kinsburskiy May 20, 2016, 11:36 a.m.
It will be used later to define wheither this file is unreachable on restore
(located on NFS, for example)

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 criu/cr-dump.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 8ef46a4..6cbef99 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -371,12 +371,20 @@  static int dump_filemap(pid_t pid, struct vma_area *vma_area,
 	struct fd_parms p = FD_PARMS_INIT;
 	VmaEntry *vma = vma_area->e;
 	int ret = 0;
+	struct statfs fst;
 	u32 id;
 
 	BUG_ON(!vma_area->vmst);
 	p.stat = *vma_area->vmst;
 	p.mnt_id = vma_area->mnt_id;
 
+	if (fstatfs(vma_area->vm_file_fd, &fst)) {
+		pr_perror("Unable to statfs fd %d", vma_area->vm_file_fd);
+		return -1;
+	}
+
+	p.fs_type = fst.f_type;
+
 	/*
 	 * AUFS support to compensate for the kernel bug
 	 * exposing branch pathnames in map_files.

Comments

Pavel Emelianov June 2, 2016, 11:08 a.m.
On 05/20/2016 02:36 PM, Stanislav Kinsburskiy wrote:
> It will be used later to define wheither this file is unreachable on restore
> (located on NFS, for example)
> 
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
> ---
>  criu/cr-dump.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/criu/cr-dump.c b/criu/cr-dump.c
> index 8ef46a4..6cbef99 100644
> --- a/criu/cr-dump.c
> +++ b/criu/cr-dump.c
> @@ -371,12 +371,20 @@ static int dump_filemap(pid_t pid, struct vma_area *vma_area,

Why only for mapped files?

>  	struct fd_parms p = FD_PARMS_INIT;
>  	VmaEntry *vma = vma_area->e;
>  	int ret = 0;
> +	struct statfs fst;
>  	u32 id;
>  
>  	BUG_ON(!vma_area->vmst);
>  	p.stat = *vma_area->vmst;
>  	p.mnt_id = vma_area->mnt_id;
>  
> +	if (fstatfs(vma_area->vm_file_fd, &fst)) {
> +		pr_perror("Unable to statfs fd %d", vma_area->vm_file_fd);
> +		return -1;
> +	}
> +
> +	p.fs_type = fst.f_type;
> +
>  	/*
>  	 * AUFS support to compensate for the kernel bug
>  	 * exposing branch pathnames in map_files.
> 
> _______________________________________________
> CRIU mailing list
> CRIU@openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> .
>
Stanislav Kinsburskiy June 2, 2016, 11:59 a.m.
02.06.2016 13:08, Pavel Emelyanov пишет:
> On 05/20/2016 02:36 PM, Stanislav Kinsburskiy wrote:
>> It will be used later to define wheither this file is unreachable on restore
>> (located on NFS, for example)
>>
>> Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
>> ---
>>   criu/cr-dump.c |    8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/criu/cr-dump.c b/criu/cr-dump.c
>> index 8ef46a4..6cbef99 100644
>> --- a/criu/cr-dump.c
>> +++ b/criu/cr-dump.c
>> @@ -371,12 +371,20 @@ static int dump_filemap(pid_t pid, struct vma_area *vma_area,
> Why only for mapped files?

For the rest it's collected in fill_fd_params

>>   	struct fd_parms p = FD_PARMS_INIT;
>>   	VmaEntry *vma = vma_area->e;
>>   	int ret = 0;
>> +	struct statfs fst;
>>   	u32 id;
>>   
>>   	BUG_ON(!vma_area->vmst);
>>   	p.stat = *vma_area->vmst;
>>   	p.mnt_id = vma_area->mnt_id;
>>   
>> +	if (fstatfs(vma_area->vm_file_fd, &fst)) {
>> +		pr_perror("Unable to statfs fd %d", vma_area->vm_file_fd);
>> +		return -1;
>> +	}
>> +
>> +	p.fs_type = fst.f_type;
>> +
>>   	/*
>>   	 * AUFS support to compensate for the kernel bug
>>   	 * exposing branch pathnames in map_files.
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU@openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
>> .
>>
Pavel Emelianov June 6, 2016, 11:59 a.m.
On 06/02/2016 02:59 PM, Stanislav Kinsburskiy wrote:
> 
> 
> 02.06.2016 13:08, Pavel Emelyanov пишет:
>> On 05/20/2016 02:36 PM, Stanislav Kinsburskiy wrote:
>>> It will be used later to define wheither this file is unreachable on restore
>>> (located on NFS, for example)
>>>
>>> Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
>>> ---
>>>   criu/cr-dump.c |    8 ++++++++
>>>   1 file changed, 8 insertions(+)
>>>
>>> diff --git a/criu/cr-dump.c b/criu/cr-dump.c
>>> index 8ef46a4..6cbef99 100644
>>> --- a/criu/cr-dump.c
>>> +++ b/criu/cr-dump.c
>>> @@ -371,12 +371,20 @@ static int dump_filemap(pid_t pid, struct vma_area *vma_area,
>> Why only for mapped files?
> 
> For the rest it's collected in fill_fd_params

OK. Please move call to fstatfs into proc_parse -- closer to the place where stat
and get_fd_mntid for vma_area is called.

>>>   	struct fd_parms p = FD_PARMS_INIT;
>>>   	VmaEntry *vma = vma_area->e;
>>>   	int ret = 0;
>>> +	struct statfs fst;
>>>   	u32 id;
>>>   
>>>   	BUG_ON(!vma_area->vmst);
>>>   	p.stat = *vma_area->vmst;
>>>   	p.mnt_id = vma_area->mnt_id;
>>>   
>>> +	if (fstatfs(vma_area->vm_file_fd, &fst)) {
>>> +		pr_perror("Unable to statfs fd %d", vma_area->vm_file_fd);
>>> +		return -1;
>>> +	}
>>> +
>>> +	p.fs_type = fst.f_type;
>>> +
>>>   	/*
>>>   	 * AUFS support to compensate for the kernel bug
>>>   	 * exposing branch pathnames in map_files.
>>>
>>> _______________________________________________
>>> CRIU mailing list
>>> CRIU@openvz.org
>>> https://lists.openvz.org/mailman/listinfo/criu
>>> .
>>>
> 
> .
>