Re: [RFC][PATCH 0/15] VFS based Union Mount

Bharata B Rao
2007-04-17T16:28:56Z

On Tue, Apr 17, 2007 at 10:35:50AM -0400, Shaya Potter wrote:
> Bharata B Rao wrote:
> >Hi,
> >
> >Here is an attempt towards vfs based union mount implementation.
> >Union mount provides the filesytem namespace unification feature.
> >Unlike the traditional mounts which hide the contents of the mount point,
> >the union mount presents the merged view of the mount point and the
> >mounted filesytem.
>
> does this approach allow one to add directories to the union and have it
> behave normally. namely when imagine one has the situation
>
> dir-b
> dir-a/ (contains file foo)
>
>
> if one unions this and deletes foo, that will create a whiteout entry in
> dir-a

(I guess you mean to say that this creates a whiteout in dir-b)

>
> now, what happens if one does
>
> dir-c
> dir-b (now contains whiteout, from previous union).
> dir-a (contains file foo)
>
> will one see foo or not. i.e. are whiteouts only looked for in the
> topmost dir, or in every dir?

No. foo is not visible. While looking for a file in a union mounted
directory, the lookup starts from the topmost directory and proceeds
downwards if the file isn't present the top layers. If a whiteout is
found in any of the top layers, the lookup is abondoned and -ENOENT
is removed. Thus until a whiteout exists in any upper layer for
a corresponding file in the lower layer, the lower layer file remains
hidden until the whiteout is removed.

However in the case of dir-c containing foo, the foo(from dir-c) will become
visible after union mounting dir-c on top of dir-b and dir-a.

Regards,
Bharata.