Re: [OT] Hardlinks and directories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Marko Vojinovic" <vvmarko@xxxxxxxxx>
Sent: Saturday, 2010/February/13 05:44


> On Saturday 13 February 2010 06:30:55 jdow wrote:

>> It's even worse than that, Marko.
>>
>> You have a directory tree /a/b/c/d. You create a hard link to directory
>> /a/b inside of d. You get /a/b/c/d/b/c/d/b/c/d....
>>
>> NOW you unlink /a/b. Now when you do an ls on /a you get . and .. only.
>> Now, I challenge you to delete the /b/c/d loop and everything it contains
>> without reformatting the disk or using low level disk edit functions.
>
> I'm not sure I understand your point. The system will not allow you to
> unlink
> /a/b before it is empty. And it never is, since it contains a loop to
> itself.
> OTOH, if you manage to persuade the kernel to remove it regardless, then
> yes,
> the b/c/d loop gets cut off from the rest of the filesystem, and there is
> no way
> to claim back that disk space.
>
> But unlinking nonempty directories leaks disk space even if there are no
> loops
> inside, so you always need to have the "unlink only empty dirs" rule
> implemented in the kernel. This is analogous to losing a pointer before
> free()-ing it in, say, C --- memory leaks. :-)
>
> Best, :-)
> Marko

What you are saying, Marko, is just as bad as the looping disconnected
directory structure. Once a hard link to a directory is created it can
never be destroyed because there is always something in the directory.
You have created an entity that cannot be deleted. Same problem, different
manifestation. That is another perfectly good reason to prohibit hard
linking directories.

If the created hard link can be deleted then so can the original "link".
There's no reasonable way to distinguish my deleting the link in d to b
from deleting the link in a to b. They appear identical to the OS. So you
get chaos either way.

{^_^}

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux