Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1724210

Summary: Incorrect power of two calculation in mem_pool_get_fn
Product: [Community] GlusterFS Reporter: Xavi Hernandez <jahernan>
Component: coreAssignee: Xavi Hernandez <jahernan>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6CC: atumball, bugs, nbalacha, rhinduja, rhs-bugs, sankarshan, storage-qa-internal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1722802 Environment:
Last Closed: 2019-07-03 06:28:15 UTC Type: ---
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: 1722802, 1748774    
Bug Blocks:    

Description Xavi Hernandez 2019-06-26 13:20:32 UTC
+++ This bug was initially created as a clone of Bug #1722802 +++

+++ This bug was initially created as a clone of Bug #1722801 +++

Description of problem:

The method used to calculate the power of two value for a type is off by 1 causing twice the required amount of memory to be allocated.
For example, cComparing the information for inode_t in statedumps from 3.4.4 and 3.5.0:

3.4.4:
------

pool-name=inode_t                                                               
active-count=15408                                                              
sizeof-type=168                                                                 
padded-sizeof=256                                                               
size=3944448                                                                    
shared-pool=0x7fac27a7b468                                                      
-----=-----                



3.5.0:
------
pool-name=inode_t                                                               
active-count=2                                                                  
sizeof-type=255     <--- actual sizeof inode_t is 168                                                               
padded-sizeof=512   <--- padded size is twice the required amount                                                            
size=1024                                                                       
shared-pool=0x7f1103b5b6d0





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

How reproducible:


Steps to Reproduce:
1. Create volume, fuse mount it and create some files and dirs on it
2. Take a statedump of the gluster mount process (kill -SIGUSR1 <pid>)
3. Compare the sizeof-type and padded-sizeof values in the state releases.

Actual results:
The padded-sizeof is twice the smallest power of two value for sizeof-type + sizeof(obj header)

Expected results:

The padded-sizeof should be the smallest power of two value for sizeof-type + sizeof(obj header)


Additional info:

Comment 1 Worker Ant 2019-06-26 13:53:43 UTC
REVIEW: https://review.gluster.org/22951 (mem-pool: remove dead code.) posted (#1) for review on release-6 by Xavi Hernandez

Comment 2 Worker Ant 2019-06-26 13:55:12 UTC
REVIEW: https://review.gluster.org/22952 (core: fix hang issue in __gf_free) posted (#1) for review on release-6 by Xavi Hernandez

Comment 3 Worker Ant 2019-06-26 13:56:24 UTC
REVIEW: https://review.gluster.org/22953 (core: avoid dynamic TLS allocation when possible) posted (#1) for review on release-6 by Xavi Hernandez

Comment 4 Worker Ant 2019-06-26 13:57:33 UTC
REVIEW: https://review.gluster.org/22954 (mem-pool.{c|h}: minor changes) posted (#1) for review on release-6 by Xavi Hernandez

Comment 5 Worker Ant 2019-06-26 13:58:41 UTC
REVIEW: https://review.gluster.org/22955 (libglusterfs: Fix compilation when --disable-mempool is used) posted (#1) for review on release-6 by Xavi Hernandez

Comment 6 Worker Ant 2019-06-26 13:59:50 UTC
REVIEW: https://review.gluster.org/22956 (core: fix memory allocation issues) posted (#1) for review on release-6 by Xavi Hernandez

Comment 7 Worker Ant 2019-07-02 06:30:41 UTC
REVIEW: https://review.gluster.org/22951 (mem-pool: remove dead code.) merged (#2) on release-6 by Xavi Hernandez

Comment 8 Worker Ant 2019-07-02 07:27:46 UTC
REVIEW: https://review.gluster.org/22952 (core: fix hang issue in __gf_free) merged (#2) on release-6 by Xavi Hernandez

Comment 9 Worker Ant 2019-07-03 06:26:21 UTC
REVIEW: https://review.gluster.org/22953 (core: avoid dynamic TLS allocation when possible) merged (#3) on release-6 by hari gowtham

Comment 10 Worker Ant 2019-07-03 06:27:29 UTC
REVIEW: https://review.gluster.org/22954 (mem-pool.{c|h}: minor changes) merged (#3) on release-6 by hari gowtham

Comment 11 Worker Ant 2019-07-03 06:27:52 UTC
REVIEW: https://review.gluster.org/22955 (libglusterfs: Fix compilation when --disable-mempool is used) merged (#3) on release-6 by hari gowtham

Comment 12 Worker Ant 2019-07-03 06:28:15 UTC
REVIEW: https://review.gluster.org/22956 (core: fix memory allocation issues) merged (#3) on release-6 by hari gowtham