Bug 764835 (GLUSTER-3103) - memleak in inode table creation
Summary: memleak in inode table creation
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: GLUSTER-3103
Product: GlusterFS
Classification: Community
Component: core
Version: mainline
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Raghavendra Bhat
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-28 13:35 UTC by Raghavendra Bhat
Modified: 2011-07-12 06:19 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Regression: RTNR
Mount Type: ---
Documentation: DNR
CRM:
Verified Versions:


Attachments (Terms of Use)

Description Raghavendra Bhat 2011-06-28 13:35:42 UTC
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;
	}

Comment 1 Anand Avati 2011-07-01 05:26:20 UTC
PATCH: http://patches.gluster.com/patch/7701 in master (inode table: avoid memleak by freeing the allocated structures incase of failure)

Comment 2 Raghavendra Bhat 2011-07-04 03:31:46 UTC
Its fixed now. The new patch submitted takes care of freeing the allocated pools or structures in case of failure and exiting.

Comment 3 Raghavendra Bhat 2011-07-06 04:27:28 UTC
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.

Comment 4 Anand Avati 2011-07-12 03:19:04 UTC
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)


Note You need to log in before you can comment on or make changes to this bug.