From d8244d34bdc3e7b864e0152b55477fa61dae3e90 Mon Sep 17 00:00:00 2001 From: Tom Caputi Date: Wed, 7 Nov 2018 19:59:27 -0500 Subject: [PATCH] ZTS: Fix and reenable zfs_rename tests zfs_rename_006_pos has been flaky in the past because it was missing a call to block_device_wait to ensure the zvols it creates are present before running dd. Whenever this this happened, zfs_rename_009_neg would also fail because the first test would leak a zvol clone that it did not know how to clean up. This patch fixes the root cause and reenables the test. It also fixes some minor grammar errors. Reviewed-by: Brian Behlendorf Signed-off-by: Tom Caputi Closes #5647 Closes #5648 Closes #8088 --- tests/test-runner/bin/zts-report.py | 2 -- .../cli_root/zfs_rename/zfs_rename_006_pos.ksh | 1 + .../cli_root/zfs_rename/zfs_rename_009_neg.ksh | 14 +++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/test-runner/bin/zts-report.py b/tests/test-runner/bin/zts-report.py index 6d5c2b0d84..9502956017 100755 --- a/tests/test-runner/bin/zts-report.py +++ b/tests/test-runner/bin/zts-report.py @@ -214,8 +214,6 @@ maybe = { 'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason], 'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason], 'cli_root/zfs_get/zfs_get_009_pos': ['SKIP', '5479'], - 'cli_root/zfs_rename/zfs_rename_006_pos': ['FAIL', '5647'], - 'cli_root/zfs_rename/zfs_rename_009_neg': ['FAIL', '5648'], 'cli_root/zfs_rollback/zfs_rollback_001_pos': ['FAIL', '6415'], 'cli_root/zfs_rollback/zfs_rollback_002_pos': ['FAIL', '6416'], 'cli_root/zfs_share/setup': ['SKIP', share_reason], diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_006_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_006_pos.ksh index a7cba349f1..3ad7d4e805 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_006_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_006_pos.ksh @@ -69,6 +69,7 @@ rename_dataset ${vol}-new $vol clone=$TESTPOOL/${snap}_clone create_clone $vol@$snap $clone +block_device_wait #verify data integrity for input in $VOL_R_PATH $ZVOL_RDEVDIR/$clone; do diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_009_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_009_neg.ksh index 1bdaebdb03..7e8119766b 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_009_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_009_neg.ksh @@ -33,13 +33,13 @@ # # DESCRIPTION: -# A snapshot already exists with the new name, then none of the -# snapshots is renamed. +# When renaming a set of snapshots, if a snapshot already exists with +# the new name, then none of the snapshots is renamed. # # STRATEGY: -# 1. Create snapshot for a set of datasets. +# 1. Create a snapshot for a set of datasets. # 2. Create a new snapshot for one of datasets. -# 3. Using rename -r command with exists snapshot name. +# 3. Attempt to "zfs rename -r" with the second snapshot's name. # 4. Verify none of the snapshots is renamed. # @@ -54,7 +54,7 @@ function cleanup done } -log_assert "zfs rename -r failed, when snapshot name is already existing." +log_assert "Verify zfs rename -r failed when the snapshot name already exists." log_onexit cleanup set -A datasets $TESTPOOL $TESTPOOL/$TESTCTR \ @@ -71,7 +71,7 @@ while ((i < ${#datasets[@]})); do log_mustnot zfs rename -r ${TESTPOOL}@snap ${TESTPOOL}@snap2 log_must zfs destroy ${datasets[$i]}@snap2 - # Check datasets, make sure none of them was renamed. + # Check datasets, make sure none of them have snap2. typeset -i j=0 while ((j < ${#datasets[@]})); do if datasetexists ${datasets[$j]}@snap2 ; then @@ -83,4 +83,4 @@ while ((i < ${#datasets[@]})); do ((i += 1)) done -log_pass "zfs rename -r failed, when snapshot name is already existing passed." +log_pass "zfs rename -r failed when the snapshot name already exists."