Re: nfs subvolume access?

Hugo Mills
2021-03-10T08:00:35Z

On Wed, Mar 10, 2021 at 08:46:20AM +0100, Ulli Horlacher wrote:
> When I try to access a btrfs filesystem via nfs, I get the error:
>
> root@tsmsrvi:~# mount tsmsrvj:/data/fex /nfs/tsmsrvj/fex
> root@tsmsrvi:~# time find /nfs/tsmsrvj/fex | wc -l
> find: File system loop detected; '/nfs/tsmsrvj/fex/spool' is part of the same file system loop as '/nfs/tsmsrvj/fex'.
> 1
> root@tsmsrvi:~#
>
>
>
> On tsmsrvj I have in /etc/exports:
>
> /data/fex tsmsrvi(rw,async,no_subtree_check,no_root_squash)
>
> This is a btrfs subvolume with snapshots:
>
> root@tsmsrvj:~# btrfs subvolume list /data
> ID 257 gen 35 top level 5 path fex
> ID 270 gen 36 top level 257 path fex/spool
> ID 271 gen 21 top level 270 path fex/spool/.snapshot/2021-03-07_1453.test
> ID 272 gen 23 top level 270 path fex/spool/.snapshot/2021-03-07_1531.test
> ID 273 gen 25 top level 270 path fex/spool/.snapshot/2021-03-07_1532.test
> ID 274 gen 27 top level 270 path fex/spool/.snapshot/2021-03-07_1718.test
>
> root@tsmsrvj:~# find /data/fex | wc -l
> 489887
> root@tsmsrvj:~#
>
> What must I add to /etc/exports to enable subvolume access for the nfs
> client?
>
> tsmsrvi and tsmsrvj (nfs client and server) both run Ubuntu 20.04 with
> btrfs-progs v5.4.1

I can't remember if this is why, but I've had to put a distinct
fsid field in each separate subvolume being exported:

/srv/nfs/home -rw,async,fsid=0x1730,no_subtree_check,no_root_squash

It doesn't matter what value you use, as long as each one's
different.

Hugo.

--
Hugo Mills | Alert status mauve ocelot: Slight chance of
hugo@... carfax.org.uk | brimstone. Be prepared to make a nice cup of tea.
http://carfax.org.uk/ |
PGP: E2AB1DE4 |