On Mon, 24 Jul 2006 09:21:04 PDT, Joshua Hudson said:[case of 3^4 directories ]
> On 7/24/06, Valdis.Kletnieks@xxxxxx <Valdis.Kletnieks@xxxxxx> wrote:
> Actually, I walk from the source inode down to try to find the
> target inode. If not found, this is not attempting to create a loop.
The problem is that the "target inode" may not be the one obviously causing the
loop - you may be trying to link a directory into a/b/c, while the loop
is caused by a link from a/b/c/d/e/f/g back up to someplace.
Consider:
Yes, you have to search *every* directory under x, y, and z.With a mesh graph like that one, you are right. Rather like my
And this is an artificially smallInteresting case.
directory tree. Think about a /usr/src/ that has 4 or 5 linux-kernel
trees in it, with some 1,650 directories per tree...
My use cases were generally about creating links at the twig level.
> Should be obvious that the average case is much less than the
> whole tree.
"The average case" is the one where the feature isn't used. When you
actually *use* it, you get "not average case" behavior - not a good sign.
>
> mv /a/b/c/d ../../w/z/b is implemented as this in the filesystem:
> ln /a/b/c/d ../../w/z/b && rm /a/b/c/d
>
> So what it's going to do is try to find z under /a/b/c/d.
Even if that's sufficient (which it isn't), it's going to be painful to lock
the filesystem for 20 or 30 seconds while you walk everything to make sure
there's no problem.
(which it isn't)Counterexample? I should swear that any cycle created by rename must