|
|
Log in / Subscribe / Register

A case for variant symlinks

A case for variant symlinks

Posted Mar 30, 2016 3:14 UTC (Wed) by viro (subscriber, #7872)
In reply to: A case for variant symlinks by Cyberax
Parent article: A case for variant symlinks

... except that now you need to maintain the list of all parents through all operations. What's worse, you can't just stop at direct parents - you need traverse all chains of ancestors, however long they might be. With the unique chain to root you already have all of that in RAM - you either get them from pathname resolution, or you've started with fhandles and their decoding includes traversing the chain of ancestors until the damn thing is connected to the root. With multiple links you could very well have never seen the majority of those ancestors, which means that loop detection turns into massive IO. Now add the fact that you need to block all rename() (and link() to directories, and rmdir()) for the duration of that check, and it becomes _very_ unattractive. Locking is also less than pleasant. Once you add that to the costs of maintaining the crap attached to struct file, well...

It's not impossible that somebody would eventually come up with a decent way of doing that stuff. I've never been able to. Neither had *BSD folks. And Thompson, Pike et.al. flat-out decided that all that crap was just too much headache to bother with - even though they started their list of the bad ideas not to duplicate with cross-directory renames, overwriting renames, symlinks and fchdir. On very different VFS architectures, including the one designed pretty much from scratch, with freedom to drop the syscalls considered to be misfeatures. Which is something the rest of us couldn't afford - not without breaking arseloads of userland code.

Again, maybe there is a decent way of doing that just waiting for somebody to invent it. I would love to read it through and try to poke holes in it - got to be interesting. But until somebody does come up with something that survives peer review... Filesystem with multiple hardlinks to directories is a Bloody Bad Idea(tm). Sorry.


to post comments

A case for variant symlinks

Posted Mar 30, 2016 3:25 UTC (Wed) by Cyberax (✭ supporter ✭, #52523) [Link]

I have a feeling that it might be possible to devise a way for the "happy case" (no hardlinks in any parent) to be about as fast as the current case. But once hardlinks start appearing, it'll devolve rapidly (a nice DoS right there).

And I feel that even alternative VFS designs are not going to help unless they introduce a full-scale garbage collector. Which might not even be such a bad idea once we switch to non-volatile memory.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds