Re: NFS corruption on ENOSPC (was: Re: Bugs in mkfs.xfs, devicemapper, xfs, and /dev/ram)
From: Trond Myklebust
Date: Mon Dec 06 2010 - 08:34:13 EST
On Mon, 2010-12-06 at 13:20 +0100, Spelic wrote:
> On 12/06/2010 05:09 AM, Dave Chinner wrote:
> >> [Files become sparse at nfs-server-side upon hitting ENOSPC if NFS client uses local writeback caching]
> >>
> >>
> >> It's nice that the NFS server does local writeback caching but it
> >> should also cache the filesystem's free space (and check it
> >> periodically, since nfs-server is presumably not the only process
> >> writing in that filesystem) so that it doesn't accept more data than
> >> it can really write. Alternatively, when free space drops below 1GB
> >> (or a reasonable size based on network speed), nfs-server should
> >> turn off filesystem writeback caching.
> >>
> > This isn't a NFS server problem, or one that canbe worked around at
> > the server. it's a NFS _client_ problem in that it does not get
> > synchronous ENOSPC errors when using writeback caching. There is no
> > way for the NFS client to know the server is near ENOSPC conditions
> > prior to writing the data to the server as clients operate
> > independently.
> >
> > If you really want your NFS clients to behave correctly when the
> > server goes ENOSPC, turn off writeback caching at the client side,
> > not the server (i.e. use sync mounts on the client side).
> > Write performance will suck, but if you want sane ENOSPC behaviour...
> >
> >
>
> [adding NFS ML in cc]
>
> Thank you for your very clear explanation.
>
> Going without writeback cache is a problem (write performance sucks as
> you say), but guaranteeing to never reach ENOSPC also is hardly
> feasible, especially if humans are logged at client side and they are
> doing "whatever they want".
>
> I would suggest that either be the NFS client to do polling to see if
> it's near an ENOSPC and if yes disable writeback caching, or be the
> server to do the polling and if it finds out it's near-ENOSPC condition
> it sends a specific message to clients to warn them so that they can
> disable caching.
> Performed at client side wouldn't change the NFS protocol and can be
> good enough if one can specify how often freespace should be polled and
> what is the freespace threshold. Or with just one value: specify what is
> the max speed at which server disk can fill (next polling period can be
> inferred from current free space), and maybe also specify a minimum
> polling period (just in case).
You can just as easily do this at the application level. The kernel
can't do it any more reliably than the application can, so there really
is no point in doing it there.
We already ensure that when the server does send us an error, we switch
to synchronous operation until the error clears.
Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/