All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs41: Free layoutcommit_data when error occurs in setup
@ 2010-05-06  7:18 Zhang Jingwang
       [not found] ` <20100506071656.GA2746-nK6E9TRyOkVSq9BJjBFyUp/QNRX+jHPU@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Jingwang @ 2010-05-06  7:18 UTC (permalink / raw)
  To: linux-nfs; +Cc: bhalevy

When layout driver cannot setup layoutcommit_data, we should free
layoutcommit_data data structure before we return.

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

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index e17efcc..1018bc6 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2226,10 +2226,8 @@ pnfs_layoutcommit_inode(struct inode *inode, int sync)
 		return -ENOMEM;
 
 	spin_lock(&nfsi->lo_lock);
-	if (!nfsi->layoutcommit_ctx) {
-		pnfs_layoutcommit_free(data);
+	if (!nfsi->layoutcommit_ctx)
 		goto out_unlock;
-	}
 
 	data->args.inode = inode;
 	data->cred  = nfsi->layoutcommit_ctx->cred;
@@ -2256,6 +2254,7 @@ out:
 	dprintk("%s end (err:%d)\n", __func__, status);
 	return status;
 out_unlock:
+	pnfs_layoutcommit_free(data);
 	spin_unlock(&nfsi->lo_lock);
 	goto out;
 }
-- 
1.6.2.5


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

* Re: [PATCH] nfs41: Free layoutcommit_data when error occurs in setup
       [not found] ` <20100506071656.GA2746-nK6E9TRyOkVSq9BJjBFyUp/QNRX+jHPU@public.gmane.org>
@ 2010-05-06 21:16   ` Benny Halevy
  0 siblings, 0 replies; 2+ messages in thread
From: Benny Halevy @ 2010-05-06 21:16 UTC (permalink / raw)
  To: Zhang Jingwang; +Cc: linux-nfs

On May. 06, 2010, 10:18 +0300, Zhang Jingwang <zhangjingwang-U4AKAne5IzAR5TUyvShJeg@public.gmane.org> wrote:
> When layout driver cannot setup layoutcommit_data, we should free
> layoutcommit_data data structure before we return.
> 
> Signed-off-by: Zhang Jingwang <zhangjingwang-U4AKAne5IzAR5TUyvShJeg@public.gmane.org>

Committed to pnfs-submit and pnfs-all-2.6.33. Thanks!

Benny

> ---
>  fs/nfs/pnfs.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index e17efcc..1018bc6 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -2226,10 +2226,8 @@ pnfs_layoutcommit_inode(struct inode *inode, int sync)
>  		return -ENOMEM;
>  
>  	spin_lock(&nfsi->lo_lock);
> -	if (!nfsi->layoutcommit_ctx) {
> -		pnfs_layoutcommit_free(data);
> +	if (!nfsi->layoutcommit_ctx)
>  		goto out_unlock;
> -	}
>  
>  	data->args.inode = inode;
>  	data->cred  = nfsi->layoutcommit_ctx->cred;
> @@ -2256,6 +2254,7 @@ out:
>  	dprintk("%s end (err:%d)\n", __func__, status);
>  	return status;
>  out_unlock:
> +	pnfs_layoutcommit_free(data);
>  	spin_unlock(&nfsi->lo_lock);
>  	goto out;
>  }

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

end of thread, other threads:[~2010-05-06 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-06  7:18 [PATCH] nfs41: Free layoutcommit_data when error occurs in setup Zhang Jingwang
     [not found] ` <20100506071656.GA2746-nK6E9TRyOkVSq9BJjBFyUp/QNRX+jHPU@public.gmane.org>
2010-05-06 21:16   ` 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.