Re: any idea about auto export multiple btrfs snapshots?

Wang Yugui
2021-06-21T14:55:46Z

Hi,

> > I think the problem is that the submount doesn't appear in /proc/mounts.
> > "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.
> >
> > 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.
> >
> > NeilBrown
>
> I'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.

> 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.

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2021/06/21