From: "J. Bruce Fields" <bfields@fieldses.org>
To: Steve Dickson <steved@redhat.com>
Cc: Bruce Fields <bfields@redhat.com>,
Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] NFSD: Don't give out read delegations on exclusive creates
Date: Tue, 21 May 2013 15:23:38 -0400 [thread overview]
Message-ID: <20130521192338.GC12114@fieldses.org> (raw)
In-Reply-To: <1368643909-8059-1-git-send-email-steved@redhat.com>
On Wed, May 15, 2013 at 02:51:49PM -0400, Steve Dickson wrote:
> When an exclusive create is done with the mode bits
> set (aka open(testfile, O_CREAT | O_EXCL, 0777)) this
so implicitly O_RDONLY. Is that common? Maybe so, OK.
> causes a OPEN op followed by a SETATTR op. When a
> read delegation is given in the OPEN, it causes
> the SETATTR to delay with EAGAIN until the
> delegation is recalled.
>
> This patch caused exclusive creates to give out
> a write delegation (which turn into no delegation)
> which allows the SETATTR seamlessly succeed.
OK. May as well make it apply to all creates, though, I think?
Any create flag seems like a sign the file's likely to be modified soon,
hence isn't a good candidate for a read delegation.
I find it a little confusing the way we set this WRITE flag and then
depend on later code to turn that into no delegation, maybe we should
fix that.
--b.
>
> Signed-off-by: Steve Dickson <steved@redhat.com>
> ---
> fs/nfsd/nfs4state.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 316ec84..6b45d0e 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -3035,8 +3035,16 @@ nfs4_open_delegation(struct net *net, struct svc_fh *fh,
> goto out;
> if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
> flag = NFS4_OPEN_DELEGATE_WRITE;
> - else
> - flag = NFS4_OPEN_DELEGATE_READ;
> + else {
> + switch(open->op_createmode) {
> + case NFS4_CREATE_EXCLUSIVE:
> + case NFS4_CREATE_EXCLUSIVE4_1:
> + flag = NFS4_OPEN_DELEGATE_WRITE;
> + break;
> + default:
> + flag = NFS4_OPEN_DELEGATE_READ;
> + }
> + }
> break;
> default:
> goto out;
> --
> 1.8.1.4
>
next prev parent reply other threads:[~2013-05-21 19:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 18:51 [PATCH] NFSD: Don't give out read delegations on exclusive creates Steve Dickson
2013-05-21 18:43 ` Steve Dickson
2013-05-21 18:52 ` J. Bruce Fields
2013-05-21 19:23 ` J. Bruce Fields [this message]
2013-05-21 20:25 ` J. Bruce Fields
2013-05-22 16:20 ` J. Bruce Fields
2013-05-21 20:26 ` J. Bruce Fields
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=20130521192338.GC12114@fieldses.org \
--to=bfields@fieldses.org \
--cc=bfields@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.