diff mbox series

fstests: btrfs/011 increase the runtime for replace cancel

Message ID 01796d6bcec40ae80b5af3269e60a66cd4b89262.1638382763.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series fstests: btrfs/011 increase the runtime for replace cancel | expand

Commit Message

Josef Bacik Dec. 1, 2021, 6:19 p.m. UTC
This test exercises the btrfs replace cancel path, but in order to do
this we have to have enough work to do in order to successfully cancel
the balance, otherwise the test fails because the operation has
completed before we're able to cancel.  This test has a very low pass
rate because we do not generate a large enough file system for replace
to have enough work, passing around 5% of the time.  Increase the time
spent to 10x the time we wait for the replace to start its work before
we cancel, this allows us to consistently pass this test.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/btrfs/011 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

David Sterba Dec. 6, 2021, 6:35 p.m. UTC | #1
On Wed, Dec 01, 2021 at 01:19:35PM -0500, Josef Bacik wrote:
> This test exercises the btrfs replace cancel path, but in order to do
> this we have to have enough work to do in order to successfully cancel
> the balance, otherwise the test fails because the operation has
> completed before we're able to cancel.  This test has a very low pass
> rate because we do not generate a large enough file system for replace
> to have enough work, passing around 5% of the time.  Increase the time
> spent to 10x the time we wait for the replace to start its work before
> we cancel, this allows us to consistently pass this test.

I've seen the test to pass most of the time but that it still fails
depending on the load is annoying and requires checking the results. So
even if it's probably a workaround (not sure we can make it 100%
reliable without peeking into the internals) it's making things better.

Acked-by: David Sterba <dsterba@suse.com>
diff mbox series

Patch

diff --git a/tests/btrfs/011 b/tests/btrfs/011
index b4673341..78e58a38 100755
--- a/tests/btrfs/011
+++ b/tests/btrfs/011
@@ -59,6 +59,7 @@  wait_time=1
 fill_scratch()
 {
 	local fssize=$1
+	local with_cancel=$2
 	local filler_pid
 
 	# Fill inline extents.
@@ -87,7 +88,11 @@  fill_scratch()
 	$XFS_IO_PROG -f -d -c "pwrite -b 64k 0 1E" "$SCRATCH_MNT/t_filler" &>\
 		$tmp.filler_result &
 	filler_pid=$!
-	sleep $((2 * $wait_time))
+	if [ "${with_cancel}" = "cancel" ]; then
+		sleep $((10 * $wait_time))
+	else
+		sleep $((2 * $wait_time))
+	fi
 	kill -KILL $filler_pid &> /dev/null
 	wait $filler_pid &> /dev/null
 
@@ -124,7 +129,7 @@  workout()
 	_scratch_mount
 	_require_fs_space $SCRATCH_MNT $((2 * 512 * 1024)) #2.5G
 
-	fill_scratch $fssize
+	fill_scratch $fssize $with_cancel
 	_run_btrfs_util_prog filesystem show -m $SCRATCH_MNT
 
 	echo -e "Replace from $source_dev to $SPARE_DEV\\n" >> $seqres.full