File tree Expand file tree Collapse file tree 9 files changed +34
-53
lines changed Expand file tree Collapse file tree 9 files changed +34
-53
lines changed Original file line number Diff line number Diff line change @@ -577,6 +577,11 @@ function corrupt_blocks_at_level # input_file corrupt_level
577
577
578
578
[[ -f $input_file ]] || log_fail "Couldn't find $input_file"
579
579
580
+ if is_freebsd; then
581
+ # Temporarily allow corrupting an inuse device.
582
+ debugflags=$(sysctl -n kern.geom.debugflags)
583
+ sysctl kern.geom.debugflags=16
584
+ fi
580
585
581
586
log_must list_file_blocks $input_file | \
582
587
while read level path offset length; do
@@ -586,6 +591,10 @@ function corrupt_blocks_at_level # input_file corrupt_level
586
591
fi
587
592
done
588
593
594
+ if is_freebsd; then
595
+ sysctl kern.geom.debugflags=$debugflags
596
+ fi
597
+
589
598
# This is necessary for pools made of loop devices.
590
599
sync
591
600
}
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ export SYSTEM_FILES_COMMON='arp
113
113
114
114
export SYSTEM_FILES_FREEBSD =' chflags
115
115
compress
116
+ diskinfo
116
117
dumpon
117
118
env
118
119
fsck
Original file line number Diff line number Diff line change @@ -54,9 +54,7 @@ verify_runnable "both"
54
54
55
55
function cleanup
56
56
{
57
- echo cleanup
58
- [[ -e $TESTDIR ]] && \
59
- log_must rm -rf $TESTDIR /* > /dev/null 2>&1
57
+ rm -fr $TESTDIR /*
60
58
}
61
59
62
60
log_assert " Create and read back files with using different checksum algorithms"
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ ZFS_TXG_TIMEOUT=""
60
60
function custom_cleanup
61
61
{
62
62
# Revert zfs_txg_timeout to defaults
63
- [[ -n ZFS_TXG_TIMEOUT ]] &&
63
+ [[ -n $ ZFS_TXG_TIMEOUT ]] &&
64
64
log_must set_zfs_txg_timeout $ZFS_TXG_TIMEOUT
65
65
log_must rm -rf $BACKUP_DEVICE_DIR
66
66
log_must set_tunable32 SCAN_SUSPEND_PROGRESS 0
Original file line number Diff line number Diff line change @@ -346,42 +346,11 @@ function set_zfs_max_missing_tvds
346
346
}
347
347
348
348
#
349
- # Use mdb to find the last txg that was synced in an active pool.
349
+ # Use zdb to find the last txg that was synced in an active pool.
350
350
#
351
351
function get_last_txg_synced
352
352
{
353
353
typeset pool=$1
354
354
355
- if is_linux; then
356
- txg=$(tail "/proc/spl/kstat/zfs/$pool/txgs" |
357
- awk '$3=="C" {print $1}' | tail -1)
358
- [[ "$txg" ]] || txg=0
359
- echo $txg
360
- return 0
361
- fi
362
-
363
- typeset spas
364
- spas=$(mdb -k -e "::spa")
365
- [[ $? -ne 0 ]] && return 1
366
-
367
- typeset spa=""
368
- print "$spas\n" | while read line; do
369
- typeset poolname=$(echo "$line" | awk '{print $3}')
370
- typeset addr=$(echo "$line" | awk '{print $1}')
371
- if [[ $poolname == $pool ]]; then
372
- spa=$addr
373
- break
374
- fi
375
- done
376
- if [[ -z $spa ]]; then
377
- log_fail "Couldn't find pool '$pool'"
378
- return 1
379
- fi
380
- typeset mdbcmd="$spa::print spa_t spa_ubsync.ub_txg | ::eval '.=E'"
381
- typeset -i txg
382
- txg=$(mdb -k -e "$mdbcmd")
383
- [[ $? -ne 0 ]] && return 1
384
-
385
- echo $txg
386
- return 0
355
+ zdb -u $pool | awk '$1 == "txg" { print $3 }' | sort -n | tail -n 1
387
356
}
Original file line number Diff line number Diff line change @@ -37,7 +37,11 @@ export TMP_HISTORY=$TEST_BASE_DIR/tmp_history.$$
37
37
export NEW_HISTORY =$TEST_BASE_DIR/new_history.$$
38
38
39
39
export MIGRATEDPOOLNAME =${MIGRATEDPOOLNAME:-history_pool}
40
- export TIMEZONE =${TIMEZONE:-US/Mountain}
40
+ if is_freebsd; then
41
+ export TIMEZONE =${TIMEZONE:-America/Denver}
42
+ else
43
+ export TIMEZONE =${TIMEZONE:-US/Mountain}
44
+ fi
41
45
42
46
export HIST_USER =" huser"
43
47
export HIST_GROUP =" hgroup"
Original file line number Diff line number Diff line change @@ -49,7 +49,11 @@ log_must rm $TESTDIR/ulimit_write_file $TESTDIR/ulimit_trunc_file
49
49
# Verify 'ulimit -f <size>' works
50
50
log_must ulimit -f 1024
51
51
log_mustnot sh -c ' dd if=/dev/zero of=$TESTDIR/ulimit_write_file bs=1M count=2'
52
- log_mustnot sh -c ' truncate -s2M $TESTDIR/ulimit_trunc_file'
53
- log_must rm $TESTDIR /ulimit_write_file $TESTDIR /ulimit_trunc_file
52
+ log_must rm $TESTDIR /ulimit_write_file
53
+ # FreeBSD allows the sparse file because space has not been allocated.
54
+ if ! is_freebsd; then
55
+ log_mustnot sh -c ' truncate -s2M $TESTDIR/ulimit_trunc_file'
56
+ log_must rm $TESTDIR /ulimit_trunc_file
57
+ fi
54
58
55
59
log_pass " Successfully enforced 'ulimit -f' maximum file size"
Original file line number Diff line number Diff line change @@ -67,19 +67,14 @@ log_must randwritecomp $SAMPLEFILE 25000
67
67
log_must zpool add -f $TESTPOOL $NOTREMOVEDISK
68
68
69
69
#
70
- # Start removal.
71
- #
72
- log_must zpool remove $TESTPOOL $REMOVEDISK
73
-
74
- #
75
- # Sleep a bit and hopefully allow removal to copy some data.
70
+ # Block removal.
76
71
#
77
- log_must sleep 1
72
+ log_must set_tunable32 REMOVAL_SUSPEND_PROGRESS 1
78
73
79
74
#
80
- # Block removal.
75
+ # Start removal.
81
76
#
82
- log_must set_tunable32 REMOVAL_SUSPEND_PROGRESS 1
77
+ log_must zpool remove $TESTPOOL $REMOVEDISK
83
78
84
79
#
85
80
# Only for debugging purposes in test logs.
Original file line number Diff line number Diff line change @@ -70,9 +70,10 @@ function verify_restarts # <msg> <cnt> <defer>
70
70
[[ -z " $defer " ]] && return
71
71
72
72
# use zdb to find which vdevs have the resilver defer flag
73
- VDEV_DEFERS=$( zdb -C $TESTPOOL | \
74
- sed -n -e ' /^ *children\[[0-9]\].*$/{h}' \
75
- -e ' / *com.datto:resilver_defer$/{g;p}' )
73
+ VDEV_DEFERS=$( zdb -C $TESTPOOL | awk '
74
+ /children/ { gsub(/[^0-9]/, ""); child = $0 }
75
+ /com\.datto:resilver_defer$/ { print child }
76
+ ' )
76
77
77
78
if [[ " $defer " == " -" ]]
78
79
then
@@ -81,7 +82,7 @@ function verify_restarts # <msg> <cnt> <defer>
81
82
return
82
83
fi
83
84
84
- [[ " x ${ VDEV_DEFERS} x " =~ " x +children[ $defer ]:x " ]] ||
85
+ [[ $ VDEV_DEFERS -eq $defer ]] ||
85
86
log_fail " resilver deferred set on unexpected vdev: $VDEV_DEFERS "
86
87
}
87
88
You can’t perform that action at this time.
0 commit comments