Linux NFS development
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: NFS list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] SQUASHME: pnfsd-exofs: Fix exofs_inode_recall_layout() sending 2 recalls
Date: Thu, 01 Jul 2010 21:28:20 +0300	[thread overview]
Message-ID: <4C2CDE44.20806@panasas.com> (raw)
In-Reply-To: <4C29DBDF.1080904@panasas.com>

On Jun. 29, 2010, 14:41 +0300, Boaz Harrosh <bharrosh@panasas.com> wrote:
> 
> A misunderstanding of the wait_event_interruptible() macro has caused
> exofs to always issue two recalls in succession.
> 
> Using __wait_event_interruptible() would fix that. But I don't like
> how this code is structured so change it around completely to be more
> flat and clear.
> 
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>

Merged at pnfs-all-2.6.35-rc3-2010-07-01

Thanks!

Benny

> ---
>  fs/exofs/export.c |   67 +++++++++++++++++++---------------------------------
>  1 files changed, 25 insertions(+), 42 deletions(-)
> 
> diff --git a/fs/exofs/export.c b/fs/exofs/export.c
> index 8beebfe..ae3e9fd 100644
> --- a/fs/exofs/export.c
> +++ b/fs/exofs/export.c
> @@ -332,45 +332,15 @@ struct pnfs_export_operations exofs_pnfs_ops = {
>  	.get_device_info = exofs_get_device_info,
>  };
>  
> -static bool is_layout_returned(struct exofs_i_info *oi, enum pnfs_iomode iomode,
> -			      u64 offset, u64 length, void *cookie, int *status)
> +static bool is_layout_returned(struct exofs_i_info *oi)
>  {
> -	struct inode *inode = &oi->vfs_inode;
> -	bool done;
> -	int error;
> -
> -	/* We most probably have finished the recall, unless there was an out-
> -	 * of-memory condition when sending the recall. For forward progress
> -	 * some recalls where sent and some not, resend these that where lost
> -	 * before. If cb_layout_recall returns with -ENOENT we know we are
> -	 * done for sure.
> -	 */
> -
> -	error = cb_layout_recall(inode, iomode, offset, length, cookie);
> -
> -	switch (error) {
> -	case 0:
> -	case -EAGAIN:
> -		done = false;
> -		break;
> -	case -ENOENT:
> -		done = true;
> -		break;
> -	default:
> -		goto err;
> -	}
> +	bool layout_given;
>  
> -	*status = 0;
> -	return done;
> +	spin_lock(&oi->i_layout_lock);
> +	layout_given = test_bit(OBJ_LAYOUT_IS_GIVEN, &oi->i_flags);
> +	spin_unlock(&oi->i_layout_lock);
>  
> -err:
> -	/* this will cause wait_event_interruptible below to break with
> -	 * an -ERESTARTSY return. If nfsd is able to unload we probably
> -	 * should break out of any nfs loops
> -	 */
> -	*status = error;
> -	restart_syscall();
> -	return false;
> +	return !layout_given;
>  }
>  
>  int exofs_inode_recall_layout(struct inode *inode, enum pnfs_iomode iomode,
> @@ -388,13 +358,26 @@ int exofs_inode_recall_layout(struct inode *inode, enum pnfs_iomode iomode,
>  	if (!layout_given)
>  		goto exec;
>  
> -	EXOFS_DBGMSG("(0x%lx) has_layout issue a recall\n", inode->i_ino);
> +	for (;;) {
> +		EXOFS_DBGMSG("(0x%lx) has_layout issue a recall\n",
> +			     inode->i_ino);
> +		error = cb_layout_recall(inode, iomode, 0, NFS4_MAX_UINT64,
> +					 &oi->i_wq);
> +		switch (error) {
> +		case 0:
> +		case -EAGAIN:
> +			break;
> +		case -ENOENT:
> +			goto exec;
> +		default:
> +			goto err;
> +		}
>  
> -	wait_event_interruptible(oi->i_wq,
> -			is_layout_returned(oi, iomode, 0, NFS4_MAX_UINT64,
> -					   todo, &error));
> -	if (error)
> -		goto err;
> +		error = wait_event_interruptible(oi->i_wq,
> +						 is_layout_returned(oi));
> +		if (error)
> +			goto err;
> +	}
>  
>  exec:
>  	error = todo(inode);

      reply	other threads:[~2010-07-01 18:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29 11:41 [PATCH] SQUASHME: pnfsd-exofs: Fix exofs_inode_recall_layout() sending 2 recalls Boaz Harrosh
2010-07-01 18:28 ` 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=4C2CDE44.20806@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=bharrosh@panasas.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