Hide Forgot
There is memory leak in the creation of inode table creation. If certain allocation such as dentry pool or inode hash fails, then we are simply returning instead of freeing all the previous allocations (such as inode pool). new->inode_pool = mem_pool_new (inode_t, lru_limit); if (!new->inode_pool) { GF_FREE (new); return NULL; } new->dentry_pool = mem_pool_new (dentry_t, lru_limit); if (!new->dentry_pool) { GF_FREE (new); return NULL; } new->inode_hash = (void *)GF_CALLOC (65536, sizeof (struct list_head), gf_common_mt_list_head); if (!new->inode_hash) { GF_FREE (new); return NULL; }
PATCH: http://patches.gluster.com/patch/7701 in master (inode table: avoid memleak by freeing the allocated structures incase of failure)
Its fixed now. The new patch submitted takes care of freeing the allocated pools or structures in case of failure and exiting.
There is a similar bug in fd_create also where if fd_ctx allocation fails then we are GF_FREEing the fd. But we have to put the fd back to the fd_mem_pool of the inode table.
PATCH: http://patches.gluster.com/patch/7763 in master (fd: put the fd back to fd_mem_pool of inode table instead of freeing in case of failure)