[Mesa-dev] [PATCH] tests/cache_test: allow crossing mount points

Nicolai Hähnle nhaehnle at gmail.com
Tue Mar 28 15:50:55 UTC 2017


On 28.03.2017 17:32, Juan A. Suarez Romero wrote:
> On Tue, 2017-03-28 at 16:53 +0200, Nicolai Hähnle wrote:
>> On 25.03.2017 01:40, Juan A. Suarez Romero wrote:
>>> When using an overlayfs system (like a Docker container), rmrf_local()
>>> fails because part of the files to be removed are in different mount
>>> points (layouts). And thus cache-test fails.
>>
>> Can you explain a bit more how this can happen? I thought the test does
>>
>> mkdir(CACHE_TEST_TMP, 0755);
>>
>> ...
>>
>> rmrf_local(CACHE_TEST_TMP);
>>
>> How does this end up crossing mounts?
>>
>
> Between both calls, we create the disk cache, which creates
> subdirectories and files inside.
>
>
> The crossing happens because I'm running it inside a docker container,
> which uses internally an overlayfs. This means that some of those
> subdirectories can be in one mountpoint and others in other mountpoint.
>  This seems to be how nftw() call handles this overlayfs.

I still don't quite get it. My understanding is that overlayfs allows 
you to merge two directory trees, e.g. for setups where you have a 
read-only base, and a writable "overlay" which gets used during some 
operation and then thrown away.

If ntfw fails to remove some files, then which ones are in the overlay 
and which ones in the "underlay"?

Or... oh wait. Here's what the kernel docs say:

    This approach is 'hybrid' because the objects that appear in the
    filesystem do not all appear to belong to that filesystem.  In many
    cases an object accessed in the union will be indistinguishable
    from accessing the corresponding object from the original filesystem.
    This is most obvious from the 'st_dev' field returned by stat(2).

So it seems the issue is that the directories themselves are considered 
to belong to the overlayfs itself, while the created files of the cache 
belong to the "overlay" (temporary) filesystem? That's annoying, but 
there's nothing we can do about it. The patch is:

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>


>
>
> 	J.A.
>
>
>>
>>
>>>
>>> Letting crossing mount points is not a big problem, specially because
>>> this is just for a test, not to be used in real code.
>>> ---
>>>  src/compiler/glsl/tests/cache_test.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/compiler/glsl/tests/cache_test.c b/src/compiler/glsl/tests/cache_test.c
>>> index 2302f44..ac60197 100644
>>> --- a/src/compiler/glsl/tests/cache_test.c
>>> +++ b/src/compiler/glsl/tests/cache_test.c
>>> @@ -124,7 +124,7 @@ rmrf_local(const char *path)
>>>     if (path == NULL || *path == '\0' || *path != '.')
>>>        return -1;
>>>
>>> -   return nftw(path, remove_entry, 64, FTW_DEPTH | FTW_PHYS | FTW_MOUNT);
>>> +   return nftw(path, remove_entry, 64, FTW_DEPTH | FTW_PHYS);
>>>  }
>>>
>>>  static void
>>>
>>
>>


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list