Subject: Re: multiple mounts on same directory
To: None <tech-userlevel@netbsd.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-userlevel
Date: 07/18/2003 12:08:01
On Fri, 18 Jul 2003, Alan Barrett wrote:

> On Fri, 18 Jul 2003, Bill Studenmund wrote:
> > I think it's perfectly fine to just have the code in mount know that for
> > mfs mount (and mfs mounts _only_), f_mntfromname doesn't matter for
> > differences.
> >
> > The reason that "union" is special is that if you mount with the -b
> > option, then the f_mntfromname will get changed. As I recall, it'll become
> > "<below>:" in front of the name. So the matching code would also need to
> > synthesize a new union f_mntfromname. But once it's done that, it will
> > match perfectly well.
>
> The special cases that I know about so far are:
>
>     fstype       original name   f_mntfromname
>     ------       -------------   -------------
>     mfs          anything        mfs:123
>     kernfs       anything        kernfs
>     procfs       anything        procfs
>     union        /some/dir       <above>:/some/dir
>     union        /some/dir       <below>:/some/dir
>
> Is it OK to hard-code knowledge of these special cases in the duplicate
> detection part of "mount -a"?  The normal case would then be that
> f_mntfromname would have to be an exact match before a potential mount
> would be detected as a duplicate.

I'd say hard-coding is fine, since it's better than all the alternatives.
Only "mount -a" really needs to know about this, so I'd say keep the
changes close to it.

I'd say a switch (fstype) would be best, and have it: 1) note if the
fromname should be looked at (kern, proc, mfs would be no), and if the
from name needs to be different than what's in the fstab.

Take care,

Bill