From c30283fd2786dc24b6adf5aff8d39e24730b1a11 Mon Sep 17 00:00:00 2001 From: ShyamsundarR Date: Thu, 5 Jul 2018 14:44:04 -0400 Subject: io-stats: Terminate dump thread when dump interval is set to 0 _ios_dump_thread is not terminated by the function _ios_destroy_dump_thread when the diagnostic interval is set to 0 (which means disable auto dumping). During reconfigure, if the value changes from 0 to another then the thread is started, but on reconfiguring this to 0 the thread is not being terminated. Further, if the value is changed from 0 to X to 0 to Y, where X and Y are 2 arbitrary duration numbers, the reconfigure code ends up starting one more thread (for each change from 0 to a valid interval). This patch fixes the same by terminating the thread when the value changes from non-zero to 0. NOTE: It would seem nicer to use conf->dump_thread and check its value for thread presence etc. but there is no documented invalid value for the same, and hence an invalid check is not feasible, thus introducing a new running bool to determine the same. Fixes: bz#1598548 Change-Id: I3e7d2ce8f033879542932ac730d57bfcaf14af73 Signed-off-by: ShyamsundarR --- tests/bugs/io-stats/bug-1598548.t | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 tests/bugs/io-stats/bug-1598548.t (limited to 'tests/bugs') diff --git a/tests/bugs/io-stats/bug-1598548.t b/tests/bugs/io-stats/bug-1598548.t new file mode 100755 index 00000000000..19b0c053d08 --- /dev/null +++ b/tests/bugs/io-stats/bug-1598548.t @@ -0,0 +1,41 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../nfs.rc + +checkdumpthread () { + local brick_pid=$(get_brick_pid $1 $2 $3) + local thread_count=$(gstack $brick_pid | grep -c _ios_dump_thread) + echo $thread_count +} + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}0 +TEST $CLI volume start $V0 + +TEST $CLI volume profile $V0 start +EXPECT 0 checkdumpthread $V0 $H0 $B0/${V0}0 + +TEST $CLI volume set $V0 diagnostics.stats-dump-interval 3 +EXPECT 1 checkdumpthread $V0 $H0 $B0/${V0}0 + +TEST $CLI volume set $V0 diagnostics.stats-dump-interval 10 +EXPECT 1 checkdumpthread $V0 $H0 $B0/${V0}0 + +TEST $CLI volume set $V0 diagnostics.stats-dump-interval 0 +EXPECT 0 checkdumpthread $V0 $H0 $B0/${V0}0 + +TEST $CLI volume set $V0 diagnostics.stats-dump-interval 7 +EXPECT 1 checkdumpthread $V0 $H0 $B0/${V0}0 + +TEST $CLI volume set $V0 diagnostics.stats-dump-interval 0 +EXPECT 0 checkdumpthread $V0 $H0 $B0/${V0}0 + +TEST $CLI volume set $V0 diagnostics.stats-dump-interval 11 +EXPECT 1 checkdumpthread $V0 $H0 $B0/${V0}0 + +cleanup; -- cgit