LWN: Comments on "XFS parent pointers" https://lwn.net/Articles/753480/ This is a special feed containing comments posted to the individual LWN article titled "XFS parent pointers". en-us Fri, 31 Oct 2025 05:42:40 +0000 Fri, 31 Oct 2025 05:42:40 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net XFS parent pointers https://lwn.net/Articles/756984/ https://lwn.net/Articles/756984/ JanC_ <div class="FormattedComment"> You can make directory hardlinks on NTFS too, by doing direct NT kernel API calls, but it's not a good idea to actually do that (I don't think anything in Windows userspace can actually handle that properly).<br> </div> Fri, 08 Jun 2018 23:58:29 +0000 XFS parent pointers https://lwn.net/Articles/755009/ https://lwn.net/Articles/755009/ njs <div class="FormattedComment"> FYI in case you're looking for other projects that make similar demands, conda is also a heavy user of hardlinks, for a somewhat similar use case.<br> </div> Mon, 21 May 2018 01:54:53 +0000 XFS parent pointers https://lwn.net/Articles/754542/ https://lwn.net/Articles/754542/ foom <div class="FormattedComment"> HFS+'s directory hardlink support doesn't let you make loops. It has a bunch of restrictions which make that impossible, although they also prohibit making some directory hardlinks which _don't_ create a loop. (That's okay, it wasn't intended to be a generally-used feature, only really for Time Machine backups' use.) <br> <p> See the comment starting "Source parent and" here, for what it actually checks: <a href="https://opensource.apple.com/source/hfs/hfs-407.30.1/core/hfs_link.c.auto.html">https://opensource.apple.com/source/hfs/hfs-407.30.1/core...</a><br> <p> </div> Wed, 16 May 2018 01:15:28 +0000 XFS parent pointers https://lwn.net/Articles/754457/ https://lwn.net/Articles/754457/ viro <div class="FormattedComment"> Why would they? You've looked up foo/bar/baz and found that oh, BTW, it also has links from a/b/c/d/e/never/been/there/whatever/the/hell/it/might/be and a dozen other directories. Each of those having a bunch of ancestors of its own, etc.<br> <p> Ancestors are guaranteed to be in dcache when there's only one path from root to it... Even that takes some work to maintain in the face of open_by_handle() - fs/exportfs/expfs.c is where it's dealt with. With multiple paths, that becomes a non-starter; do you really want stat(2) capable of sucking in thousands of directories from disk, all of that - with rename/link/unlink blocked on the entire filesystem? Or doing that already joyful work on a graph that keeps changing under you...<br> <p> Sure, you could pull *everything* into dcache on mount and keep it there all along. Then everything will be in dcache at all times, but that means memory footprint from hell and hash chains' lengths from the same place. And you still have a potentially enormous graph (remember, you've got everything in dcache) and need to answer questions like "will it remain a connected directed graph if we remove this edge?" and "will adding such an edge create a loop in it?", atomically wrt graph modifications...<br> </div> Mon, 14 May 2018 23:54:31 +0000 XFS parent pointers https://lwn.net/Articles/754454/ https://lwn.net/Articles/754454/ Cyberax <div class="FormattedComment"> Shouldn't all of the parents' dentries already be in RAM, though? Locking will be more complicated, but a parallel "rename stack locking" structure specifically for renames should suffice.<br> </div> Mon, 14 May 2018 23:16:57 +0000 XFS parent pointers https://lwn.net/Articles/754446/ https://lwn.net/Articles/754446/ viro <div class="FormattedComment"> Still no go - you'd need to scan all "ancestor" chains (with all the IO it would imply) and do that while the graph structure is guaranteed not to change under you. Good luck with the locking, or with DoS potential in that...<br> </div> Mon, 14 May 2018 21:10:27 +0000 XFS parent pointers https://lwn.net/Articles/754369/ https://lwn.net/Articles/754369/ cortana <div class="FormattedComment"> I believe Mac OS X supports directory hardlinks on HFS+... does anyone know how software that isn't prepared for this behaves if you set up an infinite loop in this way?<br> </div> Mon, 14 May 2018 12:55:38 +0000 XFS parent pointers https://lwn.net/Articles/754061/ https://lwn.net/Articles/754061/ Paf <div class="FormattedComment"> Thanks nevyn, and cyberax as well.<br> </div> Thu, 10 May 2018 00:32:35 +0000 XFS parent pointers https://lwn.net/Articles/754027/ https://lwn.net/Articles/754027/ nix <div class="FormattedComment"> Oh right. I'm only worrying because I'm hacking up a replacement for GNU Stow that uses hardlinks where possible, unstowing by comparing the st_dev/st_ino of appropriately-located files in the target and stow tree, to reduce the visible behaviour change GNU stow and graft can cause with their huge symlink farms (since lots of programs care whether things are symlinks or not but almost none check their own read-only files to see what their link count is). If this works, systems that use it would end up with hundreds of thousands of files with link count 2.<br> <p> However, I suspect that for your average file, two hardlinks is fine for inline storage of the parent pointers as well (inodes aren't *that* small). If a file has ten twenty or fifty hardlinks, I'd frankly *expect* parent pointers to be moved out of line. :)<br> <p> </div> Wed, 09 May 2018 15:51:23 +0000 XFS parent pointers https://lwn.net/Articles/753961/ https://lwn.net/Articles/753961/ k8to <div class="FormattedComment"> Thank you for the clarification!<br> </div> Wed, 09 May 2018 03:54:15 +0000 XFS parent pointers https://lwn.net/Articles/753942/ https://lwn.net/Articles/753942/ dgc <div class="FormattedComment"> <font class="QuotedText">&gt; Unless they can modify the filesystem on disk, that is.</font><br> <p> And that, folks, is why we don't let anyone other than root access block devices directly or mount filesystem images.<br> <p> Because if anyone can modify the filesystem on disk then we're completely and utterly screwed, parent pointers or not. And that goes for any filesystem that doesn't have a cryptographically secure on-disk format (e.g. XFS, ext4, btrfs, f2fs, etc). i.e. no filesystem except maybe bcachefs is robust against such tampering.<br> <p> -Dave.<br> <p> <p> </div> Tue, 08 May 2018 22:32:49 +0000 XFS parent pointers https://lwn.net/Articles/753941/ https://lwn.net/Articles/753941/ nevyn <div class="FormattedComment"> Answering backwards:<br> <p> <font class="QuotedText">&gt; And come to think of it, why aren’t those allowed today?</font><br> <p> Because it's impossible to stop loops. Eg. /tmp/p/c and then you hardlink p into c. gg.<br> Lots of bad things happen if you do that.<br> <p> <font class="QuotedText">&gt; Wait, how? </font><br> <p> Because, in theory, if you have a single "parent" for each directory entry you don't have loops. I'm less sure this solves all the problems though. At best it seems like another way to do mount --bind, at worst you'd have all the same problems.<br> </div> Tue, 08 May 2018 22:29:50 +0000 XFS parent pointers https://lwn.net/Articles/753939/ https://lwn.net/Articles/753939/ dgc <div class="FormattedComment"> <font class="QuotedText">&gt; This doesn't mean an extra block allocated per file, right?</font><br> <p> In most cases there will be no extra allocation - the xattr will easily fit inside the inode for typical single parent, short name files on a default 512 byte inode filesystem. It's not until you have multiple hard links or filenames &gt; 100 bytes that the xattrs will tend to go out of line. Or you have lots of other xattrs, in which case they're at risk of being moved out of line, anyway. If you're really worried about xattrs being kept in line, then you can always format the filesystem with 1kB or 2kB inodes....<br> <p> -Dave.<br> </div> Tue, 08 May 2018 22:27:23 +0000 XFS parent pointers https://lwn.net/Articles/753933/ https://lwn.net/Articles/753933/ Cyberax <div class="FormattedComment"> I refer you to a previous discussion: <a href="https://lwn.net/Articles/681685/">https://lwn.net/Articles/681685/</a><br> </div> Tue, 08 May 2018 22:05:01 +0000 XFS parent pointers https://lwn.net/Articles/753931/ https://lwn.net/Articles/753931/ Paf <div class="FormattedComment"> Wait, how? And come to think of it, why aren’t those allowed today?<br> </div> Tue, 08 May 2018 22:00:55 +0000 XFS parent pointers https://lwn.net/Articles/753911/ https://lwn.net/Articles/753911/ nix <div class="FormattedComment"> This doesn't mean an extra block allocated per file, right? For files without (many) xattrs, presumably this is small enough to get packed in with existing metadata? (The space usage for an extra block for filesystems containing many very small files might be quite painful, not to mention the disk seeks -- though XFS is damn good at keeping those down these days. :) )<br> </div> Tue, 08 May 2018 19:07:37 +0000 XFS parent pointers https://lwn.net/Articles/753878/ https://lwn.net/Articles/753878/ k8to <div class="FormattedComment"> At which point, presumably they could put the file anywhere anyway.<br> </div> Tue, 08 May 2018 14:52:11 +0000 XFS parent pointers https://lwn.net/Articles/753806/ https://lwn.net/Articles/753806/ dgm <div class="FormattedComment"> Unless they can modify the filesystem on disk, that is.<br> </div> Tue, 08 May 2018 06:52:36 +0000 XFS parent pointers https://lwn.net/Articles/753778/ https://lwn.net/Articles/753778/ dgc <div class="FormattedComment"> <font class="QuotedText">&gt; Could you label your file with a particular xattr to cause online scrub to move your</font><br> <font class="QuotedText">&gt; file somewhere you normally wouldn't be able to place it?</font><br> <p> No. These parent pointer xattrs will be in a private xattr namespace that only the kernel code can access. Essentially they are part of the metadata of the filesystem, and users cannot access filesystem metadata directly.<br> <p> -Dave.<br> </div> Tue, 08 May 2018 01:39:05 +0000 XFS parent pointers https://lwn.net/Articles/753726/ https://lwn.net/Articles/753726/ bfields No XFS expert, but my understanding is that this parent pointer is represented as an xattr on disk, but is not something you could modify through the normal xattr interface. Mon, 07 May 2018 20:09:21 +0000 XFS parent pointers https://lwn.net/Articles/753707/ https://lwn.net/Articles/753707/ Cyberax <div class="FormattedComment"> Look on the bright side of this change - it'll allow directory hardlinks!<br> <p> /me runs and hides.<br> </div> Mon, 07 May 2018 18:50:01 +0000 XFS parent pointers https://lwn.net/Articles/753704/ https://lwn.net/Articles/753704/ k8to <div class="FormattedComment"> Could you label your file with a particular xattr to cause online scrub to move your file somewhere you normally wouldn't be able to place it?<br> </div> Mon, 07 May 2018 18:08:16 +0000