How to efficiently remove a subvolume with children located further than BTRFS_INO_LOOKUP_PATH_MAX?
Hi All,
I have an issue with recursively subvolume deletion when child created further than PATH_MAX.
As I understand current algorithm is:
- Find child by BTRFS_IOC_TREE_SEARCH, which is work fine.
- Get relative path to child by BTRFS_IOC_INO_LOOKUP. (that's a problem)
- Open child fd and recursively repeat until BTRFS_IOC_TREE_SEARCH could found something.
So when relative path is not fit into BTRFS_INO_LOOKUP_PATH_MAX,BTRFS_IOC_INO_LOOKUP return ENAMETOOLONG and zeros as btrfs_ioctl_ino_lookup_args.
The only way I can see by far is walk through parent fs tree to find objects
matching by name with BTRFS_IOC_TREE_SEARCH results and check them byfstat. It doesn't look very good in terms of performance. Is there any shorter way to get fd by child btrfs_root_ref?
Also btrfs-progs are fail to delete subvolumes with canonical path > PATH_MAX because of realpath also return ENAMETOOLONG. At the same time creation by relative path works fine.