linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Martin <amartin@xes-inc.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: Optimal NFS mount options to safely allow interrupts and timeouts on newer kernels
Date: Thu, 6 Mar 2014 16:37:21 +1100	[thread overview]
Message-ID: <20140306163721.0edfb498@notabene.brown> (raw)
In-Reply-To: <1853694865.210849.1394082223818.JavaMail.zimbra@xes-inc.com>

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

On Wed, 5 Mar 2014 23:03:43 -0600 (CST) Andrew Martin <amartin@xes-inc.com>
wrote:

> ----- Original Message -----
> > From: "NeilBrown" <neilb@suse.de>
> > To: "Andrew Martin" <amartin@xes-inc.com>
> > Cc: linux-nfs@vger.kernel.org
> > Sent: Wednesday, March 5, 2014 9:50:42 PM
> > Subject: Re: Optimal NFS mount options to safely allow interrupts and timeouts on newer kernels
> > 
> > On Wed, 5 Mar 2014 11:45:24 -0600 (CST) Andrew Martin <amartin@xes-inc.com>
> > wrote:
> > 
> > > Hello,
> > > 
> > > Is it safe to use the "soft" mount option with proto=tcp on newer kernels
> > > (e.g
> > > 3.2 and newer)? Currently using the "defaults" nfs mount options on Ubuntu
> > > 12.04 results in processes blocking forever in uninterruptable sleep if
> > > they
> > > attempt to access a mountpoint while the NFS server is offline. I would
> > > prefer
> > > that NFS simply return an error to the clients after retrying a few times,
> > > however I also cannot have data loss. From the man page, I think these
> > > options
> > > will give that effect?
> > > soft,proto=tcp,timeo=10,retrans=3
> > > 
> > > >From my understanding, this will cause NFS to retry the connection 3 times
> > > >(once
> > > per second), and then if all 3 are unsuccessful return an error to the
> > > application. Is this correct? Is there a risk of data loss or corruption by
> > > using "soft" in this way? Or is there a better way to approach this?
> > 
> > I think your best bet is to use an auto-mounter so that the filesystem gets
> > unmounted if the server isn't available.
> Would this still succeed in unmounting the filesystem if there are already
> processes requesting files from it (and blocking in uninterruptable sleep)?

The kernel would allow a 'lazy' unmount in this case.  I don't know if any
automounter would try a lazy unmount though - I suspect not.

A long time ago I used "amd" which would create syslinks to a separate tree
where the filesystems were mounted.  I'm pretty sure that when a server went
away the symlink would disappear even if the unmount failed.
So while any processes accessing the filesystem would block, new processes
would not be able to find the filesystem and so would not block.


> 
> > "soft" always implies the risk of data loss.  "Nulls Frequently Substituted"
> > as it was described to very many years ago.
> > 
> > Possibly it would be good to have something between 'hard' and 'soft' for
> > cases like yours (you aren't the first to ask).
> > 
> >  From http://docstore.mik.ua/orelly/networking/puis/ch20_01.htm
> > 
> >    BSDI and OSF /1 also have a spongy option that is similar to hard , except
> >    that the stat, lookup, fsstat, readlink, and readdir operations behave
> >    like a soft MOUNT .
> > 
> > Linux doesn't have 'spongy'.  Maybe it could.  Or maybe it was a failed
> > experiment and there are good reasons not to want it.
> 
> The problem that sparked this question is a webserver where apache can serve
> files from an NFS mount. If the NFS server becomes unavailable, then the apache
> processes block in uninterruptable sleep and drive the load very high, forcing
> a server restart. It would be better for this case if the mount would simply 
> return an error to apache, so that it would give up rather than blocking 
> forever and taking down the system. Can such behavior be achieved safely?

If you have a monitoring program that notices this high load you can try
  umount -f /mount/point

The "-f" should cause outstanding requests to fail.  That doesn't stop more
requests being made though so it might not be completely successful.
Possibly running it several times would help.

  mount --move /mount/point /somewhere/safe
  for i in {1..15}; do umount -f /somewhere/safe; done

might be even better, if you can get "mount --move" to work.  It doesn't work
for me, probably the fault of systemd (isn't everything :-)).

NeilBrown



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

  reply	other threads:[~2014-03-06  5:37 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1696396609.119284.1394040541217.JavaMail.zimbra@xes-inc.com>
2014-03-05 17:45 ` Optimal NFS mount options to safely allow interrupts and timeouts on newer kernels Andrew Martin
2014-03-05 20:11   ` Jim Rees
2014-03-05 20:41     ` Andrew Martin
2014-03-05 21:11       ` Jim Rees
2014-03-06  3:34         ` NeilBrown
2014-03-06  3:47           ` Jim Rees
2014-03-06  4:37             ` NeilBrown
2014-03-05 20:15   ` Brian Hawley
2014-03-05 20:54     ` Chuck Lever
2014-03-06  9:37     ` Ric Wheeler
2014-03-06  3:50   ` NeilBrown
2014-03-06  5:03     ` Andrew Martin
2014-03-06  5:37       ` NeilBrown [this message]
2014-03-06  5:47         ` Brian Hawley
2014-03-06 15:30           ` Andrew Martin
2014-03-06 16:22             ` Jim Rees
2014-03-06 16:43               ` Andrew Martin
2014-03-06 17:36                 ` Jim Rees
2014-03-06 18:26                   ` Trond Myklebust
2014-03-06 18:35                   ` Andrew Martin
2014-03-06 18:48                     ` Jim Rees
2014-03-06 19:02                       ` Trond Myklebust
2014-03-06 18:50                     ` Trond Myklebust
2014-03-06 19:46                       ` Andrew Martin
2014-03-06 19:52                         ` Trond Myklebust
2014-03-06 20:45                           ` Andrew Martin
2014-03-06 21:01                             ` Trond Myklebust
2014-03-18 21:50                               ` Andrew Martin
2014-03-18 22:27                                 ` Trond Myklebust
2014-03-28 22:00                                   ` Dr Fields James Bruce
2014-04-04 18:15                                     ` Andrew Martin
2014-03-06 19:00                 ` Brian Hawley
2014-03-06 19:06                   ` Trond Myklebust
2014-03-06 19:14                     ` Brian Hawley
2014-03-06 19:26                       ` Trond Myklebust
2014-03-06 19:33                         ` Brian Hawley
2014-03-06 19:47                           ` Trond Myklebust
2014-03-06 19:56                             ` Brian Hawley
2014-03-06 20:31                               ` Trond Myklebust
2014-03-06 20:34                                 ` Brian Hawley
2014-03-06 20:41                                   ` Trond Myklebust
2014-03-06 19:29                       ` Ric Wheeler
2014-03-06 19:38                         ` Brian Hawley
2014-04-04 18:15                           ` Andrew Martin
2014-03-06 18:56             ` Brian Hawley
2014-03-06 12:34       ` Jim Rees
2014-03-06 15:26         ` Chuck Lever
2014-03-06 15:33           ` Trond Myklebust
2014-03-06 15:59             ` Chuck Lever
2014-03-06 16:02               ` Trond Myklebust
2014-03-06 16:13                 ` Chuck Lever
2014-03-06 16:16                   ` Trond Myklebust
2014-03-06 16:45                     ` Chuck Lever
2014-03-06 17:47                       ` Trond Myklebust
2014-03-06 20:38                         ` Chuck Lever

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=20140306163721.0edfb498@notabene.brown \
    --to=neilb@suse.de \
    --cc=amartin@xes-inc.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).