ZTS: Wait for free space between write_dirs tests

Cleanup for write_dirs involves destroying a dataset filling a pool
and then recreating the dataset for the next test.  Due to the
asynchronous nature of free space accounting, recreating the dataset
can fail for lack of space, causing problems for the next test.

Add wait_freeing $TESTPOOL to wait for the space to be freed and then
sync_pool $TESTPOOL to update the space accounting before attempting
to recreate the test filesystem.

Only use a single disk to create the pool.  Make it a small file so it
does not take too long to fill.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10112
This commit is contained in:
Ryan Moeller 2020-03-12 13:48:46 -04:00 committed by GitHub
parent e6b28efccc
commit e70b127e05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 1 deletions

View File

@ -32,3 +32,4 @@
. $STF_SUITE/include/libtest.shlib . $STF_SUITE/include/libtest.shlib
default_cleanup default_cleanup
rm -f $TEST_BASE_DIR/disk0

View File

@ -33,4 +33,6 @@
verify_runnable "global" verify_runnable "global"
default_setup "$DISKS" DISK=$TEST_BASE_DIR/disk0
truncate -s 2G $DISK
default_setup $DISK

View File

@ -48,6 +48,8 @@ verify_runnable "both"
function cleanup function cleanup
{ {
destroy_dataset $TESTPOOL/$TESTFS destroy_dataset $TESTPOOL/$TESTFS
wait_freeing $TESTPOOL
sync_pool $TESTPOOL
zfs create -o mountpoint=$TESTDIR $TESTPOOL/$TESTFS zfs create -o mountpoint=$TESTDIR $TESTPOOL/$TESTFS
} }

View File

@ -48,6 +48,8 @@ verify_runnable "both"
function cleanup function cleanup
{ {
destroy_dataset $TESTPOOL/$TESTFS destroy_dataset $TESTPOOL/$TESTFS
wait_freeing $TESTPOOL
sync_pool $TESTPOOL
zfs create -o mountpoint=$TESTDIR $TESTPOOL/$TESTFS zfs create -o mountpoint=$TESTDIR $TESTPOOL/$TESTFS
} }