[PATCH] nfs41: Free layoutcommit_data when error occurs in setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Zhang Jingwang <zhangjingwang@xxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux