5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright (c) 2015 by Delphix. All rights reserved.
21 .
$STF_SUITE/include
/libtest.shlib
25 # While remapping all the files in a filesystem, ZFS should be able to
26 # concurrently perform ZPL operations (remove files, truncate files, etc).
29 # 1. Create a ZFS filesystem
30 # 2. Create many files.
31 # 3. Continually remap the filesystem while performing ZPL operations.
32 # 4. After the specified time duration, the system should not be panic.
35 verify_runnable
"both"
41 log_assert
"ZFS can handle ZPL operations during a remap."
43 default_setup_noexit
"$DISKS"
44 log_onexit default_cleanup_noexit
46 seq -f "$TESTDIR/file%g" $NUMFILES |
xargs touch || \
47 log_fail
"Unable to create test files."
49 function remove_random_file
51 typeset target
=$TESTDIR/file$
((RANDOM
% NUMFILES
))
52 if rm $target 2>/dev
/null
; then
53 touch $target || log_note
"Failure to re-create $target."
57 log_must
touch $TESTDIR/continue
58 for thread
in $
(seq $NUMTHREADS); do
59 (while [[ -f $TESTDIR/continue ]]; do
65 # Remove the first disk to ensure there is something to remap.
67 log_must zpool remove
$TESTPOOL ${DISKS/ */}
69 start
=$
(current_epoch
)
70 while (($
(current_epoch
) < start
+ TIMEOUT
)); do
71 zfs remap
$TESTPOOL/$TESTFS || \
72 log_fail
"Failure to remap $TESTPOOL/$TESTFS"
75 log_pass
"ZFS handles race as expected."