From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chris Chilvers <chilversc@gmail.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [bug report] Resolving symlinks ignores rootdir setting
Date: Mon, 17 Jan 2022 17:37:57 -0500 [thread overview]
Message-ID: <20220117223757.GC3090@fieldses.org> (raw)
In-Reply-To: <CAAmbk-e1Pd0JaAVM8PFbeepj=tdL8qcyS-DaSA1u42=S_EySSQ@mail.gmail.com>
On Fri, Jan 14, 2022 at 03:57:03PM +0000, Chris Chilvers wrote:
> > I'm probably just reading too quickly, but I'm not seeing how this
> > explains the problems with your original configuration.
> >
> > Is it that /sr/nfs/bin on you system is a symlink? (And what exactly is
> > the content of that symlink?)
>
> No, all the directories under /srv/nfs are ordinary directories. The symlinks
> are in the root of the real file system.
Oh, got it, thanks for the explanation.
> So I have:
> /bin -> /usr/bin
> /software -> /usr/lib (created to test the hypothesis)
> /srv/nfs/
> /srv/nfs/assets
> /srv/nfs/bin
> /srv/nfs/software
>
> Because exportfs is not taking into account the rootdir setting, when it tries
> to resolve the path from /etc/exports, it sees the path /bin, and matches that
> with the real /bin, and resolves it to /usr/bin.
>
> Later exportfs errors when trying to resolve the real path (e_realpath) in the
> exportent_mkrealpath function, as this function does prepend the rootdir. This
> causes exportfs to look for /srv/nfs/usr/bin instead of the expected
> /srv/nfs/bin.
>
> At best this causes an error, but if that does happen to match an existing path
> under /srv/nfs then it would export the wrong directory.
>
> This will happen for any export that happens to match an existing symlink.
>
> There are two issues though that I'm not sure how best to handle:
> * Should the symlink be considered relative to the local system or relative to
> the rootdir?
> * What happens if the symlink points to a directory outside the rootdir?
Yes, I'm not sure off hand what the right behavior is, but the existing
behavior certainly seems to violate the principal of least surprise.
--b.
>
> In my case I think the symlink would need to be resolved relative to the
> rootdir. This is because we're re-exporting an existing NFS server, so if the
> existing NFS server is exporting some kind of symlink tree, the symlinks would
> be relative to the existing mounts.
>
> One option that would be valid for my case would be an setting to disable
> symlink resolution and just consider it an error if an export is a symlink.
> Since I'm re-exporting an existing NFS server, they can't be symlinks anyway.
>
> -- Chris
prev parent reply other threads:[~2022-01-17 22:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-14 12:36 [bug report] Resolving symlinks ignores rootdir setting Chris Chilvers
2022-01-14 15:10 ` J. Bruce Fields
2022-01-14 15:57 ` Chris Chilvers
2022-01-17 22:37 ` J. Bruce Fields [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220117223757.GC3090@fieldses.org \
--to=bfields@fieldses.org \
--cc=chilversc@gmail.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).