ZTS: Test boundary conditions in alloc_class_012

Issue #9142 describes an error in the checks for device removal that
can prevent removal of special allocation class vdevs in some
situations.

Enhance alloc_class/alloc_class_012_pos to check situations where this
bug occurs.

Update zts-report with knowledge of issue #9142.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10116 
Issue #9142
This commit is contained in:
Ryan Moeller 2020-03-12 13:50:01 -04:00 committed by GitHub
parent e70b127e05
commit cdbc34fc2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 39 deletions

View File

@ -178,6 +178,8 @@ if sys.platform.startswith('freebsd'):
# reasons listed above can be used. # reasons listed above can be used.
# #
maybe = { maybe = {
'alloc_class/alloc_class_012_pos': ['FAIL', '9142'],
'alloc_class/alloc_class_013_pos': ['FAIL', '9142'],
'cache/cache_010_neg': ['FAIL', known_reason], 'cache/cache_010_neg': ['FAIL', known_reason],
'casenorm/mixed_formd_lookup': ['FAIL', '7633'], 'casenorm/mixed_formd_lookup': ['FAIL', '7633'],
'casenorm/mixed_formd_delete': ['FAIL', '7633'], 'casenorm/mixed_formd_delete': ['FAIL', '7633'],

View File

@ -57,21 +57,22 @@ if (match($0,"L0 [0-9]+")) {
}}' }}'
} }
claim="Removing a special device from a pool succeeds." #
# Check that device removal works for special class vdevs
log_assert $claim #
log_onexit cleanup function check_removal
{
# #
# Create a non-raidz pool so we can remove top-level vdevs # Create a non-raidz pool so we can remove top-level vdevs
# #
log_must disk_setup log_must disk_setup
log_must zpool create $TESTPOOL $ZPOOL_DISK0 $ZPOOL_DISK1 $ZPOOL_DISK2 \ log_must zpool create $TESTPOOL $ZPOOL_DISKS \
special $CLASS_DISK0 special $CLASS_DISK1 special $CLASS_DISK0 special $CLASS_DISK1
log_must display_status "$TESTPOOL" log_must display_status "$TESTPOOL"
# #
# Generate some metadata and small blocks in the special class before removal # Generate some metadata and small blocks in the special class vdev
# before removal
# #
typeset -l i=1 typeset -l i=1
typeset -l blocks=25 typeset -l blocks=25
@ -79,8 +80,8 @@ typeset -l blocks=25
log_must zfs create -o special_small_blocks=32K -o recordsize=32K \ log_must zfs create -o special_small_blocks=32K -o recordsize=32K \
$TESTPOOL/$TESTFS $TESTPOOL/$TESTFS
for i in 1 2 3 4; do for i in 1 2 3 4; do
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/testfile.$i bs=1M \ log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/testfile.$i \
count=$blocks bs=1M count=$blocks
((blocks = blocks + 25)) ((blocks = blocks + 25))
done done
log_must sync_pool $TESTPOOL log_must sync_pool $TESTPOOL
@ -89,7 +90,7 @@ log_must zpool list -v $TESTPOOL
# Verify the files were written in the special class vdevs # Verify the files were written in the special class vdevs
for i in 1 2 3 4; do for i in 1 2 3 4; do
dataset="$TESTPOOL/$TESTFS" dataset="$TESTPOOL/$TESTFS"
inum="$(stat -c '%i' /$TESTPOOL/$TESTFS/testfile.$i)" inum="$(get_objnum /$TESTPOOL/$TESTFS/testfile.$i)"
log_must file_in_special_vdev $dataset $inum log_must file_in_special_vdev $dataset $inum
done done
@ -102,5 +103,20 @@ sleep 1
log_must zdb -bbcc $TESTPOOL log_must zdb -bbcc $TESTPOOL
log_must zpool list -v $TESTPOOL log_must zpool list -v $TESTPOOL
log_must zpool destroy -f "$TESTPOOL" log_must zpool destroy -f "$TESTPOOL"
log_must disk_cleanup
}
claim="Removing a special device from a pool succeeds."
log_assert $claim
log_onexit cleanup
typeset CLASS_DEVSIZE=$CLASS_DEVSIZE
for CLASS_DEVSIZE in $CLASS_DEVSIZE $ZPOOL_DEVSIZE; do
typeset ZPOOL_DISKS=$ZPOOL_DISKS
for ZPOOL_DISKS in "$ZPOOL_DISKS" $ZPOOL_DISK0; do
check_removal
done
done
log_pass $claim log_pass $claim