[Info-vax] Re; Spiralog, RMS Journaling (was Re: FREESPADRIFT)
Johnny Billquist
bqt at softjar.se
Wed Jun 29 05:54:43 EDT 2016
On 2016-06-29 11:41, lawrencedo99 at gmail.com wrote:
> On Wednesday, June 29, 2016 at 8:56:41 PM UTC+12, Johnny Billquist wrote:
>> On 2016-06-28 00:51, Lawrence D’Oliveiro wrote:
>>> On Tuesday, June 28, 2016 at 1:29:42 AM UTC+12, Johnny Billquist wrote:
>>>> On 2016-06-24 12:03, Lawrence D’Oliveiro wrote:
>>>>
>>>>> 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.
>>>
>>> Strange. Didn’t you say above that “multiple hard links are not a problem
>>> for file system integrity”? Aren’t you now admitting that they are?
>>> Otherwise why forbid them, right?
>>
>> This is not an integrity issue. And it has nothing to do with cycles.
>
> So why forbid users from creating them?
Because the very expensive and difficult situation with rmdir(). You
would need to find out where .. should/could point instead after rmdir()
(didn't I already say this a couple of posts ago???), and the fact that
people might not agree with what .. should point to.
>>> How do you delete a directory?
>>
>> With the rmdir() system call nowadays.
>
> So you give a path to rmdir(2), it removes the hard link to the directory from the parent in that path, and decrements its reference count. If the count goes to zero, the directory gets deleted.
Right.
> But what if that directory is also part of a reference cycle? Its reference
> count stays at 1, and it is not deleted.
A cycle or not don't matter. The situation is the same either way, if
you have another reference then yes, the count will just go down to one.
But that is not the tricky part.
As rmdir() is expected to unlink . and .., it should only actually do
this if the reference count goes down to 0. If you have additional
hardlinks, you should instead change where .. points to, to a valid
parent. If you just blindly delete . and .., you will then have a
directory without . and .., and that would be an inconsistency which
rmdir() would not appreciate, as it then would want to delete files that
do not exist.
So, . and .. should only be deleted at the last reference removal. But
finding out where .. should point to is a (the) problem.
> What if all the directories in the cycle are only referenced within that cycle?
>
> How do you delete those directories?
You are so hung up on cycles, for no good reason.
The "worst" that happens is that you will have lost files. Which would
be the effect of having rmdir() cause a directory to become a tree of
its own, without a connection to the rest of the directory tree.
Lost files are nothing new. There is a directly called lost+found, where
fsck places such files when scanning.
Johnny
More information about the Info-vax
mailing list