From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>,
Benjamin Coddington <bcodding@hammerspace.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
Linux FS Devel <linux-fsdevel@vger.kernel.org>
Subject: Re: RFC: NFSD administrative interface to prevent offering NFSv4 delegation
Date: Mon, 10 Nov 2025 08:33:56 -0500 [thread overview]
Message-ID: <aaa862f008e91f2fb7aefe7cc810eaea76dff3d0.camel@kernel.org> (raw)
In-Reply-To: <26959e66-f04f-4e6e-a8ce-a44c4362d99f@oracle.com>
On Sun, 2025-11-09 at 15:47 -0500, Chuck Lever wrote:
> On 11/9/25 1:57 PM, Benjamin Coddington wrote:
> > On 4 Nov 2025, at 10:54, Chuck Lever wrote:
> >
> > > NFSD has long had some ability to disable NFSv4 delegation, by disabling
> > > fs leases.
> > >
> > > However it would be nice to have more fine-grained control, for example
> > > in cases where read delegation seems to work well but the newer forms
> > > of delegation (directory, or attribute) might have bugs or performance
> > > problems, and need to be disabled. There are also testing scenarios
> > > where a unit test might focus specifically on one type of delegation.
> > >
> > > A little brainstorming:
> > >
> > > * Controls would be per net namespace
> > > * Allow read delegations, or read and write
> > > * Control attribute delegations too? Perhaps yes.
> > > * Ignore the OPEN_XOR_DELEG flag? Either that, or mask off the
> > > advertised feature flag.
> > > * Change of setting would cause immediate behavior change; no
> > > server restart needed
> > > * Control directory delegations too (when they arrive)
> > >
> > > Is this for NFSD only, or also for local accessors (via the VFS) on the
> > > NFS server?
> > >
I agree with all of the above bullet points. I think we should just
implement the more fine-grained controls for nfsd (at least initially).
OPEN_XOR_DELEG and attribute delegs don't have any relevance at the VFS
layer, so if we want to control all of these then it makes more sense
to do it in nfsd.
We could consider adding more fine-grained VFS layer controls later if
that's needed though.
> > > Should this be plumbed into NFSD netlink, or into /sys ?
> > >
> > > Any thoughts/opinions/suggestions are welcome at this point.
> >
> > Happy to read this.
> >
> > I think this would be most welcomed by the distros - there's been a lot of
> > instances of "disable delegations" with the big knob
> > /proc/sys/fs/leases-enable
> >
> > I'd also like to be able to twiddle these bits for clients as well, and
> > lacking a netlink tool to do it for the client the logical place might be
> > the client's sysfs interface.
>
> Jeff is working on a system call API that disables delegation on the
> client, to write unit tests against. Trond also proposed one, years ago.
> On the client you might want to disable delegation per file.
>
Not exactly. I'm just adding fcntl() commands that allow you to set/get
delegations from userland:
https://lore.kernel.org/linux-nfs/20251105-dir-deleg-ro-v5-17-7ebc168a88ac@kernel.org/T/#u
The main reason I wanted these was for testing purposes (so we can
ensure that later VFS changes don't subtly break delegations).
>
> > Would you also look to grain these settings per-client? The server's
> > per-client interface in proc has been fantastic.
> >
> > Ben
>
> The issue with per-client control is that, if the client hasn't already
> contacted the server, we don't know how to identify that client to
> the server administrator. We can't use the client's IP address because
> the client could be multi-homed or DHCP-configured.
>
> So, per client, the settings would have to be done every time the client
> contacts the server after either one has rebooted (I think).
>
> If we're doing per net-namespace on the server, that becomes easier to
> implement and document. Each container instance has its own settings
> that apply to all exports from that container.
>
Agreed. I don't think we can reasonably do this on a per-client basis,
because we don't have any stable long-term persistent record of clients
on the server. If the client disappears for a while, the server will
just forget about it.
--
Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2025-11-10 13:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 15:54 RFC: NFSD administrative interface to prevent offering NFSv4 delegation Chuck Lever
2025-11-09 18:57 ` Benjamin Coddington
2025-11-09 20:47 ` Chuck Lever
2025-11-10 13:33 ` Jeff Layton [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=aaa862f008e91f2fb7aefe7cc810eaea76dff3d0.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=bcodding@hammerspace.com \
--cc=chuck.lever@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--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).