Bug 1541264

Summary: dht_layout_t leak in dht_populate_inode_for_dentry
Product: [Community] GlusterFS Reporter: Nithya Balachandran <nbalacha>
Component: distributeAssignee: Nithya Balachandran <nbalacha>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: mainlineCC: bugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-v4.1.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1541267 1541277 (view as bug list) Environment:
Last Closed: 2018-06-20 17:58:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1541267, 1541277    

Description Nithya Balachandran 2018-02-02 06:44:35 UTC
Description of problem:
dht_populate_inode_for_dentry does not check if the inode already has a layout set and overwrites the value each time without freeing the already existing layout.
This happens only in non-distributed volumes (where dht has a single child subvol).

Version-Release number of selected component (if applicable):


How reproducible:
Consistently

Steps to Reproduce:

1.Create a 1x2 volume 
2.Fuse mount the volume and create 5 directories in the root of the volume.
mkdir dir-{1..5}
3. Take a statedump of the mount process.
4. Run ls -lR in a loop.
for i in {1..10000}; do ls -lR; done
5. After the loop completes, take another statedump of the mount process and compare the values for usage-type gf_dht_mt_dht_layout_t memusage


Actual results:

With the latest upstream master:

Before:
======
[cluster/distribute.leak-dht - usage-type gf_dht_mt_dht_layout_t memusage]          
size=456                                                                        
num_allocs=8                                                                    
max_size=584                                                                    
max_num_allocs=10                                                               
total_allocs=21


After:
=====
[cluster/distribute.leak-dht - usage-type gf_dht_mt_dht_layout_t memusage]          
size=10240520                                                                    
num_allocs=160009                                                               
max_size=10240520                                                               
max_num_allocs=160009                                                           
total_allocs=160027 




Expected results:

No leak

Additional info:

----------------------------------------------------------------------
Results after commenting out the call to dht_populate_inode_for_dentry
----------------------------------------------------------------------

Before:
=======

[cluster/distribute.leak-dht - usage-type gf_dht_mt_dht_layout_t memusage]          
size=456                                                                        
num_allocs=8                                                                    
max_size=456                                                                    
max_num_allocs=8                                                                
total_allocs=8


After:
======
[cluster/distribute.leak-dht - usage-type gf_dht_mt_dht_layout_t memusage]          
size=456                                                                        
num_allocs=8                                                                    
max_size=456                                                                    
max_num_allocs=8                                                                
total_allocs=8 

--------------------------------------------------------------

Comment 1 Worker Ant 2018-02-02 07:10:49 UTC
REVIEW: https://review.gluster.org/19458 (cluster/dht: Fixed leak in dht_populate_inode_for_dentry) posted (#1) for review on master by N Balachandran

Comment 2 Worker Ant 2018-02-02 12:23:19 UTC
COMMIT: https://review.gluster.org/19458 committed in master by "Shyamsundar Ranganathan" <srangana> with a commit message- cluster/dht: Fixed leak in dht_populate_inode_for_dentry

Fixed an issue in dht_populate_inode_for_dentry where a layout is
set in the inode without checking if it is already set. This overwrites
the value each time without freeing the already existing layout.

Change-Id: I651bf539a0b82b4ddc4c355890c16a8e91f5f1fd
BUG: 1541264
Signed-off-by: N Balachandran <nbalacha>

Comment 3 Worker Ant 2018-02-02 13:05:34 UTC
REVIEW: https://review.gluster.org/19471 (cluster/dht: Fixed a leak in inode_ref) posted (#1) for review on master by N Balachandran

Comment 4 Worker Ant 2018-02-02 18:46:37 UTC
COMMIT: https://review.gluster.org/19471 committed in master by "Amar Tumballi" <amarts> with a commit message- cluster/dht: Fixed a leak in inode_ref

Introduced by commit d9f773ba719397c128

Change-Id: I3f3103a5a80daed7562ace72e5aa53b77e74fb94
BUG: 1541264
Signed-off-by: N Balachandran <nbalacha>

Comment 5 Shyamsundar 2018-06-20 17:58:44 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-v4.1.0, please open a new bug report.

glusterfs-v4.1.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] http://lists.gluster.org/pipermail/announce/2018-June/000102.html
[2] https://www.gluster.org/pipermail/gluster-users/