From e70b127e059e4dacece24c61502a5e7175eeebf4 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Thu, 12 Mar 2020 13:48:46 -0400 Subject: [PATCH] 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 Signed-off-by: Ryan Moeller Closes #10112 --- tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh | 1 + tests/zfs-tests/tests/functional/write_dirs/setup.ksh | 4 +++- .../tests/functional/write_dirs/write_dirs_001_pos.ksh | 2 ++ .../tests/functional/write_dirs/write_dirs_002_pos.ksh | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh b/tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh index 3166bd6ec..e8bc8d514 100755 --- a/tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/write_dirs/cleanup.ksh @@ -32,3 +32,4 @@ . $STF_SUITE/include/libtest.shlib default_cleanup +rm -f $TEST_BASE_DIR/disk0 diff --git a/tests/zfs-tests/tests/functional/write_dirs/setup.ksh b/tests/zfs-tests/tests/functional/write_dirs/setup.ksh index 9e70fc47b..a14eab27e 100755 --- a/tests/zfs-tests/tests/functional/write_dirs/setup.ksh +++ b/tests/zfs-tests/tests/functional/write_dirs/setup.ksh @@ -33,4 +33,6 @@ verify_runnable "global" -default_setup "$DISKS" +DISK=$TEST_BASE_DIR/disk0 +truncate -s 2G $DISK +default_setup $DISK diff --git a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh index d8c82f722..881f78d58 100755 --- a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_001_pos.ksh @@ -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 } diff --git a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh index 29ef9eadf..a0bc4ce32 100755 --- a/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/write_dirs/write_dirs_002_pos.ksh @@ -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 }