- # Useful if running interactively, but not from the xfs test scripts
- #echo $ii
-
- # If the VFS lock patch is present, the calls to xfs_freeze
- # are redundant, but should cause no problems
- # OPTIONAL
- xfs_freeze -f "$SCRATCH_MNT"
- [ $? != 0 ] && echo xfs_freeze -f "$SCRATCH_MNT" failed
- (
- lvcreate --snapshot --size 1G --name scratch_snap "$VG/scratch"\
- > /dev/null 2>&1
- ret=$?
- [ $ret != 0 ] && \
- echo "Snapshot $SCRATCH_MNT create failed, status=$ret"
- ) &
- SNAPSHOT_shell_pid=$!
-
- # If the Snapshot has not completed in ten minutes, kill it
- (
- # I have NOT figured out how to kill the sleep 600 before
- # it exits naturally.
- # This does not cause a problem, but it clutters the ps table.
- sleep 600
-
- # The kill $TIMEOUT_shell_pid keeps the below from occuring
- echo Snapshot Lockup Occured on loop $ii
- xfs_freeze -u "$SCRATCH_MNT"
- kill $$
- ) &
- TIMEOUT_shell_pid=$!
-
- wait "$SNAPSHOT_shell_pid"
-
- exec 2> /dev/null # Send the shells stderr to /dev/null
- kill "$TIMEOUT_shell_pid" # Cancel the timeout
- wait "$TIMEOUT_shell_pid" # This causes consistent shell
- # notification for some unknown reason
- exec 2>&1 # Put it back to the same as stdout
-
- # If the VFS lock patch is present, the calls to xfs_freeze
- # are redundant, but should cause no problems
- # OPTIONAL
- xfs_freeze -u "$SCRATCH_MNT"
- [ $? != 0 ] && echo xfs_freeze -u "$SCRATCH_MNT" failed
- # MANDANTORY (end)
-
- mount -t xfs -o ro,nouuid "$VG/scratch_snap" "$SCRATCH_SNAP_MNT"
- [ $? -eq 0 ] || echo mount for "$SCRATCH_SNAP_MNT" failed
-
- umount "$SCRATCH_SNAP_MNT"
- [ $? -eq 0 ] || echo umount for "$SCRATCH_SNAP_MNT" failed
-
- lvremove -f "$VG/scratch_snap" > /dev/null 2>&1
- [ $? -eq 0 ] || echo lvremove for "$VG/scratch_snap" failed
-
- ii=`expr $ii + 1`