All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <benny@tonian.com>
To: Fred Isaman <iisaman@netapp.com>
Cc: linux-nfs@vger.kernel.org, Trond Myklebust <Trond.Myklebust@netapp.com>
Subject: Re: [PATCH 1/1] nfs4.1: fix several problems with _pnfs_return_layout
Date: Tue, 14 Jun 2011 10:55:41 -0400	[thread overview]
Message-ID: <4DF7766D.7070305@tonian.com> (raw)
In-Reply-To: <1308005693-8330-1-git-send-email-iisaman@netapp.com>

On 2011-06-13 18:54, Fred Isaman wrote:
> _pnfs_return_layout had the following problems:
> 
> - it did not call pnfs_free_lseg_list on all paths
> - it unintentionally did a forgetful return when there was no outstanding io
> - it raced with concurrent LAYOUTGETS
> 
> Signed-off-by: Fred Isaman <iisaman@netapp.com>

ACK

Benny

> ---
>  fs/nfs/nfs4proc.c |    8 ++++----
>  fs/nfs/pnfs.c     |    8 +++++---
>  2 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index bc78597..2b2f51b 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -5757,6 +5757,7 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
>  {
>  	struct nfs4_layoutreturn *lrp = calldata;
>  	struct nfs_server *server;
> +	struct pnfs_layout_hdr *lo = NFS_I(lrp->args.inode)->layout;
>  
>  	dprintk("--> %s\n", __func__);
>  
> @@ -5768,16 +5769,15 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
>  		nfs_restart_rpc(task, lrp->clp);
>  		return;
>  	}
> +	spin_lock(&lo->plh_inode->i_lock);
>  	if (task->tk_status == 0) {
> -		struct pnfs_layout_hdr *lo = NFS_I(lrp->args.inode)->layout;
> -
>  		if (lrp->res.lrs_present) {
> -			spin_lock(&lo->plh_inode->i_lock);
>  			pnfs_set_layout_stateid(lo, &lrp->res.stateid, true);
> -			spin_unlock(&lo->plh_inode->i_lock);
>  		} else
>  			BUG_ON(!list_empty(&lo->plh_segs));
>  	}
> +	lo->plh_block_lgets--;
> +	spin_unlock(&lo->plh_inode->i_lock);
>  	dprintk("<-- %s\n", __func__);
>  }
>  
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 8ff8c1b..1abb300 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -640,12 +640,14 @@ _pnfs_return_layout(struct inode *ino)
>  
>  	spin_lock(&ino->i_lock);
>  	lo = nfsi->layout;
> -	if (!lo || !mark_matching_lsegs_invalid(lo, &tmp_list, NULL)) {
> +	if (!lo) {
>  		spin_unlock(&ino->i_lock);
> -		dprintk("%s: no layout segments to return\n", __func__);
> -		goto out;
> +		dprintk("%s: no layout to return\n", __func__);
> +		return status;
>  	}
>  	stateid = nfsi->layout->plh_stateid;
> +	mark_matching_lsegs_invalid(lo, &tmp_list, NULL);
> +	lo->plh_block_lgets++;
>  	/* Reference matched in nfs4_layoutreturn_release */
>  	get_layout_hdr(lo);
>  	spin_unlock(&ino->i_lock);

-- 
Benny Halevy
CTO, Tonian Inc.

Tel: +972-54-802-8340
benny@tonian.com

      reply	other threads:[~2011-06-14 14:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-13 22:54 [PATCH 1/1] nfs4.1: fix several problems with _pnfs_return_layout Fred Isaman
2011-06-14 14:55 ` Benny Halevy [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=4DF7766D.7070305@tonian.com \
    --to=benny@tonian.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=iisaman@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 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.