Re: [RFC 12/26] ext2 white-out support

From: Dave Kleikamp
Date: Wed Aug 01 2007 - 15:10:48 EST


On Wed, 2007-08-01 at 14:44 -0400, Josef Sipek wrote:
> Alright not the greatest of examples, there is something to be said about
> symmetry, so...let me try again :)
>
> /a/
> /b/bar (whiteout for bar)
> /c/foo/qwerty
>
> Now, let's mount a union of {a,b,c}, and we'll see:
>
> $ find /u
> /u
> /u/foo
> /u/foo/qwerty
> $ mv /u/foo /u/bar
>
> Now what? How do you rename? Do you rename in the same branch (assuming it
> is rw)?

Er, no. According to Documentation/filesystems/union-mounts.txt, "only
the topmost layer of the mount stack can be altered".

> If you do, you'll get:
>
> $ find /u
> /u
>
> Oops! There's a whiteout in /b that hides the directory in /c -- rename(2)
> shouldn't make directory subtrees disappear.
>
> There are two ways to solve this:
>
> 1) "cp -r" the entire subtree being renamed to highest-priority branch, and
> rename there (you might have to recreate a series of directories to have a
> place to "cp" to...so you got "cp -r" _AND_ "mkdir -p"-like code in the VFS!
> 1/2 a :) )

I think this is the only alternative, given the design.

> 2) Don't store whiteouts within branches. This makes it really easy to
> rename and remove the whiteout.
>
> Sure, you could try to rename in-place and remove the whiteout, but what if
> you have:
>
> /a/
> /b/bar (whiteout)
> /c/bar/blah
> /d/foo/qwerty
>
> $ mv /u/foo /u/bar
>
> You can't just remove the whiteout, because that'd uncover the whited-out
> directory bar in /c.
>
> Josef 'Jeff' Sipek.
>
--
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/