From 8f788528e64c4c13e16f7ad2d9f667a3813e08cc Mon Sep 17 00:00:00 2001 From: zhoushicheng Date: Fri, 10 Apr 2015 12:10:26 +0800 Subject: test: Fix sparse file self heal test This patch solves problems caused by XFS with speculative preallocation feature on : Test EXPECT "1" has_holes $B0/${V0}0/big2bigger would fall when XFS has not freed the preallocated blocks. It is caused by XFS speculative preallocation feature. The test would pass if this feature is disabled. Speculative preallocation can speed up under linux 3.8(and later). Otherwise, the test would pass by dropping cache manually to speed up speculative preallocation. As in http://review.gluster.org/#/c/10411/, using "( cd $M0 ; umount $M0 )" to drop caches, which is better than "echo 3 > /proc/sys/vm/drop_caches". drop caches operation was added in test: tests/basic/afr/sparse-file-self-heal.t BUG: 1206461 Change-Id: Ie2c9d1b92fa8307c44498752fdd100eb86f9689c Signed-off-by: zhoushicheng Reviewed-on: http://review.gluster.org/10253 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Ravishankar N Reviewed-by: Vijay Bellur --- tests/basic/afr/sparse-file-self-heal.t | 10 ++++++++++ tests/volume.rc | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/basic/afr/sparse-file-self-heal.t b/tests/basic/afr/sparse-file-self-heal.t index 1bc915e062c..a362494d95e 100644 --- a/tests/basic/afr/sparse-file-self-heal.t +++ b/tests/basic/afr/sparse-file-self-heal.t @@ -51,6 +51,11 @@ EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1 TEST gluster volume heal $V0 full EXPECT_WITHIN $HEAL_TIMEOUT "0" afr_get_pending_heal_count $V0 +#If the file system of bricks is XFS and speculative preallocation is on, +#dropping cahce should be done to free speculatively pre-allocated blocks +#by XFS. +( cd $M0 ; umount $M0 ) # fail but drops kernel cache + big_md5sum_0=$(md5sum $B0/${V0}0/big | awk '{print $1}') small_md5sum_0=$(md5sum $B0/${V0}0/small | awk '{print $1}') bigger2big_md5sum_0=$(md5sum $B0/${V0}0/bigger2big | awk '{print $1}') @@ -116,6 +121,11 @@ EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1 TEST gluster volume heal $V0 full EXPECT_WITHIN $HEAL_TIMEOUT "0" afr_get_pending_heal_count $V0 +#If the file system of bricks is XFS and speculative preallocation is on, +#dropping cahce should be done to free speculatively pre-allocated blocks +#by XFS. +( cd $M0 ; umount $M0 ) # fail but drops kernel cache + big_md5sum_0=$(md5sum $B0/${V0}0/big | awk '{print $1}') small_md5sum_0=$(md5sum $B0/${V0}0/small | awk '{print $1}') bigger2big_md5sum_0=$(md5sum $B0/${V0}0/bigger2big | awk '{print $1}') diff --git a/tests/volume.rc b/tests/volume.rc index 8c216f76166..5c5e28459c0 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -512,7 +512,6 @@ function cleanup_georep { $CLI volume geo-rep $GMV0 $H0::$GSV0 delete } - function num_graphs { local mountpoint=$1 -- cgit