public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Cc: Mike Snitzer <snitzer@kernel.org>,
	Anna Schumaker <anna@kernel.org>,
	Trond Myklebust <trondmy@hammerspace.com>,
	Jeff Layton <jlayton@kernel.org>
Subject: Re: [PATCH v3] nfsd: disallow file locking and delegations for NFSv4 reexport
Date: Mon, 18 Nov 2024 13:57:22 -0500	[thread overview]
Message-ID: <ZzuOEt/JjwmROMBb@tissot.1015granger.net> (raw)
In-Reply-To: <ZyOe66m0BbAOWOyI@tissot.1015granger.net>

On Thu, Oct 31, 2024 at 11:14:51AM -0400, Chuck Lever wrote:
> On Wed, Oct 23, 2024 at 11:58:46AM -0400, Mike Snitzer wrote:
> > We do not and cannot support file locking with NFS reexport over
> > NFSv4.x for the same reason we don't do it for NFSv3: NFS reexport

 [ ... patch snipped ... ]

> > diff --git a/Documentation/filesystems/nfs/reexport.rst b/Documentation/filesystems/nfs/reexport.rst
> > index ff9ae4a46530..044be965d75e 100644
> > --- a/Documentation/filesystems/nfs/reexport.rst
> > +++ b/Documentation/filesystems/nfs/reexport.rst
> > @@ -26,9 +26,13 @@ Reboot recovery
> >  ---------------
> >  
> >  The NFS protocol's normal reboot recovery mechanisms don't work for the
> > -case when the reexport server reboots.  Clients will lose any locks
> > -they held before the reboot, and further IO will result in errors.
> > -Closing and reopening files should clear the errors.
> > +case when the reexport server reboots because the source server has not
> > +rebooted, and so it is not in grace.  Since the source server is not in
> > +grace, it cannot offer any guarantees that the file won't have been
> > +changed between the locks getting lost and any attempt to recover them.
> > +The same applies to delegations and any associated locks.  Clients are
> > +not allowed to get file locks or delegations from a reexport server, any
> > +attempts will fail with operation not supported.
> >  
> >  Filehandle limits
> >  -----------------

Note for Mike:

Last sentence "Clients are not allowed to get ... delegations from a
reexport server" -- IIUC it's up to the re-export server to not hand
out delegations to its clients. Still, it's important to note that
NFSv4 delegation would not be available for re-exports.

See below for more: I'd like this paragraph to continue to discuss
the issue of OPEN and I/O behavior when the re-export server
restarts. The patch seems to redact that bit of detail.

Following is general discussion:


> There seems to be some controversy about this approach.
> 
> Also I think it would be nicer all around if we followed the usual
> process for changes that introduce possible behavior regressions:
> 
>  - add the new behavior, make it optional, default old behavior
>  - wait a few releases
>  - change the default to new behavior
> 
> Lastly, there haven't been any user complaints about the current
> situation of no lock recovery in the re-export case.
> 
> Jeff and I discussed this, and we plan to drop this one for 6.13 but
> let the conversation continue. Mike, no action needed on your part
> for the moment, but please stay tuned!
> 
> IMO having an export option (along the lines of "async/sync") that
> is documented in a man page is going to be a better plan. But if we
> find a way to deal with this situation without a new administrative
> control, that would be even better.

Proposed solutions so far:

- Disable NFS locking entirely on NFS re-export

- Implement full state pass-through for re-export

Some history of the NFSD design and the re-export issue is provided
here:

  http://wiki.linux-nfs.org/wiki/index.php/NFS_re-export#reboot_recovery

Certain usage scenarios require that lock state be globally visible,
so disabling NFS locking on re-export mounts will need to be
considered carefully.

Assuming that NFSv4 LOCK operations are proliferated to the back-end
server in today's NFSD, does it make sense to avoid code changes at
the moment, but more carefully document the configuration options
and their risks?

+++ In all following configurations, no state recovery occurs when
the re-export server restarts, as explained in
Documentation/filesystems/nfs/reexport.rst.

Mount options on the re-export server and clients:

* All default: open and lock state is proliferated to the back-end
  server and is visible to all NFS clients.

* local_lock=all on the re-export server's mount of the back-end
  server: clients of that server all see the same set of locks, but
  these locks are not visible to the back-end server or any of its
  clients. Open state is visible everywhere.

* local_lock=all on the NFS mounts on client mounts of the re-export
  server: applications on NFS clients do not see locks set by
  applications on any other NFS clients. Open state is visible
  everywhere.

When an NFS client of the re-export server OPENs a file, currently
that creates OPEN state on the re-export server, and I assume also
on the back-end server. That state cannot be recovered if the
re-export server restarts, but it also cannot be blocked by a mount
option.

Likewise, I assume the back-end server can hand out delegations to
the re-export server. If the re-export server restarts, how does it
recover those delegations? The re-export server could disable
delegation by blocking off its callback service, but should it?

What, if anything, is being done to further develop and regularly 
test NFS re-export in upstream kernels?

The reexport.rst file: This still reads more like design notes than
administrative documentation.  IMHO it should instead have a more
detailed description and disclaimer regarding what kind of manual
recovery is needed after a re-export server restart. That seems like
important information for administrators who think they might want
to deploy this solution. Maybe Documentation/ isn't the right place
for administrative documentation?

It might be prudent to (temporarily) label NFS re-export as
experimental use only, given its incompleteness and the long list
of caveats.


-- 
Chuck Lever

  reply	other threads:[~2024-11-18 18:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23 14:54 [PATCH] nfsd: disallow file locking and delegations for NFSv4 proxy Mike Snitzer
2024-10-23 15:03 ` Chuck Lever
2024-10-23 15:29 ` [PATCH v2] " Mike Snitzer
2024-10-23 15:58   ` [PATCH v3] nfsd: disallow file locking and delegations for NFSv4 reexport Mike Snitzer
2024-10-29 13:57     ` Martin Wege
2024-10-29 14:11       ` Chuck Lever III
2024-10-29 15:54         ` Brian Cowan
2024-10-29 16:03           ` Chuck Lever III
2024-10-30 14:55             ` Cedric Blancher
2024-10-30 16:15               ` Chuck Lever III
2024-10-30 16:37                 ` Cedric Blancher
2024-10-30 16:59                   ` Chuck Lever III
2024-10-30 22:48                     ` Rick Macklem
2024-10-31 11:43                       ` Jeff Layton
2024-10-31 14:48                         ` Rick Macklem
2024-10-31 15:01                           ` Chuck Lever III
2024-10-31 16:02                             ` Rick Macklem
2024-10-31 15:14     ` Chuck Lever
2024-11-18 18:57       ` Chuck Lever [this message]
2024-11-19  0:37         ` Daire Byrne

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=ZzuOEt/JjwmROMBb@tissot.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=anna@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=snitzer@kernel.org \
    --cc=trondmy@hammerspace.com \
    /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