Re: [PATCH 3/3] ovl: redirect on rename-dir

From: Amir Goldstein
Date: Mon Nov 14 2016 - 11:26:11 EST


On Sun, Nov 13, 2016 at 12:00 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> On Fri, Nov 11, 2016 at 12:39 AM, Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
>> New version is at:
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git #redirect
>>
>> News:
>> - it actually should work in all cases
>> - when rename is not cross directory, just store the new name instead
>> of a full path, as suggested by Amir
>> - when redirect path is too long fall back to EXDEV (the max length
>> should probably be a module param)
>>
>
> Looks goods, except for the case of change from relative to absolute
> redirect of the victim dentry. IIUC, ovl_set_redirect() will return immediately
> because ovl_dentry_is_redirect() and will not get to setting the absolute
> redirect.
>

I added some more tests to catch this problem at:
https://github.com/amir73il/unionmount-testsuite.git #ovl_rename_dir

In the new version, upper recycling is optional and you can set a bound
to the number of layers. This is needed to catch the bug because the
scenario is:
- Rename populated dir in same dir
- Move the populated dir to another dir
- Re-mount
- Populated dir is empty

The following test run demonstrates it:

$ sudo ./run --ov=0 rename-move-dir
...
TEST rename-move-dir.py:37: Rename populated dir and move into another
./run --rename /mnt/a/dir102 /mnt/a/dir102x
./run --rename /mnt/a/dir102 /mnt/a/dir102x -E ENOENT
./run --rename /mnt/a/dir102x /mnt/a/empty102/dir102
./run --rename /mnt/a/dir102x /mnt/a/empty102/dir102 -E ENOENT
./run --open-file /mnt/a/dir102 -r -d -E ENOENT
./run --open-file /mnt/a/dir102x -r -d -E ENOENT
./run --open-file /mnt/a/empty102/dir102 -r -d
/mnt/a/empty102/dir102/a: File is missing


Amir.