Bug 248986

Summary: Cannot mount jailed zfs dataset after merging openzfs
Product: Base System Reporter: Eirik Oeverby <ltning-freebsd>
Component: kernAssignee: freebsd-fs (Nobody) <fs>
Status: Closed FIXED    
Severity: Affects Some People CC: emaste, mmacy, zeising
Priority: --- Keywords: regression
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Eirik Oeverby 2020-08-29 10:12:08 UTC
After merging openzfs, our poudriere jail is no longer functional. As part of the jail startup process, a dataset and its children are jailed (zfs set jailed=on ; zfs jail <jail> <dataset>), after which the datasets are mounted inside the jail (zfs mount -a). Under 12.1 and CURRENT prior to the merge, this worked fine.

The datasets relevant to this (seen from jail):
# zfs list -o name,mountpoint
NAME                                        MOUNTPOINT
data                                        /data
data/jails                                  /j
data/jails/poudriere                        /j/poudriere
data/jails/poudriere/workset                /poudriere
data/jails/poudriere/workset/data           /poudriere/data
data/jails/poudriere/workset/data/.m        /poudriere/data/.m
data/jails/poudriere/workset/data/cache     /poudriere/data/cache
data/jails/poudriere/workset/data/images    /poudriere/data/images
data/jails/poudriere/workset/data/logs      /poudriere/data/logs
data/jails/poudriere/workset/data/packages  /poudriere/data/packages
data/jails/poudriere/workset/data/wrkdirs   /poudriere/data/wrkdirs
data/jails/poudriere/workset/jails          /poudriere/jails
data/jails/poudriere/workset/jails/CURRENT  /poudriere/jails/CURRENT

The jailed dataset is 'data/jails/poudriere/workset'.

Now, a number of issues come up:
- 'zfs mount -av' gives 
   # zfs mount -av
   cannot mount 'data': Insufficient privileges
   cannot mount 'data/jails': Insufficient privileges
It would seem it's trying to mount also the parent datasets. However, at this point it seems to stop, not attempting to mount any more datasets and not giving any further errors.

- 'zfs mount -v data/jails/poudriere/workset' gives
  # zfs mount -v data/jails/poudriere/workset
  cannot mount 'data/jails/poudriere/workset': dataset is exported to a local zone
Although the dataset _does_ have jailed=on and _is_ jailed in the current jail. This is confirmed by manually running 'zfs unjail ...' and 'zfs jail ...' from the host.

I believe this might be two different bugs, but I'm not qualified to read the sources to figure out what's going on.
Comment 1 Eirik Oeverby 2020-09-03 15:26:47 UTC
Gentle nudge here. Any change on this one?
/Eirik
Comment 2 Eirik Oeverby 2020-09-03 16:48:14 UTC
Actually, upstream seems to have done something about this here:
https://github.com/openzfs/zfs/commit/46b7d53baf1c17f006a0ff6a8efb01e48ac248bf

I suppose we're waiting for the next merge then..
Comment 3 Matt Macy freebsd_committer freebsd_triage 2020-09-03 18:30:16 UTC
(In reply to Eirik Oeverby from comment #2)
The change needs to first make it in to the 2.0 branch. Then I can MFV.
Comment 4 Matt Macy freebsd_committer freebsd_triage 2020-09-04 22:32:10 UTC
(In reply to Matt Macy from comment #3)
Please retry.
Comment 5 Eirik Oeverby 2020-09-05 18:26:19 UTC
I confirm this functionality is now restored. Poudriere building happily again. Thanks!

/Eirik(In reply to Matt Macy from comment #4)
Comment 6 Ed Maste freebsd_committer freebsd_triage 2020-09-07 17:27:09 UTC
mmacy reports this is fixed and confirmed by original reporter