From: NeilBrown <neilb@suse.de>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>, NFS <linux-nfs@vger.kernel.org>
Subject: Re: [patch/rfc] allow exported (and *not* exported) filesystems to be unmounted.
Date: Thu, 6 Jun 2013 10:05:12 +1000 [thread overview]
Message-ID: <20130606100512.1c701a64@notabene.brown> (raw)
In-Reply-To: <20130605133658.GE24193@fieldses.org>
[-- Attachment #1: Type: text/plain, Size: 2946 bytes --]
On Wed, 5 Jun 2013 09:36:58 -0400 "J. Bruce Fields" <bfields@fieldses.org>
wrote:
> On Wed, Jun 05, 2013 at 04:19:34PM +1000, NeilBrown wrote:
> > On Wed, 5 Jun 2013 04:41:15 +0100 Al Viro <viro@ZenIV.linux.org.uk> wrote:
> >
> > > On Wed, Jun 05, 2013 at 01:05:41PM +1000, NeilBrown wrote:
> > > >
> > > > Hi Bruce,
> > > > this is a little issue that seems to keep coming up so I thought it might be
> > > > time to fix it.
> > > >
> > > > As you know, a filesystem that is exported cannot be unmounted as the export
> > > > cache holds a reference to it. Though if it hasn't been accessed for a
> > > > while then it can.
> > > >
> > > > As I hadn't realised before sometimes *non* exported filesystems can be
> > > > pinned to. A negative entry in the cache can pin a filesystem just as
> > > > easily as a positive entry.
> > > > An amusing, if somewhat contrived, example is that if you export '/' with
> > > > crossmnt and:
> > > >
> > > > mount localhost:/ /mnt
> > > > ls -l /
> > > > umount /mnt
> > > >
> > > > the umount might fail. This is because the "ls -l" tried to export every
> > > > filesystem found mounted in '/'. The export of "/mnt" failed of course
> > > > because you cannot re-export an NFS filesystem. But it is still in the
> > > > cache.
> > > > An 'exportfs -f' fixes this, but shouldn't be necessary.
>
> Yeah, ugh. As a less contrived example, can the default v4 root export
> lead to arbitrary filesystems being pinned just because a client tried
> to mount the wrong path?
I think it can only pin filesystems that are exported, either explicitly or
via a parent being exported with 'crossmnt'.
>
> Could the export cache be indexed on a path string instead of a struct
> path?
Yes. It would mean lots of extra pathname lookups and possibly lots of
"d_path()" calls.
>
> The problem of negative entries aside, anyone counting on the ability to
> unexport mounted filesystems on a running nfs server is setting
^unmount exported^?
> themselves up for trouble: suppose we fix this problem, what if an rpc
> is in progress, or a lock or v4 open or delegation is held?
All of these should prevent the unmount - and I think people would expect
that - you cannot unmount a filesystem that is still being used, and all of
these are examples of current use. At the very least, the filesystem must
be mounted on some client.
In the (few) times this has been raised over the years, the position has been
"I'm not using it any more, why cannot I unmount it? fuser/lsof doesn't
show any users!".
An alternate approach to the problem might be to get rpc.mountd to hold an
open file descriptor for every exported filesystem. That would guide people
(via lsof/fuser) to stopping nfsd, which would make the filesystem
unmountable.
However I don't find that approach particularly elegant...
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2013-06-06 0:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-05 3:05 [patch/rfc] allow exported (and *not* exported) filesystems to be unmounted NeilBrown
2013-06-05 3:41 ` Al Viro
2013-06-05 6:19 ` NeilBrown
2013-06-05 13:36 ` J. Bruce Fields
2013-06-06 0:05 ` NeilBrown [this message]
2013-07-01 19:12 ` J. Bruce Fields
2013-07-01 22:24 ` NeilBrown
2013-07-02 15:50 ` J. Bruce Fields
2013-07-08 7:30 ` NeilBrown
2013-07-08 20:04 ` J. Bruce Fields
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=20130606100512.1c701a64@notabene.brown \
--to=neilb@suse.de \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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).