ZTS: Fix snapshot_009_pos, snapshot_010_pos

Mitigate the likelihood of the newly created volumes being busy
when the 'zfs destroy -r' is issued by waiting for udev to settle.
Since this is not a iron clad fix I've added the test case to
the known list of possible failures and referenced issue #7961.

Finally, in the case this test does fail fix the cleanup logic
so subsequent tests won't incorrectly fail.

Reviewed-by: Giuseppe Di Natale <guss80@gmail.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #7961 
Closes #7962
This commit is contained in:
Brian Behlendorf 2018-10-01 17:15:57 -07:00 committed by GitHub
parent 424fd7c3e0
commit 838bd5ff35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 10 deletions

View File

@ -264,6 +264,8 @@ maybe = {
'rsend/rsend_024_pos': ['FAIL', '5665'], 'rsend/rsend_024_pos': ['FAIL', '5665'],
'rsend/send-c_volume': ['FAIL', '6087'], 'rsend/send-c_volume': ['FAIL', '6087'],
'snapshot/clone_001_pos': ['FAIL', known_reason], 'snapshot/clone_001_pos': ['FAIL', known_reason],
'snapshot/snapshot_009_pos': ['FAIL', '7961'],
'snapshot/snapshot_010_pos': ['FAIL', '7961'],
'snapused/snapused_004_pos': ['FAIL', '5513'], 'snapused/snapused_004_pos': ['FAIL', '5513'],
'tmpfile/setup': ['SKIP', tmpfile_reason], 'tmpfile/setup': ['SKIP', tmpfile_reason],
'threadsappend/threadsappend_001_pos': ['FAIL', '6136'], 'threadsappend/threadsappend_001_pos': ['FAIL', '6136'],

View File

@ -642,7 +642,7 @@ function destroy_snapshot
typeset snap=${1:-$TESTPOOL/$TESTFS@$TESTSNAP} typeset snap=${1:-$TESTPOOL/$TESTFS@$TESTSNAP}
if ! snapexists $snap; then if ! snapexists $snap; then
log_fail "'$snap' does not existed." log_fail "'$snap' does not exist."
fi fi
# #

View File

@ -52,18 +52,15 @@ function cleanup
typeset snap typeset snap
for ds in $ctr/$TESTVOL1 $ctr/$TESTCLONE; do for ds in $ctr/$TESTVOL1 $ctr/$TESTCLONE; do
datasetexists $ds && \ destroy_dataset $ds "-rf"
log_must zfs destroy -f $ds
done done
for snap in $ctr/$TESTFS1@$TESTSNAP1 \ for snap in $ctr/$TESTFS1@$TESTSNAP1 \
$snappool $snapvol $snapctr $snapctrvol \ $snappool $snapvol $snapctr $snapctrvol \
$snapctrclone $snapctrfs $snapctrclone $snapctrfs
do do
snapexists $snap && \ snapexists $snap && destroy_dataset $snap "-rf"
log_must zfs destroy -rf $snap
done done
} }
log_assert "Verify snapshot -r can correctly create a snapshot tree." log_assert "Verify snapshot -r can correctly create a snapshot tree."
@ -91,6 +88,7 @@ else
fi fi
log_must zfs snapshot -r $snappool log_must zfs snapshot -r $snappool
log_must block_device_wait
#verify the snapshot -r results #verify the snapshot -r results
for snap in $snappool $snapfs $snapvol $snapctr $snapctrvol \ for snap in $snappool $snapfs $snapvol $snapctr $snapctrvol \

View File

@ -49,15 +49,13 @@ function cleanup
{ {
typeset snap typeset snap
datasetexists $ctrvol && \ destroy_dataset $ctrvol "-rf"
log_must zfs destroy -f $ctrvol
for snap in $ctrfs@$TESTSNAP1 \ for snap in $ctrfs@$TESTSNAP1 \
$snappool $snapvol $snapctr $snapctrvol \ $snappool $snapvol $snapctr $snapctrvol \
$snapctrclone $snapctrfs $snapctrclone $snapctrfs
do do
snapexists $snap && \ snapexists $snap && destroy_dataset $snap "-rf"
log_must zfs destroy -rf $snap
done done
} }
@ -85,6 +83,7 @@ else
fi fi
log_must zfs snapshot -r $snappool log_must zfs snapshot -r $snappool
log_must block_device_wait
#select the $TESTCTR as destroy point, $TESTCTR is a child of $TESTPOOL #select the $TESTCTR as destroy point, $TESTCTR is a child of $TESTPOOL
log_must zfs destroy -r $snapctr log_must zfs destroy -r $snapctr