Ensure a device can be added to a filesystem that has a paused balance operation and has been mounted with the 'skip_balance' mount option Signed-off-by: Nikolay Borisov <nborisov@xxxxxxxx> --- tests/btrfs/049 | 47 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/049.out | 1 + 2 files changed, 48 insertions(+) create mode 100755 tests/btrfs/049 diff --git a/tests/btrfs/049 b/tests/btrfs/049 new file mode 100755 index 000000000000..7f566ee112f1 --- /dev/null +++ b/tests/btrfs/049 @@ -0,0 +1,47 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2021 SUSE Linux Products GmbH. All Rights Reserved. +# +# FS QA Test 049 +# +# Ensure that it's possible to add a device when we have a paused balance +# and the filesystem is mounted with skip_balance. +# +. ./common/preamble +_begin_fstest quick balance auto + +# real QA test starts here + +_supported_fs btrfs +_require_scratch_dev_pool + +_scratch_mkfs >/dev/null +_scratch_mount + +uuid=$(findmnt -n -o UUID $SCRATCH_MNT) + +if [[ ! -e /sys/fs/btrfs/$uuid/exclusive_operation ]]; then + _notrun "Requires btrfs exclusive operation support" +fi + +dev1="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $2}'`" + +# Create some files on the so that balance doesn't complete instantly +args=`_scale_fsstress_args -z \ + -f write=10 -f creat=10 \ + -n 1000 -p 2 -d $SCRATCH_MNT/stress_dir` +echo "Run fsstress $args" >>$seqres.full +$FSSTRESS_PROG $args >/dev/null 2>&1 + +# Start and pause balance to ensure it will be restored on remount +echo "Start balance" >>$seqres.full +_run_btrfs_balance_start --full-balance --bg "$SCRATCH_MNT" +$BTRFS_UTIL_PROG balance pause "$SCRATCH_MNT" + +_scratch_cycle_mount "skip_balance" + +$BTRFS_UTIL_PROG device add -K -f $dev1 "$SCRATCH_MNT" + +echo "Silence is golden" +status=0 +exit diff --git a/tests/btrfs/049.out b/tests/btrfs/049.out index cb0061b33ff0..c69568ad9323 100644 --- a/tests/btrfs/049.out +++ b/tests/btrfs/049.out @@ -1 +1,2 @@ QA output created by 049 +Silence is golden -- 2.17.1