When layout driver cannot setup layoutcommit_data, we should free
layoutcommit_data data structure before we return.
Signed-off-by: Zhang Jingwang <[email protected]>
---
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
On May. 06, 2010, 10:18 +0300, Zhang Jingwang <[email protected]> wrote:
> When layout driver cannot setup layoutcommit_data, we should free
> layoutcommit_data data structure before we return.
>
> Signed-off-by: Zhang Jingwang <[email protected]>
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;
> }