RE: any idea about auto export multiple btrfs snapshots?
From: Frank Filz <hidden>
Date: 2021-06-21 17:49:56
quoted
quoted
I think the problem is that the submount doesn't appear in
/proc/mounts.
quoted
quoted
"nfsd_fh()" in nfs-utils needs to be able to map from the uuid for a filesystem to the mount point. To do this it walks through /proc/mounts checking the uuid of each filesystem. If a filesystem
isn't listed
there, it obviously fails.quoted
quoted
I guess you could add code to nfs-utils to do whatever "btrfs subvol list" does to make up for the fact that btrfs doesn't register in
/proc/mounts.
quoted
quoted
NeilBrownI've been watching this with interest for the nfs-ganesha project. We
recently
were made aware that we weren't working with btrfs subvols, and I added
code
so that in addition to using getmntent (essentially /proc/mounts) to
populate
filesystems, we also scan for btrfs subvols and with that we are able to
export
subvols. My question is does a snapshot look any different than a subvol?
If they
show up in the subvol list then we shouldn't need to do anything more for
nfs-
ganesha, but if there's something else needed to discover them, then we
may
need additional code in nfs-ganesha. I have not yet had a chance to check
out
exporting a snapshot yet.quoted
My question is does a snapshot look any different than a subvol?No difference between btrfs subvol and snapshot in theory. but the btrfs subvol number in product env is usually fixed, and the btrfs snapshot number is usually dynamic. For fixed-number btrfs subvol/snapshot, it is OK to put them in the same hierarchy, and then export all in /etc/exports static, as a walk around. For dynamic-number btrfs snapshot number, we needs a dynamic way to export them in nfs.
OK thanks for the information. I think they will just work in nfs-ganesha as long as the snapshots or subvols are mounted within an nfs-ganesha export or are exported explicitly. nfs-ganesha has the equivalent of knfsd's nohide/crossmnt options and when nfs-ganesha detects crossing a filesystem boundary will lookup the filesystem via getmntend and listing btrfs subvols and then expose that filesystem (via the fsid attribute) to the clients where at least the Linux nfs client will detect a filesystem boundary and create a new mount entry for it. Frank