I've been trying to implement an NFS-based mounting system for some shared data between jails, and have found a mostly working solution that comes with a problem.
Goal:
Share an NFS-mounted directory between two jails: $jail0 and $jail1.
NFS share: $ip:/path/to/share containing some common files for both jails and $ip:/path/to/share/<$jail0_dir> and $ip:/path/to/share/<$jail1_dir> (neither of which need to be exclusive from the other in access).
Current solution:
Using
This works if
However, if /net/$ip/path/to/share has yet to be automounted (either during boot or if the share is autounmounted after shutting down the jails), starting either jail will end up with unresponsive jail processes trying to traverse the jail mount. Trying to
Looking at the output of
…so I presume this has something to do with how
Issue remaining:
How do I prime
I have been trying to use some Google-fu to find even a related bug let alone solution to this issue, and I have come up emtpy-handed. I would appreciate any advice or insight any of you may be able to provide.
Goal:
Share an NFS-mounted directory between two jails: $jail0 and $jail1.
NFS share: $ip:/path/to/share containing some common files for both jails and $ip:/path/to/share/<$jail0_dir> and $ip:/path/to/share/<$jail1_dir> (neither of which need to be exclusive from the other in access).
Current solution:
Using
autofs
and /etc/auto_master to automount $ip:/path/to/share to /net/$ip/path/to/share. This local mapping of /net/$ip/path/to/share is then presented to the jails as nullfs
mounts via their respective $jail{0,1}.fstab files.This works if
autofs
has already mounted the NFS share, and both jails operate and traverse the nullfs
-mounted NFS share without issue.However, if /net/$ip/path/to/share has yet to be automounted (either during boot or if the share is autounmounted after shutting down the jails), starting either jail will end up with unresponsive jail processes trying to traverse the jail mount. Trying to
jexec
into the jails is fine, but as soon as I try to ls
within the jail's nullfs
mount, ls
similarly spins up to a full core's worth of CPU activity and becomes unresponsive (to either SIGHUP or SIGKILL).Looking at the output of
mount
shows that the jail's nullfs
mount has been created before autofs
has mounted the NFS share…
Bash:
# mount
[…]
/net/$ip/path/to/share on /srv/jails/$jail0/mnt/share (nfs, nosuid, read-only)
devfs on /srv/jails/$jail0/dev (devfs)
$ip:/path/to/share on /net/$ip/path/to/share (nfs, nosuid, automounted)
nullfs
and autofs
are interacting with the former trying to call the latter. To kill these processes to be able to shutdown the jail requires umount -f /srv/jails/$jail{0,1}/mnt/share
to forcibly detach the mount before the processes become responsive again.Issue remaining:
How do I prime
autofs
to mount the NFS share prior to the jails' fstab directing the creation of the nullfs
mount? Do I need to abandon autofs
and just put this mount into /etc/fstab for the host?I have been trying to use some Google-fu to find even a related bug let alone solution to this issue, and I have come up emtpy-handed. I would appreciate any advice or insight any of you may be able to provide.