All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Chris Friesen <chris.friesen@windriver.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>, <linux-nfs@vger.kernel.org>
Subject: Re: race-free exportfs and unmount?
Date: Sat, 22 Mar 2014 10:09:43 +1100	[thread overview]
Message-ID: <20140322100943.710d2f83@notabene.brown> (raw)
In-Reply-To: <532CC3FF.700@windriver.com>

[-- Attachment #1: Type: text/plain, Size: 1842 bytes --]

On Fri, 21 Mar 2014 16:58:07 -0600 Chris Friesen
<chris.friesen@windriver.com> wrote:

> On 03/21/2014 02:20 PM, J. Bruce Fields wrote:
> > On Fri, Mar 21, 2014 at 02:17:13PM -0600, Chris Friesen wrote:
> >>
> >> Hi,
> >>
> >> There was a linux-nfs thread in July 2012 with the subject "Linux
> >> NFS and cached properties".  It discussed the fact that you can't
> >> reliably do
> >>
> >> exportfs -u 192.168.1.11:/mnt
> >> umount /mnt
> >>
> >> since there could be rpc users still running when exportfs returns,
> >> so the umount fails thinking the filesystem is busy.
> >
> > There could also be clients holding opens, locks, or delegations on the
> > export.
> >
> >> I'm running into this on a production system.
> >>
> >> Was anything ever done to resolve this issue?
> >> If not are there any workarounds?
> >
> > You can shut down the server completely, unmount, and restart.
> 
> 
> What is different with shutting down the server completely vs unexporting?
> 
> Does shutting down the server somehow wait for in-flight operations to 
> complete whereas the unexport doesn't?  I'm assuming that it can't just 
> cancel in-progress disk I/O and as long as that's happening then we 
> won't be able to unmount the filesystem.

Shutting down the server waits for all nfsd threads to complete what they are
currently doing.
I think you can simply:

 exportfs -u the filesystem
 N=`cat /proc/fs/nfsd/thread`
 echo 0 > /proc/fs/nfsd/threads
 echo $N > /proc/fs/nfsd/threads
 umount the filesystem

to reliably unmount a filesystem used by nfsd.
NFS service will be stopped for a moment but clients shouldn't notice beyond
slight delay and the need to re-establish a connection.

If this doesn't work for some reason, we should probably fix it.

NeilBrown

> 
> Thanks,
> Chris


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2014-03-21 23:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-21 20:17 race-free exportfs and unmount? Chris Friesen
2014-03-21 20:20 ` J. Bruce Fields
2014-03-21 20:56   ` Chris Friesen
2014-03-22 10:11     ` Larry Keegan
2014-03-21 22:58   ` Chris Friesen
2014-03-21 23:09     ` NeilBrown [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=20140322100943.710d2f83@notabene.brown \
    --to=neilb@suse.de \
    --cc=bfields@fieldses.org \
    --cc=chris.friesen@windriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.