Re: [PATCH/RFC] NFSD: handle BTRFS subvolumes better.

J. Bruce Fields
2021-07-19T23:27:05Z

On Mon, Jul 19, 2021 at 11:40:28AM -0400, Josef Bacik wrote:
> Ok so setting aside btrfs for the moment, how does NFS deal with
> exporting a directory that has multiple other file systems under
> that tree? I assume the same sort of problem doesn't occur, but why
> is that? Is it because it's a different vfsmount/sb or is there
> some other magic making this work? Thanks,

There are two main ways an NFS client can look up a file: by name or by
filehandle. The former's the normal filesystem directory lookup that
we're used to. If the name refers to a mountpoint, the server can cross
into the mounted filesystem like anyone else.

It's the lookup by filehandle that's interesting. Typically the
filehandle includes a UUID and an inode number. The server looks up the
UUID with some help from mountd, and that gives a superblock that nfsd
can use for the inode lookup.

As Neil says, mountd does that basically by searching among mounted
filesystems for one with that uuid.

So if you wanted to be able to handle a uuid for a filesystem that's not
even mounted yet, you'd need some new mechanism to look up such uuids.

That's something we don't currently support but that we'd need to
support if BTRFS subvolumes were automounted. (And it might have other
uses as well.)

But I'm not entirely sure if that answers your question....

--b.