[RFC,PATCH 1/4] Dynamic Pseudo Root
J. Bruce Fields
bfields at fieldses.org
Mon Dec 10 09:32:27 EST 2007
On Mon, Dec 10, 2007 at 03:15:06PM +1100, Neil Brown wrote:
> On Friday December 7, SteveD at redhat.com wrote:
> > +
> > + for (i = 0; i < MCL_MAXTYPES; i++) {
> > + for (exp = exportlist[i]; exp; exp = nxt) {
> > + nxt = exp->m_next;
> > + if (strcmp(exp->m_export.e_path, "/"))
> > + snprintf(path, BUFSIZ, "%s/%s", _PATH_PSEUDO_ROOT,
> > + exp->m_export.e_path);
> > + if (!is_mountpoint(path)) {
> > + exec_mkpath(path);
> > + bind_mount(exp->m_export.e_path, path);
> > + }
> > + }
> > + }
>
> The
> if (strcmp(exp->m_export.e_path, "/"))
>
> test is odd, and not just because I find that idiom hard to read (it
> is testing if e_path is not "/", but there is no "!" or "!=" in the
> test).
> If e_path is "/", then path is left uninitialised for the following
> code.
>
> And is the "!is_mountpoint" test just to avoid binding the same
> filesystem twice?
>
> And there is a case (explicitly mentioned in the RFC I believe) that
> this doesn't cover.
> If I have 3 filesystems: /a, /a/b and /a/b/c, and I export /a and
> /a/b/c, then we need to mount a second tmpfs on /a/b before mkpath("/a/b/c").
>
> This could be done fairly easily if we wrote our own mkpath instead of
> using "mkdir -p".
> To create a path, keep truncating the name until we find something
> that exists. If it is a tmpfs, simply do a mkdir, else do a mount,
> then a mkdir.
Yeah. At this point I think it's nice to know we could support that
some day if we wanted to, but I doubt it matters much whether we do.
(No, I take that back: if someone already has a setup where /a, /a/b,
and /a/b/c, are all mountpoints, with only /a and /a/b/c exported, then
I guess we'd need to do this just for backwards-compatibility, since
it's a legal v2/v3 setup. OK.)
--b.
More information about the NFSv4
mailing list