On Thu, Aug 26, 2021 at 04:03:04PM +1000, NeilBrown wrote: > > [[ Hi Bruce and Chuck, > I've rebased this patch on the earlier patch I sent which allows > me to use the name "fh_flags". I've also added a missing #include. > I've added the 'Acked-by' which Joesf provided earlier for the > btrfs-part. I don't have an 'ack' for the stat.h part, but no-one > has complained wither. > I think it is as ready as it can be, and am keen to know what you > think. > I'm not *very* keen on testing s_magic in nfsd code (though we > already have a couple of such tests in nfs3proc.c), but it does have > the advantage of ensuring that no other filesystem can use this > functionality without landing a patch in fs/nfsd/. > > Thanks for any review that you can provide, > NeilBrown > ]] > > BTRFS does not provide unique inode numbers across a filesystem. > It only provides unique inode numbers within a subvolume and > uses synthetic device numbers for different subvolumes to ensure > uniqueness for device+inode. > > nfsd cannot use these varying synthetic device numbers. If nfsd were to > synthesise different stable filesystem ids to give to the client, that > would cause subvolumes to appear in the mount table on the client, even > though they don't appear in the mount table on the server. Also, NFSv3 > doesn't support changing the filesystem id without a new explicit mount > on the client (this is partially supported in practice, but violates the > protocol specification and has problems in some edge cases). > > So currently, the roots of all subvolumes report the same inode number > in the same filesystem to NFS clients and tools like 'find' notice that > a directory has the same identity as an ancestor, and so refuse to > enter that directory. > > This patch allows btrfs (or any filesystem) to provide a 64bit number > that can be xored with the inode number to make the number more unique. > Rather than the client being certain to see duplicates, with this patch > it is possible but extremely rare. Yikes. Please don't do something like this that will eventually cause collisions.