inuse_003_pos.ksh revision 447b1e1fca22e4de5e04623965fbb1460857930c
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# ZFS will not interfere with devices that are in use by ufsdump or
# ufsrestore.
#
# STRATEGY:
# 1. newfs a disk
# 2. mount the disk
# 3. create files and dirs on disk
# 4. umount the disk
# 5. ufsdump this disk to a backup disk
# 6. Try to create a ZFS pool with same disk (also as a spare device)
# 7. ufsrestore the disk from backup
# 8. try to create a zpool during the ufsrestore
#
verify_runnable "global"
function cleanup
{
log_note "Kill off ufsdump process if still running"
$KILL -0 $PIDUFSDUMP > /dev/null 2>&1 && \
log_must $KILL -9 $PIDUFSDUMP > /dev/null 2>&1
#
# Note: It would appear that ufsdump spawns a number of processes
# which are not killed when the $PIDUFSDUMP is whacked. So best bet
# is to find the rest of the them and deal with them individually.
#
do
done
log_note "Kill off ufsrestore process if still running"
$KILL -0 $PIDUFSRESTORE > /dev/null 2>&1 && \
log_must $KILL -9 $PIDUFSRESTORE > /dev/null 2>&1
#
# Tidy up the disks we used.
#
}
log_assert "Ensure ZFS does not interfere with devices that are in use by " \
"ufsdump or ufsrestore"
typeset bigdir="${UFSMP}/bigdirectory"
typeset restored_files="${UFSMP}/restored_files"
typeset -i dirnum=0
typeset -i filenum=0
typeset cwd=""
done
log_note "Now create some directories and files to be ufsdump'ed"
-b $BLOCK_SIZE -c $BLOCK_COUNT
if [[ $? -ne 0 ]]; then
log_fail "$FILE_WRITE only wrote" \
"files, this is not enough"
fi
fi
done
filenum=0
done
log_note "Start ufsdump in the background"
PIDUFSDUMP=$!
unset NOINUSE_CHECK
log_note "Attempt to zpool the source device in use by ufsdump"
log_note "Attempt to take the source device in use by ufsdump as spare device"
wait $PIDUFSDUMP
typeset -i retval=$?
log_note "Start ufsrestore in the background from the target device"
log_note "$UFSRESTORE rbf 512 $rawdisk0"
log_note "Attempt to zpool the restored device in use by ufsrestore"
log_note "Attempt to take the restored device in use by ufsrestore as spare" \
"device"
log_pass "Unable to zpool over a device in use by ufsdump or ufsrestore"