Re: any idea about auto export multiple btrfs snapshots?
From: Wang Yugui <hidden>
Date: 2021-06-17 02:15:53
Hi,
nfs need to treat btrfs subvols as different filesystems, so nfs need
crossmnt feature to support multiple btrfs subvol auto export?
It is yet not clear what prevent nfs/crossmnt from work well.
1, stat() and the result 'struct stat'
btrfs subvol support it well.
multiple subvols will have different st_dev of 'struct stat'.
/bin/find works well too.
2, statfs() and the result 'struct statfs'
btrfs subvol support it well.
multiple subvols will have different f_fsid of 'struct statfs'.
3, stx_mnt_id of statx
btrfs subvol does NOT support it well.
but stx_mnt_id seems yet not used.
4, d_mountpoint() in kernel
d_mountpoint() seems not support btrfs subvol.
but we can add some dirty fix such as.
+//#define BTRFS_FIRST_FREE_OBJECTID 256ULL
+//#define BTRFS_SUPER_MAGIC 0x9123683E
+static inline bool is_btrfs_subvol_d(const struct dentry *dentry)
+{
+ return dentry->d_inode && dentry->d_inode->i_ino == 256ULL &&
+ dentry->d_sb && dentry->d_sb->s_magic == 0x9123683E;
+}
so the problem list is yet not clear.
Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2021/06/17
On Sun, 13 Jun 2021, Wang Yugui wrote:quoted
Hi, Any idea about auto export multiple btrfs snapshots? One related patch is yet not merged to nfs-utils 2.5.3. From: "NeilBrown" <redacted> Subject: [PATCH/RFC v2 nfs-utils] Fix NFSv4 export of tmpfs filesystems. In this patch, an UUID is auto generated when a tmpfs have no UUID. for btrfs, multiple subvolume snapshot have the same filesystem UUID. Could we generate an UUID for btrfs subvol with 'filesystem UUID' + 'subvol ID'?You really need to ask this question of btrfs developers. 'mountd' already has a special-case exception for btrfs, to prefer the uuid provided by statfs64() rather than the uuid extracted from the block device. It would be quite easy to add another exception. But it would only be reasonable to do that if the btrfs team told us how that wanted us to generate a UUID for a given mount point, and promised that would always provide a unique stable result. This is completely separate from the tmpfs patch you identified. NeilBrownquoted
Best Regards Wang Yugui (wangyugui@e16-tech.com) 2021/06/13