From 3c04a91f5245708d0a148bf01cfdac1d0d59c797 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Sun, 24 Apr 2016 06:31:14 +0530 Subject: statedump: Prevent (null) typestr to be printed Problem: After the commits: 7e44c783ad731856956929f6614bbe045c26ea3a - lock: use spinlock only on multicore systems a6aecae2cd8171b8538bfe5d2800bdd157380b85 - nfs: fix lock variable type we see a lot of "[global.glusterfs - usage-type (null) memusage]" in statedump because lock status is not all-zeros after init, and the memcmp to check that a datatype is never allocated is invalid. Fix: Changed if a datatype is allocated or not check based on total_allocs. Also removed setting typestr to NULL on gf_free even when num_allocs is 0. Because even that is leading to 'null' memusage string to be printed in statedump. BUG: 1329870 Change-Id: If2b01a557cbdc787625db32e276e06cee3ac46ee Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/14054 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Niels de Vos --- tests/bugs/core/bug-834465.t | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/bugs/core/bug-834465.t b/tests/bugs/core/bug-834465.t index 4bdee83ed2d..e21e95393a6 100755 --- a/tests/bugs/core/bug-834465.t +++ b/tests/bugs/core/bug-834465.t @@ -25,7 +25,7 @@ nalloc1=0 grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump1 if [ $? -eq '0' ] then - nalloc1=`grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump1 | grep num_allocs | cut -d '=' -f2` + nalloc1=`grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump1 | grep -E "^num_allocs" | cut -d '=' -f2` fi build_tester $(dirname $0)/bug-834465.c @@ -34,11 +34,7 @@ TEST $(dirname $0)/bug-834465 $M0/testfile sdump2=$(generate_mount_statedump $V0); -# With _gf_free now setting typestr to NULL when num_allocs become 0, it is -# expected that there wouldn't be any entry for gf_common_mt_fd_lk_ctx_node_t -# in the statedump file now - -nalloc2=`grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump2 | wc -l` +nalloc2=`grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump2 | grep -E "^num_allocs" | cut -d '=' -f2` TEST [ $nalloc1 -eq $nalloc2 ]; TEST rm -rf $MOUNTDIR/* -- cgit