xref: /titanic_41/usr/src/test/zfs-tests/tests/functional/no_space/enospc_002_pos.ksh (revision 32a712da90cea6ff9a05f51e7844944ccfa28d5e)
1#!/bin/ksh -p
2#
3# CDDL HEADER START
4#
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
8# 1.0 of the CDDL.
9#
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.
13#
14# CDDL HEADER END
15#
16
17#
18# Copyright (c) 2014 by Delphix. All rights reserved.
19#
20
21. $STF_SUITE/include/libtest.shlib
22. $STF_SUITE/tests/functional/no_space/enospc.cfg
23
24#
25# DESCRIPTION:
26# After filling a filesystem, certain zfs commands are allowed.
27#
28
29verify_runnable "both"
30
31log_assert "ENOSPC is returned when file system is full."
32sync
33log_must $ZFS set compression=off $TESTPOOL/$TESTFS
34log_must $ZFS snapshot $TESTPOOL/$TESTFS@snap
35
36log_note "Writing file: $TESTFILE0 until ENOSPC."
37$FILE_WRITE -o create -f $TESTDIR/$TESTFILE0 -b $BLOCKSZ \
38    -c $NUM_WRITES -d $DATA
39ret=$?
40
41(( $ret != $ENOSPC )) && \
42    log_fail "$TESTFILE0 returned: $ret rather than ENOSPC."
43
44log_mustnot_expect space $ZFS create $TESTPOOL/$TESTFS/subfs
45log_mustnot_expect space $ZFS clone $TESTPOOL/$TESTFS@snap $TESTPOOL/clone
46log_mustnot_expect space $ZFS snapshot $TESTPOOL/$TESTFS@snap2
47log_mustnot_expect space $ZFS bookmark \
48    $TESTPOOL/$TESTFS@snap $TESTPOOL/$TESTFS#bookmark
49
50log_must $ZFS send $TESTPOOL/$TESTFS@snap >/tmp/stream.$$
51log_mustnot_expect space $ZFS receive $TESTPOOL/$TESTFS/recvd </tmp/stream.$$
52log_must rm /tmp/stream.$$
53
54log_must $ZFS rename $TESTPOOL/$TESTFS@snap $TESTPOOL/$TESTFS@snap_newname
55log_must $ZFS rename $TESTPOOL/$TESTFS@snap_newname $TESTPOOL/$TESTFS@snap
56log_must $ZFS rename $TESTPOOL/$TESTFS $TESTPOOL/${TESTFS}_newname
57log_must $ZFS rename $TESTPOOL/${TESTFS}_newname $TESTPOOL/$TESTFS
58log_must $ZFS allow staff snapshot $TESTPOOL/$TESTFS
59log_must $ZFS unallow staff snapshot $TESTPOOL/$TESTFS
60log_must $ZFS set user:prop=value $TESTPOOL/$TESTFS
61log_must $ZFS set quota=1EB $TESTPOOL/$TESTFS
62log_must $ZFS set quota=none $TESTPOOL/$TESTFS
63log_must $ZFS set reservation=1KB $TESTPOOL/$TESTFS
64log_must $ZFS set reservation=none $TESTPOOL/$TESTFS
65log_must $ZPOOL scrub $TESTPOOL
66$ZPOOL scrub -s $TESTPOOL
67log_must $ZPOOL set comment="Use the force, Luke." $TESTPOOL
68log_must $ZPOOL set comment="" $TESTPOOL
69
70# destructive tests must come last
71log_must $ZFS rollback $TESTPOOL/$TESTFS@snap
72log_must $ZFS destroy $TESTPOOL/$TESTFS@snap
73
74log_pass "ENOSPC returned as expected."
75