5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
32 .
$STF_SUITE/include
/libtest.shlib
36 # Verify file link count is zero on zfs
39 # 1. Make sure this test executes on multi-processes system
40 # 2. Make zero size files and remove them in the background
42 # 4. Make sure the files can be removed successfully
45 verify_runnable
"both"
47 log_assert
"Verify file link count is zero on zfs"
52 # Detect and make sure this test must be executed on a multi-process system
53 is_mp || log_fail
"This test requires a multi-processor system."
55 log_must mkdir
-p ${TESTDIR}/tmp
58 while [ $i -lt $NUMFILES ]; do
60 touch ${TESTDIR}/tmp
/x
$i > /dev
/null
2>&1
65 rm -f ${TESTDIR}/tmp
/x
* >/dev
/null
2>&1
67 rm_lnkcnt_zero_file
${TESTDIR}/tmp
/test$$
> /dev
/null
2>&1 &
69 log_note
"rm_lnkcnt_zero_file ${TESTDIR}/tmp/test$$ pid: $PID"
72 while [ $i -lt $ITERS ]; do
73 if ! pgrep rm_lnkcnt_zero_file
> /dev
/null
; then
74 log_note
"rm_lnkcnt_zero_file completes"
81 if pgrep rm_lnkcnt_zero_file
> /dev
/null
; then
82 log_must
kill -TERM $PID
83 log_fail
"file link count is zero"
86 log_must
kill -TERM $PID
87 log_must
rm -f ${TESTDIR}/tmp
/test$$
*
89 log_pass
"Verify file link count is zero on zfs"