[Info-vax] Re; Spiralog, RMS Journaling (was Re: FREESPADRIFT)

Johnny Billquist bqt at softjar.se
Mon Jun 27 09:29:41 EDT 2016


On 2016-06-24 12:03, lawrencedo99 at gmail.com wrote:
> On Thursday, June 23, 2016 at 10:27:12 PM UTC+12, Johnny Billquist wrote:
>> On 2016-06-22 09:27, Lawrence D’Oliveiro wrote:
>>> On Wednesday, June 22, 2016 at 3:30:03 AM UTC+12, Johnny Billquist wrote:
>>>>
>>>> Multiple hard links are not a problem for file system integrity.
>>>
>>> Yes they are.
>>
>> No, they are not. Like I said, you actually have hard links for
>> directories all over the place already, you just don't realize it.
>
> Further to your ingenious riposte regarding “.” and “..”, could you explain, given a directory which is a child of multiple parent directories, where you think “..” in that directory should point to?

Congratulations. Now you find the reason why users are not allowed to 
create their own hard links. It is not just a question of where .. 
points, but that is a part of it. It also ties up with how rmdir() 
works, how unlink() works, and what would be expected to happen if you 
remove a directory.

>>> Consider either (or both) of the following questions:
>>>
>>> * How do you prevent reference cycles?
>>
>> What is the problem with that? You already get those if you just follow
>> symlinks blindly as well.
>
> You don’t understand the difference between hard links and symlinks?

I definitely do.
Maybe you don't. How do you tell if you are looking at a symlink? (Hint, 
you have to check specifically for it, otherwise it is totally transparent.)

I've heard people suggesting cycles many times. It's a strawman. There 
are no problems with cycles, and there are no problems with hardlinks to 
directories from a file system integrity point of view.

The only problems are that .. can only point to one parent, which would 
potentially be confusing for users, but uglier is what to do with .. if 
you call rmdir(). rmdir() expects there to be an entry in the parent 
pointing to the directory to be removed. Should rmdir() then change .. 
to another parent if more than one exists? How would rmdir() find the 
other parent. No information is stored about this, so a full directory 
scan of the whole disk would be needed, which would be totally 
unacceptable in a system call. And it also means rmdir() will only 
conditionally remove . and .. . All in all, complex and hairy. It's just 
simpler to disallow user created hard links.
But hardlinks to directories exist all over the disk, even though most 
people do not realize it.

And tools that traverse directories will normally also do so across 
symlinks, unless they explicitly check for this, and avoid it. But you 
still have the system wide MAXPATHLENGTH which is a hard limit beyond 
nothing will go, no matter how you try. So good luck trying to get 
infinitely deep hardlinked directories. It simply will not work.

If you happen to have a SunOS 4 system around, just change to root, and 
create your own hardlinks to directories. Works just fine.

>>> * What happens if you don’t?
>>
>> Nothing interesting.
>
> Would you like to rethink that?

No. Why would I? I know very well what is going under the hood.

	Johnny




More information about the Info-vax mailing list