[pnfs] [PATCH 5/5] cleanup: pnfs_initialize error case

Benny Halevy bhalevy at panasas.com
Thu Aug 30 06:55:40 EDT 2007


need to kmem_cache_destroy(pnfs_cachep) before returning
if pnfs_layoutcommit_mempool mempool_create failes

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/pnfs.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 53410be..aa7afa3 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -149,8 +149,10 @@ pnfs_initialize(void)
 						   mempool_alloc_slab,
 						   mempool_free_slab,
 						   pnfs_cachep);
-	if (pnfs_layoutcommit_mempool == NULL)
+	if (pnfs_layoutcommit_mempool == NULL) {
+		kmem_cache_destroy(pnfs_cachep);
 		return -ENOMEM;
+	}
 
 	pnfs_initialized = 1;
 	return 0;
-- 
1.5.2.5




More information about the pNFS mailing list