mount / unmount and mountcheckdirs()

Edward Napierala trasz at freebsd.org
Fri Sep 15 16:02:05 UTC 2017


2017-09-15 12:56 GMT+01:00 Andriy Gapon <avg at freebsd.org>:

> On 15/09/2017 13:08, Edward Napierala wrote:
> > It does.  For example:
> >
> > [trasz at v2:~]% cd /media/md0
> > [trasz at v2:/media/md0]% mount
> > /dev/ada0s1a on / (ufs, local, noatime, journaled soft-updates)
> > devfs on /dev (devfs, local, multilabel)
> > map -hosts on /net (autofs)
> > map -media on /media (autofs)
>
> Interesting, I thought that /dev/md0 would get mounted as soon as
> /media/md0 is
> looked up.  But maybe that would be sub-optimal for some common
> scenarios...
> FWIW, ZFS snapshots get auto-mounted under .zfs as soon as there is a
> lookup.


You really don't want it to work that way.  If you have a directory with
thousands
of mountpoints inside, you don't want to mount all of them every time you
do "ls"
in that directory.  Same problem with mounting on "cd".  That's why autofs
triggers
in three cases: in VOP_READDIR(9), VOP_GETATTR(9), and VOP_LOOKUP(9)
with the vnode as a parent dir.


More information about the freebsd-fs mailing list