From 87d03fa7f48af6500cb8277db96ee7f6c690ea1c Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Wed, 27 Feb 2013 17:55:47 +0530 Subject: glusterd: Removed fd leaks in glusterfs_start utility function PROBLEM: The FILE* associated with the pidfile was leaked if pmap_registry_search on the brickinfo' path failed. FIX: Eliminates the use of the FILE* that was leaked. Uses glusterd_is_service_running utility function in place of the earlier attempt to check for the same. Change-Id: I94082bd5a94b8a6340f8cc11726d3264e364efe6 BUG: 916549 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/4596 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Anand Avati --- tests/bugs/bug-916549.t | 19 +++++++++++++++++++ tests/include.rc | 6 ++++++ 2 files changed, 25 insertions(+) create mode 100755 tests/bugs/bug-916549.t (limited to 'tests') diff --git a/tests/bugs/bug-916549.t b/tests/bugs/bug-916549.t new file mode 100755 index 000000000..d6a45b827 --- /dev/null +++ b/tests/bugs/bug-916549.t @@ -0,0 +1,19 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc + +cleanup; + +TEST glusterd; +TEST $CLI volume create $V0 $H0:$B0/${V0}1; +TEST $CLI volume start $V0; + +pid_file=$(ls /var/lib/glusterd/vols/$V0/run); +brick_pid=$(cat /var/lib/glusterd/vols/$V0/run/$pid_file); + + +kill -SIGKILL $brick_pid; +TEST $CLI volume start $V0 force; +TEST process_leak_count $(pidof glusterd); + +cleanup; diff --git a/tests/include.rc b/tests/include.rc index 03c615e5e..4008ad36f 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -214,6 +214,12 @@ function build_tester () gcc -g -o $(dirname $cfile)/$execname $cfile } +function process_leak_count () +{ + local pid=$1; + return $(ls -lh /proc/$pid/fd | grep "(deleted)"| wc -l) +} + alias EXPECT='_EXPECT $LINENO' alias TEST='_TEST $LINENO' alias EXPECT_WITHIN='_EXPECT_WITHIN $LINENO' -- cgit