linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Benny Halevy <bhalevy@tonian.com>
Cc: <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 1/5] pnfsd: make return_on_close state layout-global for the file/client
Date: Mon, 28 May 2012 19:38:45 +0300	[thread overview]
Message-ID: <4FC3AA15.3010107@panasas.com> (raw)
In-Reply-To: <1338221358-22447-1-git-send-email-bhalevy@tonian.com>

On 05/28/2012 07:09 PM, Benny Halevy wrote:

> As per RFC5661 errata #3226
> http://www.ietf.org/mail-archive/web/nfsv4/current/msg10965.html
> Once the server returns the return_on_close flag set, all the layout
> for that client will be implicitly returned on last close.
> 


This one I'll keep though It will conflict with my patches.

I will incorporate whats relevant.

> Reported-by: Boaz Harrosh <bharrosh@panasas.com>
> Signed-off-by: Benny Halevy <bhalevy@tonian.com>
> ---
>  fs/nfsd/nfs4pnfsd.c |   19 ++++++++++++++-----
>  fs/nfsd/pnfsd.h     |    2 +-
>  2 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4pnfsd.c b/fs/nfsd/nfs4pnfsd.c
> index 9f94cd0..a95e96e 100644
> --- a/fs/nfsd/nfs4pnfsd.c
> +++ b/fs/nfsd/nfs4pnfsd.c
> @@ -161,6 +161,7 @@ void pnfs_clear_device_notify(struct nfs4_client *clp)
>  	spin_lock(&layout_lock);
>  	list_add(&new->ls_perfile, &fp->fi_layout_states);
>  	spin_unlock(&layout_lock);
> +	new->ls_roc = false;
>  	return new;
>  }
>  
> @@ -286,6 +287,15 @@ static void update_layout_stateid(struct nfs4_layout_state *ls, stateid_t *sid)
>  	spin_unlock(&layout_lock);
>  }
>  
> +static void update_layout_roc(struct nfs4_layout_state *ls, bool roc)
> +{
> +	if (roc) {
> +		ls->ls_roc = true;
> +		dprintk("%s: Marked return_on_close on layoutstate %p\n",
> +			__func__, ls);
> +	}
> +}
> +
>  static void
>  init_layout(struct nfs4_layout *lp,
>  	    struct nfs4_layout_state *ls,
> @@ -293,8 +303,7 @@ static void update_layout_stateid(struct nfs4_layout_state *ls, stateid_t *sid)
>  	    struct nfs4_client *clp,
>  	    struct svc_fh *current_fh,
>  	    struct nfsd4_layout_seg *seg,
> -	    stateid_t *stateid,
> -	    bool roc)
> +	    stateid_t *stateid)
>  {
>  	dprintk("pNFS %s: lp %p ls %p clp %p fp %p ino %p\n", __func__,
>  		lp, ls, clp, fp, fp->fi_inode);
> @@ -305,7 +314,6 @@ static void update_layout_stateid(struct nfs4_layout_state *ls, stateid_t *sid)
>  	memcpy(&lp->lo_seg, seg, sizeof(lp->lo_seg));
>  	get_layout_state(ls);		/* put on destroy_layout */
>  	lp->lo_state = ls;
> -	lp->lo_roc = roc;
>  	update_layout_stateid(ls, stateid);
>  	list_add_tail(&lp->lo_perclnt, &clp->cl_layouts);
>  	list_add_tail(&lp->lo_perfile, &fp->fi_layouts);
> @@ -811,6 +819,7 @@ struct super_block *
>  
>  	lgp->lg_seg = res.lg_seg;
>  	lgp->lg_roc = res.lg_return_on_close;
> +	update_layout_roc(ls, res.lg_return_on_close);
>  
>  	/* SUCCESS!
>  	 * Can the new layout be merged into an existing one?
> @@ -820,7 +829,7 @@ struct super_block *
>  		goto out_freelayout;
>  
>  	/* Can't merge, so let's initialize this new layout */
> -	init_layout(lp, ls, fp, clp, lgp->lg_fhp, &res.lg_seg, &lgp->lg_sid, res.lg_return_on_close);
> +	init_layout(lp, ls, fp, clp, lgp->lg_fhp, &res.lg_seg, &lgp->lg_sid);
>  out_unlock:
>  	if (ls)
>  		put_layout_state(ls);
> @@ -1225,7 +1234,7 @@ void pnfsd_roc(struct nfs4_client *clp, struct nfs4_file *fp)
>  		bool empty;
>  
>  		/* Check for a match */
> -		if (!lo->lo_roc || lo->lo_client != clp)
> +		if (!lo->lo_state->ls_roc || lo->lo_client != clp)
>  			continue;
>  
>  		/* Return the layout */
> diff --git a/fs/nfsd/pnfsd.h b/fs/nfsd/pnfsd.h
> index f0862fb..e960fd3 100644
> --- a/fs/nfsd/pnfsd.h
> +++ b/fs/nfsd/pnfsd.h
> @@ -45,6 +45,7 @@ struct nfs4_layout_state {
>  	struct kref		ls_ref;
>  	struct nfs4_stid	ls_stid;
>  	struct list_head	ls_perfile;
> +	bool			ls_roc;
>  };
>  
>  /* outstanding layout */
> @@ -55,7 +56,6 @@ struct nfs4_layout {
>  	struct nfs4_client		*lo_client;
>  	struct nfs4_layout_state	*lo_state;
>  	struct nfsd4_layout_seg		lo_seg;
> -	bool				lo_roc;
>  };
>  
>  struct pnfs_inval_state {



  reply	other threads:[~2012-05-28 16:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-24  0:16 Does our Kernel PNFSD-Server supports recurring layout_get with open_state_id Boaz Harrosh
2012-05-24 12:41 ` Benny Halevy
2012-05-24 13:49   ` Boaz Harrosh
2012-05-24 13:50     ` Boaz Harrosh
2012-05-28 16:05     ` Benny Halevy
2012-05-28 16:09       ` [PATCH 1/5] pnfsd: make return_on_close state layout-global for the file/client Benny Halevy
2012-05-28 16:38         ` Boaz Harrosh [this message]
2012-05-28 16:09       ` [PATCH 2/5] SQUASHME: pnfsd: use LR_FLAG_INTERN for pnfsd_roc implicit layout return Benny Halevy
2012-05-28 16:09       ` [PATCH 3/5] pnfsd: add debug printouts to pnfsd_roc Benny Halevy
2012-05-28 16:53         ` Boaz Harrosh
2012-05-28 17:59           ` Benny Halevy
2012-05-28 16:09       ` [PATCH 4/5] pnfsd-lexp: return_on_close config option Benny Halevy
2012-05-28 16:52         ` Boaz Harrosh
2012-05-28 17:58           ` Benny Halevy
2012-05-28 18:01             ` Benny Halevy
2012-05-28 18:08               ` Benny Halevy
2012-05-28 18:05             ` Boaz Harrosh
2012-05-28 16:09       ` [PATCH 5/5] SQUASHME: pnfsd: lrs_present is false by default Benny Halevy
2012-05-28 16:36       ` Does our Kernel PNFSD-Server supports recurring layout_get with open_state_id Boaz Harrosh
2012-05-28 17:55         ` Benny Halevy
2012-05-28 18:09           ` Boaz Harrosh
2012-05-28 18:29             ` Benny Halevy
2012-05-29  7:13               ` Boaz Harrosh
2012-05-31  6:35                 ` Benny Halevy

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=4FC3AA15.3010107@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=bhalevy@tonian.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).