All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@tonian.com>
To: Tigran Mkrtchyan <kofemann@googlemail.com>
Cc: linux-nfs@vger.kernel.org, Tigran Mkrtchyan <kofemann@gmail.com>
Subject: Re: [PATH v4 2/3] nfsd41: handle current stateid on lock and locku
Date: Tue, 13 Dec 2011 10:09:07 +0200	[thread overview]
Message-ID: <4EE70823.5070407@tonian.com> (raw)
In-Reply-To: <1323723627-413-3-git-send-email-tigran.mkrtchyan@desy.de>

On 2011-12-12 23:00, Tigran Mkrtchyan wrote:
> From: Tigran Mkrtchyan <kofemann@gmail.com>
> 
> plus minor fixes

hopefully that's not the case anymore :)

> 
> Conflicts:
> 
> 	fs/nfsd/nfs4proc.c

ditto

> 
> Signed-off-by: Tigran Mkrtchyan <kofemann@gmail.com>
> ---
>  fs/nfsd/current_stateid.h |   11 ++++++++++-
>  fs/nfsd/nfs4proc.c        |    2 ++
>  fs/nfsd/nfs4state.c       |   22 ++++++++++++++++++++--
>  3 files changed, 32 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/nfsd/current_stateid.h b/fs/nfsd/current_stateid.h
> index a83dd50..21550b6 100644
> --- a/fs/nfsd/current_stateid.h
> +++ b/fs/nfsd/current_stateid.h
> @@ -4,8 +4,17 @@
>  #include "state.h"
>  #include "xdr4.h"
>  
> +/*
> + * functions to set current state id
> + */
>  extern void nfsd4_set_openstateid(struct nfsd4_compound_state *, struct nfsd4_open *);
> -extern void nfsd4_get_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
> +extern void nfsd4_set_lockstateid(struct nfsd4_compound_state *, struct nfsd4_lock *);
>  extern void nfsd4_set_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
>  
> +/*
> + * functions to consume current state id
> + */
> +extern void nfsd4_get_closestateid(struct nfsd4_compound_state *, struct nfsd4_close *);
> +extern void nfsd4_get_lockustateid(struct nfsd4_compound_state *, struct nfsd4_locku *);
> +
>  #endif   /* _NFSD4_CURRENT_STATE_H */
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 3dfb235..90c532b 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1478,6 +1478,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
>  		.op_flags = OP_MODIFIES_SOMETHING,
>  		.op_name = "OP_LOCK",
>  		.op_rsize_bop = (nfsd4op_rsize)nfsd4_lock_rsize,
> +		.op_set_currentstateid = (stateid_setter)nfsd4_set_lockstateid,
>  	},
>  	[OP_LOCKT] = {
>  		.op_func = (nfsd4op_func)nfsd4_lockt,
> @@ -1488,6 +1489,7 @@ static struct nfsd4_operation nfsd4_ops[] = {
>  		.op_flags = OP_MODIFIES_SOMETHING,
>  		.op_name = "OP_LOCKU",
>  		.op_rsize_bop = (nfsd4op_rsize)nfsd4_status_stateid_rsize,
> +		.op_get_currentstateid = (stateid_getter)nfsd4_get_lockustateid,
>  	},
>  	[OP_LOOKUP] = {
>  		.op_func = (nfsd4op_func)nfsd4_lookup,
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 594b44e..58410b2 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4564,6 +4564,9 @@ put_stateid(struct nfsd4_compound_state *cstate, stateid_t *stateid)
>  		cstate->current_stateid = stateid;
>  }
>  
> +/*
> + * functions to set current state id
> + */
>  void
>  nfsd4_set_openstateid(struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
>  {
> @@ -4571,13 +4574,28 @@ nfsd4_set_openstateid(struct nfsd4_compound_state *cstate, struct nfsd4_open *op
>  }
>  
>  void
> +nfsd4_set_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close)
> +{
> +	put_stateid(cstate, &close->cl_stateid);
> +}
> +
> +void
> +nfsd4_set_lockstateid(struct nfsd4_compound_state *cstate, struct nfsd4_lock *lock)
> +{
> +	put_stateid(cstate, &lock->lk_resp_stateid);
> +}
> +
> +/*
> + * functions to consume current state id
> + */
> +void
>  nfsd4_get_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close)
>  {
>  	get_stateid(cstate, &close->cl_stateid);
>  }
>  
>  void
> -nfsd4_set_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close)
> +nfsd4_get_lockustateid(struct nfsd4_compound_state *cstate, struct nfsd4_locku *locku)
>  {
> -	get_stateid(cstate, &close->cl_stateid);
> +	get_stateid(cstate, &locku->lu_stateid);

Reading Section 8.2.3.  Special Stateids, for some reason (that I'm not sure of)
RFC5661 requires the following:

      The stateid passed to the operation in place
      of the special value has its "seqid" value set to zero, except
      when the current stateid is used by the operation CLOSE or
      OPEN_DOWNGRADE.

How about defining another get_stateid helper that will clear si_generation?

Benny

>  }

  reply	other threads:[~2011-12-13  8:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12 21:00 [PATH v4 0/3] nfsd41: current state id processing Tigran Mkrtchyan
2011-12-12 21:00 ` [PATH v4 1/3] nfsd41: handle current stateid in open and close Tigran Mkrtchyan
2011-12-13  8:03   ` Benny Halevy
2011-12-13 16:44   ` J. Bruce Fields
2011-12-14 17:01     ` Tigran Mkrtchyan
2011-12-12 21:00 ` [PATH v4 2/3] nfsd41: handle current stateid on lock and locku Tigran Mkrtchyan
2011-12-13  8:09   ` Benny Halevy [this message]
2011-12-12 21:00 ` [PATH v4 3/3] nfsd41: consume current stateid on read and write Tigran Mkrtchyan
2011-12-13  8:11   ` Benny Halevy
2011-12-13  8:17     ` Tigran Mkrtchyan
2011-12-12 23:07 ` [PATH v4 0/3] nfsd41: current state id processing 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=4EE70823.5070407@tonian.com \
    --to=bhalevy@tonian.com \
    --cc=kofemann@gmail.com \
    --cc=kofemann@googlemail.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 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.