I attempt to export some directory that contains a subdirectory where autofs mounts (bind) a few other directories.
NFS accepts to export this directory, as long as I do not export the autofs mount root directory but its parent instead (if I export the autofs mount point root directly, exportfs-ra outputs "exportfs: /media/user_data/unix does not support NFS export") and as long as I use the option "crossmnt" in exportfs.
I can manually mount this exported directory on the client machine and list the files, including within the portion of the file hierarchy managed by autofs on the server. However, if I use autofs on the client machine, it fails to mount the directory.
Here is a sample of the output I could obtain from automount on the client computer
mount.nfs: mounting server.example.com:/media/user_data/unix/user1/home/debian_buster failed, reason given by server: No such file or directory
However I can mount server.example.com:/media/user_data/unix/user1/home/debian_buster with a classic mount command and list the files in the mounted directory.
mount -t nfs server.example.com:/media/user_data/unix/user1/home/debian_buster /mnt
I thought this could be due to autofs (on the client computer) not finding the directory to mount because autofs (on the server machine) did not mount it yet because of inactivity. I tried to use the "--ghost" and "browser" option but it does not seem to help. Also, if I export a directory whose subdirectories have been manually bind-mounted instead of bind mounted with autofs, then the client computer's autofs works just fine. I could not confirm online that exporting a autofs-managed hierarchy is any taboo and by not exporting the root directly, I get no warning at all so I assume this should be possible. Is it? If so? What can I look at to make it happen?
EDIT: rewrote the whole question in a much shorter (and more confusing IMO) form. Hopefully now this can be a valid question. I have a much, much more detailed version of this question with context, traces and attempts. If that can be of any help, please indicate how I can post it.