Linux NFS development
 help / color / mirror / Atom feed
From: Bruce Fields <bfields@fieldses.org>
To: Chuck Lever III <chuck.lever@oracle.com>
Cc: Dai Ngo <dai.ngo@oracle.com>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH RFC v6 2/2] nfsd: Initial implementation of NFSv4 Courteous Server
Date: Mon, 6 Dec 2021 17:52:49 -0500	[thread overview]
Message-ID: <20211206225249.GE20244@fieldses.org> (raw)
In-Reply-To: <242C2259-2CF0-406F-B313-23D6D923C76F@oracle.com>

On Mon, Dec 06, 2021 at 10:30:45PM +0000, Chuck Lever III wrote:
> OK, this is really confusing.
> 
> 5142         set_deny(open->op_share_deny, stp);
> 5143         fp->fi_share_deny |= (open->op_share_deny & NFS4_SHARE_DENY_BOTH);
> 
> Here set_deny() is treating the contents of open->op_share_deny
> as bit positions, but then upon return NFS4_SHARE_DENY_BOTH
> is used directly as a bit mask. Am I reading this correctly?
> 
> But that's not your problem, so I'll let that be.

This is weird but intentional.

For most practical purposes, fi_share_deny is all that matters.

BUT, there is also this language in the spec for OPEN_DOWNGRADE:

	https://datatracker.ietf.org/doc/html/rfc5661#section-18.18.3

	The bits in share_deny SHOULD equal the union of the share_deny
	bits specified for some subset of the OPENs in effect for the
	current open-owner on the current file.

	If the above constraints are not respected, the server SHOULD
	return the error NFS4ERR_INVAL.

If you open a file twice, once with DENY_READ, once with DENY_WRITE,
then that is not *quite* the same as opening it once with DENY_BOTH.  In
the former case, you're allowed to, for example, downgrade to DENY_READ.
In the latter, you're not.

So if we want to the server to follow that SHOULD, we need to remember
not only that the union of all the DENYs so far, you also need to
remember the different DENY modes that different OPENs were done with.

So, we also keep the st_deny_bmap with that information.

The same goes for allow bits (hence there's also an st_access_bmap).

It's arguably a lot of extra busy work just for one SHOULD that has no
justification other than just to be persnickety about client
behavior....

--b.

  reply	other threads:[~2021-12-06 22:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 17:59 [PATCH RFC v6 0/2] nfsd: Initial implementation of NFSv4 Courteous Server Dai Ngo
2021-12-06 17:59 ` [PATCH RFC v6 1/2] fs/lock: add new callback, lm_expire_lock, to lock_manager_operations Dai Ngo
2021-12-06 18:39   ` Chuck Lever III
2021-12-06 19:52     ` Trond Myklebust
2021-12-06 20:05       ` bfields
2021-12-06 20:36         ` dai.ngo
2021-12-06 22:05           ` Trond Myklebust
2021-12-06 23:07             ` dai.ngo
2021-12-06 17:59 ` [PATCH RFC v6 2/2] nfsd: Initial implementation of NFSv4 Courteous Server Dai Ngo
2021-12-06 19:55   ` Chuck Lever III
2021-12-06 21:44     ` dai.ngo
2021-12-06 22:30       ` Chuck Lever III
2021-12-06 22:52         ` Bruce Fields [this message]
2021-12-07 22:00           ` Chuck Lever III
2021-12-07 22:35             ` Bruce Fields
2021-12-08 15:17               ` Chuck Lever III
2021-12-08 15:54     ` dai.ngo
2021-12-08 15:58       ` Chuck Lever III
2021-12-08 16:16       ` Trond Myklebust
2021-12-08 16:25         ` dai.ngo
2021-12-08 16:39           ` bfields
2021-12-08 17:29             ` dai.ngo
2021-12-08 17:45               ` bfields
2021-12-10 17:51               ` dai.ngo

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=20211206225249.GE20244@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@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