linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Anna Schumaker <bjschuma@netapp.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] NFSD: Add support for NFS v4.2 operation checking
Date: Wed, 30 Oct 2013 18:26:19 -0400	[thread overview]
Message-ID: <20131030222619.GB24795@fieldses.org> (raw)
In-Reply-To: <1383154693-29741-1-git-send-email-bjschuma@netapp.com>

On Wed, Oct 30, 2013 at 01:38:13PM -0400, Anna Schumaker wrote:
> The server does allow NFS over v4.2, even if it doesn't add any new
> operations yet.
> 
> I also switch to using constants to represent the last operation for
> each minor version since this makes the code cleaner and easier to
> understand at a quick glance.

Looks good to me.  Thanks!

--b.

> 
> Signed-off-by: Anna Schumaker <bjschuma@netapp.com>
> ---
>  fs/nfsd/nfs4xdr.c    | 8 +++++---
>  include/linux/nfs4.h | 3 +++
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 99bebea..83db5a7 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -1585,11 +1585,13 @@ static nfsd4_dec nfsd4_dec_ops[] = {
>  static inline bool
>  nfsd4_opnum_in_range(struct nfsd4_compoundargs *argp, struct nfsd4_op *op)
>  {
> -	if (op->opnum < FIRST_NFS4_OP || op->opnum > LAST_NFS4_OP)
> +	if (op->opnum < FIRST_NFS4_OP)
>  		return false;
> -	else if (argp->minorversion == 0 && op->opnum > OP_RELEASE_LOCKOWNER)
> +	else if (argp->minorversion == 0 && op->opnum > LAST_NFS40_OP)
>  		return false;
> -	else if (argp->minorversion == 1 && op->opnum > OP_RECLAIM_COMPLETE)
> +	else if (argp->minorversion == 1 && op->opnum > LAST_NFS41_OP)
> +		return false;
> +	else if (argp->minorversion == 2 && op->opnum > LAST_NFS42_OP)
>  		return false;
>  	return true;
>  }
> diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
> index c56fa8f..9577769 100644
> --- a/include/linux/nfs4.h
> +++ b/include/linux/nfs4.h
> @@ -118,6 +118,9 @@ Needs to be updated if more operations are defined in future.*/
>  
>  #define FIRST_NFS4_OP	OP_ACCESS
>  #define LAST_NFS4_OP 	OP_RECLAIM_COMPLETE
> +#define LAST_NFS40_OP	OP_RELEASE_LOCKOWNER
> +#define LAST_NFS41_OP	OP_RECLAIM_COMPLETE
> +#define LAST_NFS42_OP	OP_RECLAIM_COMPLETE
>  
>  enum nfsstat4 {
>  	NFS4_OK = 0,
> -- 
> 1.8.4.2
> 

      reply	other threads:[~2013-10-30 22:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30 17:38 [PATCH] NFSD: Add support for NFS v4.2 operation checking Anna Schumaker
2013-10-30 22:26 ` J. Bruce Fields [this message]

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=20131030222619.GB24795@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=bjschuma@netapp.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).