Re: any idea about auto export multiple btrfs snapshots?
From: Wang Yugui <hidden>
Date: 2021-06-22 22:48:43
Hi,
On 6/21/21 3:41 PM, Wang Yugui wrote:quoted
Hi,quoted
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.Not only exported explicitly, but also kept in the same hierarchy. If we export /mnt/test #the btrfs /mnt/test/sub1 # the btrfs subvol 1 /mnt/test/sub2 # the btrfs subvol 2 we need to make sure we will not access '/mnt/test/sub1' through '/mnt/test' from nfs client. current safe export: #/mnt/test #the btrfs, not exported /mnt/test/sub1 # the btrfs subvol 1 /mnt/test/sub2 # the btrfs subvol 2What's the problem with exporting /mnt/test AND then exporting sub1 and sub2 as crossmnt exports? As far as I can tell, that seems to work just fine with nfs-ganesha.
I'm not sure what will happen on nfs-ganesha. crossmnt(kernel nfsd) failed to work when exporting /mnt/test,/mnt/test/sub1, /mnt/test/sub2. # /bin/find /nfs/test/ /nfs/test/ find: File system loop detected; ‘/nfs/test/sub1’ is part of the same file system loop as ‘/nfs/test/’. /nfs/test/.snapshot find: File system loop detected; ‘/nfs/test/.snapshot/sub1-s1’ is part of the same file system loop as ‘/nfs/test/’. find: File system loop detected; ‘/nfs/test/.snapshot/sub2-s1’ is part of the same file system loop as ‘/nfs/test/’. /nfs/test/dir1 /nfs/test/dir1/a.txt find: File system loop detected; ‘/nfs/test/sub2’ is part of the same file system loop as ‘/nfs/test/’ /bin/find report 'File system loop detected', it means that vfs cache( based on st_dev + st_ino?) on nfs client side will have some problem? In fact, I was exporting /mnt/test for years too. but btrfs subvols means multiple filesystems(different st_dev), in theory, we needs to use it based on nfs crossmnt. Best Regards Wang Yugui (wangyugui@e16-tech.com) 2021/06/23