Skip to content
Permalink
Browse files

ZTS: Catalog tunable names for tests in tunables.cfg

Update tests to use the variables for tunable names.

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Kjeld Schouten <kjeld@schouten-lebbing.nl>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9831
  • Loading branch information
freqlabs authored and behlendorf committed Jan 14, 2020
1 parent 61152d1 commit 2476f103069e83e17d2c9cec4191af34a7996885
Showing with 434 additions and 366 deletions.
  1. +1 −0 tests/zfs-tests/include/Makefile.am
  2. +30 −7 tests/zfs-tests/include/libtest.shlib
  3. +81 −0 tests/zfs-tests/include/tunables.cfg
  4. +8 −8 tests/zfs-tests/tests/functional/arc/arcstats_runtime_tuning.ksh
  5. +3 −3 tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies.kshlib
  6. +8 −8 tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_clone_livelist_condense_and_disable.ksh
  7. +14 −14 tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_clone_livelist_condense_races.ksh
  8. +0 −17 tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy.cfg
  9. +3 −3 tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_clone_livelist.ksh
  10. +7 −7 tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_dev_removal_condense.ksh
  11. +3 −3 tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_014_neg.ksh
  12. +2 −2 tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh
  13. +6 −6 tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh
  14. +1 −1 tests/zfs-tests/tests/functional/cli_root/zpool_import/cleanup.ksh
  15. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_device_replaced.ksh
  16. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_config_changed.ksh
  17. +4 −4 tests/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_device_replaced.ksh
  18. +7 −7 tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.kshlib
  19. +2 −2 tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata4.ksh
  20. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_verify_initialized.ksh
  21. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver_restart.ksh
  22. +1 −1 tests/zfs-tests/tests/functional/cli_root/zpool_scrub/cleanup.ksh
  23. +2 −2 tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_002_pos.ksh
  24. +2 −2 tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_003_pos.ksh
  25. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_004_pos.ksh
  26. +2 −2 tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_print_repairing.ksh
  27. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_resilver.ksh
  28. +9 −9 tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_partial.ksh
  29. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_verify_trimmed.ksh
  30. +2 −2 tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/zpool_wait_replace_cancel.ksh
  31. +2 −2 tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/zpool_wait_scrub_cancel.ksh
  32. +2 −2 tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/zpool_wait_scrub_flag.ksh
  33. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_discard.ksh
  34. +9 −9 tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_freeing.ksh
  35. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_initialize_basic.ksh
  36. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_initialize_cancel.ksh
  37. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_initialize_flag.ksh
  38. +5 −5 tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_multiple.ksh
  39. +3 −3 tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_remove.ksh
  40. +2 −2 tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_remove_cancel.ksh
  41. +6 −6 tests/zfs-tests/tests/functional/deadman/deadman_sync.ksh
  42. +6 −6 tests/zfs-tests/tests/functional/deadman/deadman_zio.ksh
  43. +1 −1 tests/zfs-tests/tests/functional/delegate/cleanup.ksh
  44. +1 −1 tests/zfs-tests/tests/functional/delegate/setup.ksh
  45. +2 −8 tests/zfs-tests/tests/functional/fault/decompress_fault.ksh
  46. +6 −6 tests/zfs-tests/tests/functional/fault/zpool_status_-s.ksh
  47. +3 −3 tests/zfs-tests/tests/functional/features/async_destroy/async_destroy_001_pos.ksh
  48. +4 −4 tests/zfs-tests/tests/functional/log_spacemap/log_spacemap_import_logs.ksh
  49. +1 −1 tests/zfs-tests/tests/functional/mmp/cleanup.ksh
  50. +4 −4 tests/zfs-tests/tests/functional/mmp/mmp.kshlib
  51. +2 −2 tests/zfs-tests/tests/functional/mmp/mmp_inactive_import.ksh
  52. +9 −9 tests/zfs-tests/tests/functional/mmp/mmp_interval.ksh
  53. +5 −5 tests/zfs-tests/tests/functional/mmp/mmp_on_off.ksh
  54. +2 −2 tests/zfs-tests/tests/functional/mmp/mmp_on_thread.ksh
  55. +5 −5 tests/zfs-tests/tests/functional/mmp/mmp_on_uberblocks.ksh
  56. +18 −18 tests/zfs-tests/tests/functional/mmp/mmp_reset_interval.ksh
  57. +2 −2 tests/zfs-tests/tests/functional/mmp/mmp_write_distribution.ksh
  58. +3 −3 tests/zfs-tests/tests/functional/mmp/setup.ksh
  59. +4 −5 tests/zfs-tests/tests/functional/mount/umount_unlinked_drain.ksh
  60. +2 −2 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
  61. +3 −3 tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_discard_busy.ksh
  62. +1 −1 tests/zfs-tests/tests/functional/redacted_send/cleanup.ksh
  63. +3 −3 tests/zfs-tests/tests/functional/redacted_send/redacted.kshlib
  64. +3 −3 tests/zfs-tests/tests/functional/redacted_send/redacted_mounts.ksh
  65. +1 −1 tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh
  66. +1 −1 tests/zfs-tests/tests/functional/redacted_send/redacted_volume.ksh
  67. +3 −3 tests/zfs-tests/tests/functional/refquota/refquota_008_neg.ksh
  68. +2 −2 tests/zfs-tests/tests/functional/removal/removal.kshlib
  69. +2 −2 tests/zfs-tests/tests/functional/removal/removal_cancel.ksh
  70. +4 −4 tests/zfs-tests/tests/functional/removal/removal_condense_export.ksh
  71. +4 −4 tests/zfs-tests/tests/functional/removal/removal_multiple_indirection.ksh
  72. +2 −2 tests/zfs-tests/tests/functional/removal/removal_with_ganging.ksh
  73. +11 −11 tests/zfs-tests/tests/functional/resilver/resilver_restart_001.ksh
  74. +2 −2 tests/zfs-tests/tests/functional/rsend/send_hole_birth.ksh
  75. +3 −8 tests/zfs-tests/tests/functional/slog/slog_015_neg.ksh
  76. +1 −1 tests/zfs-tests/tests/functional/snapshot/cleanup.ksh
  77. +3 −3 tests/zfs-tests/tests/functional/snapshot/clone_001_pos.ksh
  78. +1 −1 tests/zfs-tests/tests/functional/snapshot/setup.ksh
  79. +10 −10 tests/zfs-tests/tests/functional/trim/autotrim_config.ksh
  80. +7 −7 tests/zfs-tests/tests/functional/trim/autotrim_integrity.ksh
  81. +7 −7 tests/zfs-tests/tests/functional/trim/autotrim_trim_integrity.ksh
  82. +10 −10 tests/zfs-tests/tests/functional/trim/trim_config.ksh
  83. +7 −7 tests/zfs-tests/tests/functional/trim/trim_integrity.ksh
  84. +2 −10 tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_volmode.ksh
  85. +1 −1 tests/zfs-tests/tests/perf/perf.shlib
@@ -5,6 +5,7 @@ dist_pkgdata_DATA = \
libtest.shlib \
math.shlib \
properties.shlib \
tunables.cfg \
zpool_script.shlib

EXTRA_DIST = default.cfg.in
@@ -34,6 +34,8 @@
. ${STF_SUITE}/include/math.shlib
. ${STF_SUITE}/include/blkdev.shlib

. ${STF_SUITE}/include/tunables.cfg

#
# Apply constrained path when available. This is required since the
# PATH may have been modified by sudo's secure_path behavior.
@@ -3713,7 +3715,7 @@ function swap_cleanup
#
# Set a global system tunable (64-bit value)
#
# $1 tunable name
# $1 tunable name (use a NAME defined in tunables.cfg)
# $2 tunable values
#
function set_tunable64
@@ -3724,7 +3726,7 @@ function set_tunable64
#
# Set a global system tunable (32-bit value)
#
# $1 tunable name
# $1 tunable name (use a NAME defined in tunables.cfg)
# $2 tunable values
#
function set_tunable32
@@ -3734,12 +3736,23 @@ function set_tunable32

function set_tunable_impl
{
typeset tunable="$1"
typeset name="$1"
typeset value="$2"
typeset mdb_cmd="$3"
typeset module="${4:-zfs}"

[[ -z "$tunable" ]] && return 1
eval "typeset tunable=\$$name"
case "$tunable" in
UNSUPPORTED)
log_unsupported "Tunable '$name' is unsupported on $(uname)"
;;
"")
log_fail "Tunable '$name' must be added to tunables.cfg"
;;
*)
;;
esac

[[ -z "$value" ]] && return 1
[[ -z "$mdb_cmd" ]] && return 1

@@ -3765,7 +3778,7 @@ function set_tunable_impl
#
# Get a global system tunable
#
# $1 tunable name
# $1 tunable name (use a NAME defined in tunables.cfg)
#
function get_tunable
{
@@ -3774,10 +3787,20 @@ function get_tunable

function get_tunable_impl
{
typeset tunable="$1"
typeset name="$1"
typeset module="${2:-zfs}"

[[ -z "$tunable" ]] && return 1
eval "typeset tunable=\$$name"
case "$tunable" in
UNSUPPORTED)
log_unsupported "Tunable '$name' is unsupported on $(uname)"
;;
"")
log_fail "Tunable '$name' must be added to tunables.cfg"
;;
*)
;;
esac

case "$(uname)" in
Linux)
@@ -0,0 +1,81 @@
# This file exports variables for each tunable used in the test suite.
#
# Different platforms use different names for most tunables. To avoid littering
# the tests with conditional logic for deciding how to set each tunable, the
# logic is instead consolidated to this one file.
#
# Any use of tunables in tests must use a name defined here. New entries
# should be added to the table as needed. Please keep the table sorted
# alphabetically for ease of maintenance.
#
# Platform-specific tunables should still use a NAME from this table for
# consistency. Enter UNSUPPORTED in the column for platforms on which the
# tunable is not implemented.

UNAME=$(uname)

# NAME FreeBSD tunable Linux tunable
cat <<%%%% |
ADMIN_SNAPSHOT UNSUPPORTED zfs_admin_snapshot
ALLOW_REDACTED_DATASET_MOUNT allow_redacted_dataset_mount zfs_allow_redacted_dataset_mount
ARC_MAX arc.max zfs_arc_max
ARC_MIN arc.min zfs_arc_min
ASYNC_BLOCK_MAX_BLOCKS async_block_max_blocks zfs_async_block_max_blocks
CHECKSUM_EVENTS_PER_SECOND checksum_events_per_second zfs_checksum_events_per_second
COMMIT_TIMEOUT_PCT commit_timeout_pct zfs_commit_timeout_pct
COMPRESSED_ARC_ENABLED compressed_arc_enabled zfs_compressed_arc_enabled
CONDENSE_INDIRECT_COMMIT_ENTRY_DELAY_MS condense.indirect_commit_entry_delay_ms zfs_condense_indirect_commit_entry_delay_ms
CONDENSE_MIN_MAPPING_BYTES condense.min_mapping_bytes zfs_condense_min_mapping_bytes
DBUF_CACHE_MAX_BYTES dbuf_cache.max_bytes dbuf_cache_max_bytes
DEADMAN_CHECKTIME_MS deadman_checktime_ms zfs_deadman_checktime_ms
DEADMAN_FAILMODE deadman_failmode zfs_deadman_failmode
DEADMAN_SYNCTIME_MS deadman_synctime_ms zfs_deadman_synctime_ms
DEADMAN_ZIOTIME_MS deadman_ziotime_ms zfs_deadman_ziotime_ms
DISABLE_IVSET_GUID_CHECK UNSUPPORTED zfs_disable_ivset_guid_check
INITIALIZE_CHUNK_SIZE initialize_chunk_size zfs_initialize_chunk_size
INITIALIZE_VALUE initialize_value zfs_initialize_value
KEEP_LOG_SPACEMAPS_AT_EXPORT keep_log_spacemaps_at_export zfs_keep_log_spacemaps_at_export
LIVELIST_CONDENSE_NEW_ALLOC livelist.condense.new_alloc zfs_livelist_condense_new_alloc
LIVELIST_CONDENSE_SYNC_CANCEL livelist.condense.sync_cancel zfs_livelist_condense_sync_cancel
LIVELIST_CONDENSE_SYNC_PAUSE livelist.condense.sync_pause zfs_livelist_condense_sync_pause
LIVELIST_CONDENSE_ZTHR_CANCEL livelist.condense.zthr_cancel zfs_livelist_condense_zthr_cancel
LIVELIST_CONDENSE_ZTHR_PAUSE livelist.condense.zthr_pause zfs_livelist_condense_zthr_pause
LIVELIST_MAX_ENTRIES livelist.max_entries zfs_livelist_max_entries
LIVELIST_MIN_PERCENT_SHARED livelist.min_percent_shared zfs_livelist_min_percent_shared
MAX_DATASET_NESTING max_dataset_nesting zfs_max_dataset_nesting
MAX_MISSING_TVDS max_missing_tvds zfs_max_missing_tvds
METASLAB_DEBUG_LOAD metaslab.debug_load metaslab_debug_load
METASLAB_FORCE_GANGING metaslab.force_ganging metaslab_force_ganging
MULTIHOST_FAIL_INTERVALS multihost.fail_intervals zfs_multihost_fail_intervals
MULTIHOST_HISTORY UNSUPPORTED zfs_multihost_history
MULTIHOST_IMPORT_INTERVALS multihost.import_intervals zfs_multihost_import_intervals
MULTIHOST_INTERVAL UNSUPPORTED zfs_multihost_interval
OVERRIDE_ESTIMATE_RECORDSIZE send.override_estimate_recordsize zfs_override_estimate_recordsize
REMOVAL_SUSPEND_PROGRESS removal_suspend_progress zfs_removal_suspend_progress
REMOVE_MAX_SEGMENT remove_max_segment zfs_remove_max_segment
RESILVER_MIN_TIME_MS resilver_min_time_ms zfs_resilver_min_time_ms
SCAN_SUSPEND_PROGRESS scan_suspend_progress zfs_scan_suspend_progress
SCAN_VDEV_LIMIT scan_vdev_limit zfs_scan_vdev_limit
SEND_HOLES_WITHOUT_BIRTH_TIME send_holes_without_birth_time send_holes_without_birth_time
SLOW_IO_EVENTS_PER_SECOND slow_io_events_per_second zfs_slow_io_events_per_second
SPA_ASIZE_INFLATION spa.asize_inflation spa_asize_inflation
SPA_DISCARD_MEMORY_LIMIT spa.discard_memory_limit zfs_spa_discard_memory_limit
SPA_LOAD_VERIFY_DATA spa.load_verify_data spa_load_verify_data
SPA_LOAD_VERIFY_METADATA spa.load_verify_metadata spa_load_verify_metadata
TRIM_EXTENT_BYTES_MIN trim.extent_bytes_min zfs_trim_extent_bytes_min
TRIM_METASLAB_SKIP trim.metaslab_skip zfs_trim_metaslab_skip
TRIM_TXG_BATCH trim.txg_batch zfs_trim_txg_batch
TXG_HISTORY UNSUPPORTED zfs_txg_history
TXG_TIMEOUT txg_timeout zfs_txg_timeout
UNLINK_SUSPEND_PROGRESS UNSUPPORTED zfs_unlink_suspend_progress
VDEV_MIN_MS_COUNT vdev.min_ms_count zfs_vdev_min_ms_count
VDEV_VALIDATE_SKIP vdev.validate_skip vdev_validate_skip
VOL_INHIBIT_DEV UNSUPPORTED zvol_inhibit_dev
VOL_MODE vol.mode zvol_volmode
VOL_RECURSIVE vol.recursive UNSUPPORTED
ZEVENT_LEN_MAX UNSUPPORTED zfs_zevent_len_max
ZIO_SLOW_IO_MS zio.slow_io_ms zio_slow_io_ms
%%%%
while read name FreeBSD Linux; do
eval "export ${name}=\$${UNAME}"
done
@@ -21,25 +21,25 @@ function cleanup
{
# Set tunables to their recorded actual size and then to their original
# value: this works for previously unconfigured tunables.
log_must set_tunable64 zfs_arc_min "$MINSIZE"
log_must set_tunable64 zfs_arc_min "$ZFS_ARC_MIN"
log_must set_tunable64 zfs_arc_max "$MAXSIZE"
log_must set_tunable64 zfs_arc_max "$ZFS_ARC_MAX"
log_must set_tunable64 ARC_MIN "$MINSIZE"
log_must set_tunable64 ARC_MIN "$ZFS_ARC_MIN"
log_must set_tunable64 ARC_MAX "$MAXSIZE"
log_must set_tunable64 ARC_MAX "$ZFS_ARC_MAX"
}

log_onexit cleanup

ZFS_ARC_MAX="$(get_tunable zfs_arc_max)"
ZFS_ARC_MIN="$(get_tunable zfs_arc_min)"
ZFS_ARC_MAX="$(get_tunable ARC_MAX)"
ZFS_ARC_MIN="$(get_tunable ARC_MIN)"
MINSIZE="$(get_min_arc_size)"
MAXSIZE="$(get_max_arc_size)"

log_assert "ARC tunables should be updated dynamically"

for size in $((MAXSIZE/4)) $((MAXSIZE/3)) $((MAXSIZE/2)) $MAXSIZE; do
log_must set_tunable64 zfs_arc_max "$size"
log_must set_tunable64 ARC_MAX "$size"
log_must test "$(get_max_arc_size)" == "$size"
log_must set_tunable64 zfs_arc_min "$size"
log_must set_tunable64 ARC_MIN "$size"
log_must test "$(get_min_arc_size)" == "$size"
done

@@ -108,11 +108,11 @@ function do_vol_test
if is_freebsd; then
# Pool creation on zvols is forbidden by default.
# Save and restore the current setting.
typeset _saved=$(get_tunable vol.recursive)
log_must set_tunable64 vol.recursive 1 # Allow
typeset _saved=$(get_tunable VOL_RECURSIVE)
log_must set_tunable64 VOL_RECURSIVE 1 # Allow
zpool create $TESTPOOL1 $vol_b_path
typeset _zpool_create_result=$?
log_must set_tunable64 vol.recursive $_saved # Restore
log_must set_tunable64 VOL_RECURSIVE $_saved # Restore
log_must test $_zpool_create_result = 0
else
log_must zpool create $TESTPOOL1 $vol_b_path
@@ -36,9 +36,9 @@ function cleanup
{
log_must zfs destroy -Rf $TESTPOOL/$TESTFS1
# reset the livelist sublist size to the original value
set_tunable64 $LIVELIST_MAX_ENTRIES $ORIGINAL_MAX
set_tunable64 LIVELIST_MAX_ENTRIES $ORIGINAL_MAX
# reset the minimum percent shared to 75
set_tunable32 $LIVELIST_MIN_PERCENT_SHARED $ORIGINAL_MIN
set_tunable32 LIVELIST_MIN_PERCENT_SHARED $ORIGINAL_MIN
}

function check_ll_len
@@ -58,9 +58,9 @@ function test_condense
{
# set the max livelist entries to a small value to more easily
# trigger a condense
set_tunable64 $LIVELIST_MAX_ENTRIES 20
set_tunable64 LIVELIST_MAX_ENTRIES 20
# set a small percent shared threshold so the livelist is not disabled
set_tunable32 $LIVELIST_MIN_PERCENT_SHARED 10
set_tunable32 LIVELIST_MIN_PERCENT_SHARED 10
clone_dataset $TESTFS1 snap $TESTCLONE

# sync between each write to make sure a new entry is created
@@ -86,7 +86,7 @@ function test_condense
function test_deactivated
{
# Threshold set to 50 percent
set_tunable32 $LIVELIST_MIN_PERCENT_SHARED 50
set_tunable32 LIVELIST_MIN_PERCENT_SHARED 50
clone_dataset $TESTFS1 snap $TESTCLONE

log_must mkfile 5m /$TESTPOOL/$TESTCLONE/$TESTFILE0
@@ -97,7 +97,7 @@ function test_deactivated
log_must zfs destroy -R $TESTPOOL/$TESTCLONE

# Threshold set to 20 percent
set_tunable32 $LIVELIST_MIN_PERCENT_SHARED 20
set_tunable32 LIVELIST_MIN_PERCENT_SHARED 20
clone_dataset $TESTFS1 snap $TESTCLONE

log_must mkfile 5m /$TESTPOOL/$TESTCLONE/$TESTFILE0
@@ -112,8 +112,8 @@ function test_deactivated
log_must zfs destroy -R $TESTPOOL/$TESTCLONE
}

ORIGINAL_MAX=$(get_tunable $LIVELIST_MAX_ENTRIES)
ORIGINAL_MIN=$(get_tunable $LIVELIST_MIN_PERCENT_SHARED)
ORIGINAL_MAX=$(get_tunable LIVELIST_MAX_ENTRIES)
ORIGINAL_MIN=$(get_tunable LIVELIST_MIN_PERCENT_SHARED)

log_onexit cleanup
log_must zfs create $TESTPOOL/$TESTFS1
@@ -38,10 +38,10 @@ function cleanup
{
log_must zfs destroy -Rf $TESTPOOL/$TESTFS1
# reset the livelist sublist size to the original value
set_tunable64 $LIVELIST_MAX_ENTRIES $ORIGINAL_MAX
set_tunable64 LIVELIST_MAX_ENTRIES $ORIGINAL_MAX
# reset the condense tests to 0
set_tunable32 $LIVELIST_CONDENSE_ZTHR_PAUSE 0
set_tunable32 $LIVELIST_CONDENSE_SYNC_PAUSE 0
set_tunable32 LIVELIST_CONDENSE_ZTHR_PAUSE 0
set_tunable32 LIVELIST_CONDENSE_SYNC_PAUSE 0
}

function delete_race
@@ -89,7 +89,7 @@ function disable_race
log_must zfs destroy $TESTPOOL/$TESTCLONE
}

ORIGINAL_MAX=$(get_tunable $LIVELIST_MAX_ENTRIES)
ORIGINAL_MAX=$(get_tunable LIVELIST_MAX_ENTRIES)

log_onexit cleanup

@@ -99,19 +99,19 @@ log_must zpool sync $TESTPOOL
log_must zfs snapshot $TESTPOOL/$TESTFS1@snap

# Reduce livelist size to trigger condense more easily
set_tunable64 $LIVELIST_MAX_ENTRIES 20
set_tunable64 LIVELIST_MAX_ENTRIES 20

# Test cancellation path in the zthr
set_tunable32 $LIVELIST_CONDENSE_ZTHR_PAUSE 1
set_tunable32 $LIVELIST_CONDENSE_SYNC_PAUSE 0
disable_race $LIVELIST_CONDENSE_ZTHR_CANCEL
delete_race $LIVELIST_CONDENSE_ZTHR_CANCEL
export_race $LIVELIST_CONDENSE_ZTHR_CANCEL
set_tunable32 LIVELIST_CONDENSE_ZTHR_PAUSE 1
set_tunable32 LIVELIST_CONDENSE_SYNC_PAUSE 0
disable_race LIVELIST_CONDENSE_ZTHR_CANCEL
delete_race LIVELIST_CONDENSE_ZTHR_CANCEL
export_race LIVELIST_CONDENSE_ZTHR_CANCEL

# Test cancellation path in the synctask
set_tunable32 $LIVELIST_CONDENSE_ZTHR_PAUSE 0
set_tunable32 $LIVELIST_CONDENSE_SYNC_PAUSE 1
disable_race $LIVELIST_CONDENSE_SYNC_CANCEL
delete_race $LIVELIST_CONDENSE_SYNC_CANCEL
set_tunable32 LIVELIST_CONDENSE_ZTHR_PAUSE 0
set_tunable32 LIVELIST_CONDENSE_SYNC_PAUSE 1
disable_race LIVELIST_CONDENSE_SYNC_CANCEL
delete_race LIVELIST_CONDENSE_SYNC_CANCEL

log_pass "Clone livelist condense race conditions passed."
@@ -37,20 +37,3 @@ export FSSNAP=$FS@$TESTSNAP
export VOLSNAP=$VOL@$TESTSNAP
export FSCLONE=$TESTPOOL/$TESTFSCLONE
export VOLCLONE=$TESTPOOL/$TESTVOLCLONE
if is_freebsd; then
export LIVELIST_MAX_ENTRIES=livelist.max_entries
export LIVELIST_MIN_PERCENT_SHARED=livelist.min_percent_shared
export LIVELIST_CONDENSE_NEW_ALLOC=livelist.condense.new_alloc
export LIVELIST_CONDENSE_ZTHR_CANCEL=livelist.condense.zthr_cancel
export LIVELIST_CONDENSE_SYNC_CANCEL=livelist.condense.sync_cancel
export LIVELIST_CONDENSE_ZTHR_PAUSE=livelist.condense.zthr_pause
export LIVELIST_CONDENSE_SYNC_PAUSE=livelist.condense.sync_pause
else
export LIVELIST_MAX_ENTRIES=zfs_livelist_max_entries
export LIVELIST_MIN_PERCENT_SHARED=zfs_livelist_min_percent_shared
export LIVELIST_CONDENSE_NEW_ALLOC=zfs_livelist_condense_new_alloc
export LIVELIST_CONDENSE_ZTHR_CANCEL=zfs_livelist_condense_zthr_cancel
export LIVELIST_CONDENSE_SYNC_CANCEL=zfs_livelist_condense_sync_cancel
export LIVELIST_CONDENSE_ZTHR_PAUSE=zfs_livelist_condense_zthr_pause
export LIVELIST_CONDENSE_SYNC_PAUSE=zfs_livelist_condense_sync_pause
fi
@@ -40,7 +40,7 @@ function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && zfs destroy -R $TESTPOOL/$TESTFS1
# reset the livelist sublist size to its original value
set_tunable64 $LIVELIST_MAX_ENTRIES $ORIGINAL_MAX
set_tunable64 LIVELIST_MAX_ENTRIES $ORIGINAL_MAX
}

function clone_write_file
@@ -120,15 +120,15 @@ function test_promote
log_must zfs destroy -R $TESTPOOL/$TESTCLONE
}

ORIGINAL_MAX=$(get_tunable $LIVELIST_MAX_ENTRIES)
ORIGINAL_MAX=$(get_tunable LIVELIST_MAX_ENTRIES)

log_onexit cleanup
log_must zfs create $TESTPOOL/$TESTFS1
log_must mkfile 20m /$TESTPOOL/$TESTFS1/atestfile
log_must zfs snapshot $TESTPOOL/$TESTFS1@snap

# set a small livelist entry size to more easily test multiple entry livelists
set_tunable64 $LIVELIST_MAX_ENTRIES 20
set_tunable64 LIVELIST_MAX_ENTRIES 20

test_one_empty
test_one

0 comments on commit 2476f10

Please sign in to comment.
You can’t perform that action at this time.