Skip to content

Commit

Permalink
ZTS: Wait for free space between write_dirs tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Ryan Moeller authored Mar 12, 2020
1 parent e6b28ef commit e70b127
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@
. $STF_SUITE/include/libtest.shlib

default_cleanup
rm -f $TEST_BASE_DIR/disk0
4 changes: 3 additions & 1 deletion tests/zfs-tests/tests/functional/write_dirs/setup.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@

verify_runnable "global"

default_setup "$DISKS"
DISK=$TEST_BASE_DIR/disk0
truncate -s 2G $DISK
default_setup $DISK
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ verify_runnable "both"
function cleanup
{
destroy_dataset $TESTPOOL/$TESTFS
wait_freeing $TESTPOOL
sync_pool $TESTPOOL
zfs create -o mountpoint=$TESTDIR $TESTPOOL/$TESTFS
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ verify_runnable "both"
function cleanup
{
destroy_dataset $TESTPOOL/$TESTFS
wait_freeing $TESTPOOL
sync_pool $TESTPOOL
zfs create -o mountpoint=$TESTDIR $TESTPOOL/$TESTFS
}

Expand Down

0 comments on commit e70b127

Please sign in to comment.