Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Andrew Elble <aweits@rit.edu>
Cc: linux-nfs@vger.kernel.org, jlayton@poochiereds.net
Subject: Re: [PATCH] nfsd: fix nfsd4_delegreturn to return correct error codes
Date: Thu, 5 Nov 2015 16:58:30 -0500	[thread overview]
Message-ID: <20151105215830.GJ9210@fieldses.org> (raw)
In-Reply-To: <1446674837-4980-1-git-send-email-aweits@rit.edu>

On Wed, Nov 04, 2015 at 05:07:17PM -0500, Andrew Elble wrote:
> When delegations are revoked:
> 
> In the NFSv4 case, NFS4ERR_BAD_STATEID
> In the NFSv4.1 case, NFS4ERR_DELEG_REVOKED

Thanks.  That looks right, but this isn't unique to delegreturn--looks
like it's probably applicable to anything that might take a delegation
stateid--maybe preprocess_stateid_op needs a similar change?

--b.

> 
> Signed-off-by: Andrew Elble <aweits@rit.edu>
> ---
>  fs/nfsd/nfs4state.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 66df2903ab8e..0f0634ca4158 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -5147,15 +5147,21 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  	if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0)))
>  		return status;
>  
> -	status = nfsd4_lookup_stateid(cstate, stateid, NFS4_DELEG_STID, &s, nn);
> +	status = nfsd4_lookup_stateid(cstate, stateid,
> +				NFS4_DELEG_STID|NFS4_REVOKED_DELEG_STID,
> +				&s, nn);
>  	if (status)
>  		goto out;
>  	dp = delegstateid(s);
>  	status = check_stateid_generation(stateid, &dp->dl_stid.sc_stateid, nfsd4_has_session(cstate));
>  	if (status)
>  		goto put_stateid;
> -
> -	destroy_delegation(dp);
> +	if (dp->dl_stid.sc_type == NFS4_DELEG_STID)
> +		destroy_delegation(dp);
> +	if (dp->dl_stid.sc_type == NFS4_REVOKED_DELEG_STID)
> +		status = nfserr_bad_stateid;
> +		if (cstate->minorversion)
> +			status = nfserr_deleg_revoked;
>  put_stateid:
>  	nfs4_put_stid(&dp->dl_stid);
>  out:
> -- 
> 2.4.6

  reply	other threads:[~2015-11-05 21:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04 22:07 [PATCH] nfsd: fix nfsd4_delegreturn to return correct error codes Andrew Elble
2015-11-05 21:58 ` J. Bruce Fields [this message]
2015-11-05 22:31 ` Trond Myklebust
2015-11-06 13:08   ` Andrew W Elble
2015-11-06 13:48     ` Trond Myklebust
2015-11-06 14:03       ` Trond Myklebust
2015-11-06 14:19         ` Jeff Layton
2015-11-06 15:29           ` Bruce James Fields
2015-11-06 17:00             ` Jeff Layton
2015-11-06 12:28 ` Jeff Layton

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=20151105215830.GJ9210@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=aweits@rit.edu \
    --cc=jlayton@poochiereds.net \
    --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