Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Shaul Tamari <shaul.tamari@vastdata.com>, linux-nfs@vger.kernel.org
Cc: Sagi Grimberg <sagi@grimberg.me>
Subject: Re: Write delegation stateid permission checks
Date: Thu, 02 Jan 2025 08:41:37 -0500	[thread overview]
Message-ID: <e52500f98a7153822a6165d26dcf66c3d352129b.camel@kernel.org> (raw)
In-Reply-To: <CAFEWm5DTvUucAps=SamE5OVs0uYX5n4trFf5PBasBOFbEFWAfA@mail.gmail.com>

On Thu, 2025-01-02 at 11:08 +0200, Shaul Tamari wrote:
> Hi,
> 
> I have a question regarding NFS4.1 write delegation stateid permission checks.
> 
> Is there a difference in how a server should check permissions for a
> write delegation stateid that was given when the file was opened with:
> 1. OPEN4_SHARE_ACCESS_BOTH
> 2. OPEN4_SHARE_ACCESS_WRITE
> 

(cc'ing Sagi since he was looking at this recently)

A write delegation really should have been called a read-write
delegation, because the server has to allow the client to do reads as
well, if you hold one.

The Linux kernel nfs server doesn't currently give out delegations to
OPEN4_SHARE_ACCESS_WRITE-only opens for this reason. You have to
request BOTH in order to get one, because a permission check for write
is not sufficient to allow you to read as well.


> Should the server check permissions for read access as well when
> OPEN4_SHARE_ACCESS_WRITE is requested and DELEGATION_WRITE is granted
> ?
> 

Possibly? When trying to grant a write delegation, the server should
probably also do an opportunistic permission check for read as well,
and only grant the delegation if that passes. If it fails, you could
still allow the open and just not grant the delegation.

ISTR that Sagi may have tried this approach though and there was a
problem with it?

> or there is an assumption that the client will query the server for
> read access permissions ?
> 

The client should always do an ACCESS call to test permissions unless
the user's access matches the ACE that gets sent along with the
delegation.
-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2025-01-02 13:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-02  9:08 Write delegation stateid permission checks Shaul Tamari
2025-01-02 13:41 ` Jeff Layton [this message]
2025-01-02 15:40   ` Rick Macklem
2025-01-02 16:01   ` Chuck Lever
2025-01-02 16:17     ` Rick Macklem
2025-01-02 22:07   ` Sagi Grimberg
2025-01-02 22:42     ` Chuck Lever
2025-01-04 21:47       ` Sagi Grimberg
2025-01-03 20:58   ` Martin Wege

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=e52500f98a7153822a6165d26dcf66c3d352129b.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=sagi@grimberg.me \
    --cc=shaul.tamari@vastdata.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