From: Benny Halevy <bhalevy@tonian.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Benny Halevy <benny@tonian.com>,
bfields@redhat.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 3/3] nfsd41: implement NFS4_SHARE_WANT_NO_DELEG, NFS4_OPEN_DELEGATE_NONE_EXT, why_no_deleg
Date: Sat, 18 Feb 2012 10:02:56 +0200 [thread overview]
Message-ID: <4F3F5B30.3000501@tonian.com> (raw)
In-Reply-To: <20120217221411.GA3627@fieldses.org>
On 2012-02-18 00:14, J. Bruce Fields wrote:
> On Thu, Feb 16, 2012 at 08:57:17PM +0200, Benny Halevy wrote:
>> Respect client request for not getting a delegation in NFSv4.1
>> Appropriately return delegation "type" NFS4_OPEN_DELEGATE_NONE_EXT
>> and WND4_NOT_WANTED reason.
>
> These all look fine, just two nits:
>
>> @@ -2903,11 +2903,32 @@ static int nfs4_set_delegation(struct nfs4_delegation *dp, int flag)
>> dprintk("NFSD: delegation stateid=" STATEID_FMT "\n",
>> STATEID_VAL(&dp->dl_stid.sc_stateid));
>> out:
>> - if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS
>> - && flag == NFS4_OPEN_DELEGATE_NONE
>> - && open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE)
>> - dprintk("NFSD: WARNING: refusing delegation reclaim\n");
>> open->op_delegate_type = flag;
>> + if (flag == NFS4_OPEN_DELEGATE_NONE) {
>> + if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS &&
>> + open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE)
>> + dprintk("NFSD: WARNING: refusing delegation reclaim\n");
>> +
>> + if (open->op_deleg_want) {
>> + open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
>> + if (status == -EAGAIN)
>> + open->op_why_no_deleg = WND4_CONTENTION;
>> + else {
>> + open->op_why_no_deleg = WND4_RESOURCE;
>> + switch (open->op_deleg_want) {
>> + case NFS4_SHARE_WANT_READ_DELEG:
>> + case NFS4_SHARE_WANT_WRITE_DELEG:
>> + case NFS4_SHARE_WANT_ANY_DELEG:
>> + break;
>> + case NFS4_SHARE_WANT_CANCEL:
>> + open->op_why_no_deleg = WND4_CANCELLED;
>> + break;
>> + case NFS4_SHARE_WANT_NO_DELEG:
>> + BUG(); /* not supposed to get here */
>> + }
>> + }
>> + }
>> + }
>
> This looks like a reasonably well-encapsulated bit of code--could you
> move it into a helper function?
>
>> out:
>> + /* 4.1 client trying to upgrade/downgrade delegation? */
>> + if (open->op_delegate_type == NFS4_OPEN_DELEGATE_NONE && dp &&
>> + open->op_deleg_want) {
>> + if (open->op_deleg_want == NFS4_SHARE_WANT_READ_DELEG &&
>> + dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) {
>> + open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
>> + open->op_why_no_deleg = WND4_NOT_SUPP_DOWNGRADE;
>> + } else if (open->op_deleg_want == NFS4_SHARE_WANT_WRITE_DELEG &&
>> + dp->dl_type == NFS4_OPEN_DELEGATE_WRITE) {
>> + open->op_delegate_type = NFS4_OPEN_DELEGATE_NONE_EXT;
>> + open->op_why_no_deleg = WND4_NOT_SUPP_UPGRADE;
>> + }
>> + /* Otherwise the client must be confused wanting a delegation
>> + * it already has, therefore we don't return
>> + * NFS4_OPEN_DELEGATE_NONE_EXT and reason.
>> + */
>> + }
>
> Ditto for this.
>
> I'll go ahead and apply the previous two patches pending some regression
> tests.
Thanks!
I'm sending two additional patches that refactor these two helpers and add
some documentation to the commit message.
I think it might be helpful to keep them separated but let me know otherwise
and I'll send a squashed patch instead.
Benny
>
> --b.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-02-18 8:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-16 18:46 [PATCH 0/3] nfsd41: want delegation flags Benny Halevy
2012-02-16 18:57 ` [PATCH 1/3] nfsd41: share_access_to_flags should consider only nfs4.x share_access flags Benny Halevy
2012-02-16 18:57 ` [PATCH 2/3] nfsd41: split out share_access want and signel flags while decoding Benny Halevy
2012-02-16 18:57 ` [PATCH 3/3] nfsd41: implement NFS4_SHARE_WANT_NO_DELEG, NFS4_OPEN_DELEGATE_NONE_EXT, why_no_deleg Benny Halevy
2012-02-17 22:14 ` J. Bruce Fields
2012-02-18 8:02 ` Benny Halevy [this message]
2012-02-18 8:16 ` [PATCH 1/2] nfsd41: refactor nfs4_open_deleg_none_ext logic out of nfs4_open_delegation Benny Halevy
2012-02-18 8:17 ` [PATCH 2/2] nfsd41: refactor nfsd4_deleg_xgrade_none_ext logic out of nfsd4_process_open2 Benny Halevy
2012-02-18 14:41 ` [PATCH 3/3] nfsd41: implement NFS4_SHARE_WANT_NO_DELEG, NFS4_OPEN_DELEGATE_NONE_EXT, why_no_deleg J. Bruce Fields
2012-02-20 15:47 ` Benny Halevy
2012-03-07 13:14 ` 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=4F3F5B30.3000501@tonian.com \
--to=bhalevy@tonian.com \
--cc=benny@tonian.com \
--cc=bfields@fieldses.org \
--cc=bfields@redhat.com \
--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).