Hi, > > > > > > > > > It seems more fixes are needed. > > > > > > > > > > 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. > > > > > > > > Another approach might be to just change svcxdr_encode_fattr3() and > > > > nfsd4_encode_fattr() in the 'FSIDSOJURCE_UUID' case to check if > > > > dentry->d_inode has a different btrfs volume id to > > > > exp->ex_path.dentry->d_inode. > > > > If it does, then mix the volume id into the fsid somehow. > > > > > > > > With that, you wouldn't want the first change I suggested. > > > > > > This is what I have done. and it is based on linux 5.10.44 > > > > > > but it still not work, so still more jobs needed. > > > > > > > The following is more what I had in mind. It doesn't quite work and I > > cannot work out why. > > > > If you 'stat' a file inside the subvol, then 'find' will not complete. > > If you don't, then it will. > > > > Doing that 'stat' changes the st_dev number of the main filesystem, > > which seems really weird. > > I'm probably missing something obvious. Maybe a more careful analysis > > of what is changing when will help. > > we compare the trace output between crossmnt and btrfs subvol with some > trace, we found out that we need to add the subvol support to > follow_down(). > > btrfs subvol should be treated as virtual 'mount point' for nfsd in follow_down(). btrfs subvol crossmnt begin to work, although buggy. some subvol is crossmnt-ed, some subvol is yet not, and some dir is wrongly crossmnt-ed 'stat /nfs/test /nfs/test/sub1' will cause btrfs subvol crossmnt begin to happen. This is the current patch based on 5.10.44. At least nfsd_follow_up() is buggy. Best Regards Wang Yugui (wangyugui@xxxxxxxxxxxx) 2021/06/22
Attachment:
0001-nfsd-btrfs-subvol-support.txt
Description: Binary data
Attachment:
0002-trace-nfsd-btrfs-subvol-support.txt
Description: Binary data