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) 2014, 2016 by Delphix. All rights reserved.
19 # Copyright (c) 2019 by Datto Inc. All rights reserved.
22 . $STF_SUITE/include/libtest.shlib
23 . $STF_SUITE/tests/functional/no_space/enospc.cfg
27 # After filling a filesystem, the df command produces the
28 # expected result against the pool root filesystem.
31 # 1. Write a file until the child file system is full.
32 # 2. Ensure that ENOSPC is returned.
33 # 3. Unmount the child file system.
34 # 4. Issue df -h command.
35 # 5. Ensure pool root filesystem is included (issue #8253).
36 # 6. Issue df -h <filesystem>.
37 # 7. Ensure size and used are non-zero.
40 verify_runnable "both"
42 log_onexit default_cleanup_noexit
44 log_assert "Correct df output is returned when file system is full."
46 default_setup_noexit $DISK_SMALL
47 log_must zfs set compression=off $TESTPOOL/$TESTFS
49 log_note "Writing file: $TESTFILE0 until ENOSPC."
50 file_write -o create -f $TESTDIR/$TESTFILE0 -b $BLOCKSZ \
51 -c $NUM_WRITES -d $DATA
54 (( $ret != $ENOSPC )) && \
55 log_fail "$TESTFILE0 returned: $ret rather than ENOSPC."
57 log_must zfs umount $TESTPOOL/$TESTFS
59 # Ensure the pool root filesystem shows in df output.
60 # If the pool was full (available == 0) and the pool
61 # root filesystem had very little in it (used < 1 block),
62 # the size reported to df was zero (issue #8253) and
63 # df skipped the filesystem in its output.
64 log_must eval "df -h | grep $TESTPOOL"
66 # Confirm df size and used are non-zero.
67 size=$(df -h /$TESTPOOL | grep $TESTPOOL | awk '{print $2}')
68 used=$(df -h /$TESTPOOL | grep $TESTPOOL | awk '{print $3}')
69 if [[ "$size" = "0" ]] || [[ "$used" = "0" ]]
71 log_fail "df failed with size $size and used $used."
73 log_pass "df after ENOSPC works as expected."