All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pnfs: send layoutcommit until IO completed when return layout
@ 2010-05-11  8:59 Zhang Jingwang
  2010-05-12  6:51 ` Benny Halevy
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Jingwang @ 2010-05-11  8:59 UTC (permalink / raw)
  To: linux-nfs; +Cc: bhalevy, iisaman

If we call layoutcommit before IO completed, then some extents we are
writing may not be in the commit list. When we return layout, they
may not get a chance to be committed to server.

Signed-off-by: Zhang Jingwang <zhangjingwang@nrchpc.ac.cn>
---
 fs/nfs/pnfs.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 3739c38..6fa295b 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -726,16 +726,6 @@ _pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range,
 		arg.length = ~0;
 	}
 	if (type == RETURN_FILE) {
-		if (nfsi->layoutcommit_ctx) {
-			status = pnfs_layoutcommit_inode(ino, 1);
-			if (status) {
-				dprintk("%s: layoutcommit failed, status=%d. "
-					"Returning layout anyway\n",
-					__func__, status);
-				status = 0;
-			}
-		}
-
 		lo = get_lock_current_layout(nfsi);
 		if (lo && !has_layout_to_return(lo, &arg)) {
 			put_unlock_current_layout(lo);
@@ -763,6 +753,16 @@ _pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range,
 			wait_event(nfsi->lo_waitq,
 				!pnfs_return_layout_barrier(nfsi, &arg));
 		}
+
+		if (nfsi->layoutcommit_ctx) {
+			status = pnfs_layoutcommit_inode(ino, 1);
+			if (status) {
+				dprintk("%s: layoutcommit failed, status=%d. "
+					"Returning layout anyway\n",
+					__func__, status);
+				status = 0;
+			}
+		}
 	}
 send_return:
 	status = return_layout(ino, &arg, stateid, type, lo);
-- 
1.6.2.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pnfs: send layoutcommit until IO completed when return layout
  2010-05-11  8:59 [PATCH] pnfs: send layoutcommit until IO completed when return layout Zhang Jingwang
@ 2010-05-12  6:51 ` Benny Halevy
  0 siblings, 0 replies; 2+ messages in thread
From: Benny Halevy @ 2010-05-12  6:51 UTC (permalink / raw)
  To: Zhang Jingwang; +Cc: linux-nfs, iisaman

On May. 11, 2010, 11:59 +0300, Zhang Jingwang <zhangjingwang@nrchpc.ac.cn> wrote:
> If we call layoutcommit before IO completed, then some extents we are
> writing may not be in the commit list. When we return layout, they
> may not get a chance to be committed to server.
> 
> Signed-off-by: Zhang Jingwang <zhangjingwang@nrchpc.ac.cn>
> ---
>  fs/nfs/pnfs.c |   20 ++++++++++----------
>  1 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 3739c38..6fa295b 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -726,16 +726,6 @@ _pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range,
>  		arg.length = ~0;
>  	}
>  	if (type == RETURN_FILE) {
> -		if (nfsi->layoutcommit_ctx) {
> -			status = pnfs_layoutcommit_inode(ino, 1);
> -			if (status) {
> -				dprintk("%s: layoutcommit failed, status=%d. "
> -					"Returning layout anyway\n",
> -					__func__, status);
> -				status = 0;
> -			}
> -		}
> -
>  		lo = get_lock_current_layout(nfsi);
>  		if (lo && !has_layout_to_return(lo, &arg)) {
>  			put_unlock_current_layout(lo);
> @@ -763,6 +753,16 @@ _pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range,
>  			wait_event(nfsi->lo_waitq,
>  				!pnfs_return_layout_barrier(nfsi, &arg));
>  		}
> +
> +		if (nfsi->layoutcommit_ctx) {
> +			status = pnfs_layoutcommit_inode(ino, 1);
> +			if (status) {
> +				dprintk("%s: layoutcommit failed, status=%d. "
> +					"Returning layout anyway\n",
> +					__func__, status);
> +				status = 0;
> +			}
> +		}

OK, I guess doing that after the send_return label is superfluous
as there should be nothing to layoutcommit if we got there after finding
no layout to return.

Benny

>  	}
>  send_return:
>  	status = return_layout(ino, &arg, stateid, type, lo);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-12  6:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-11  8:59 [PATCH] pnfs: send layoutcommit until IO completed when return layout Zhang Jingwang
2010-05-12  6:51 ` Benny Halevy

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.