summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2017-01-27 10:43:39 -0800
committerBrian Behlendorf <[email protected]>2017-01-27 10:43:39 -0800
commit933ec999511f3d29de005bfa8966ae007b161c0f (patch)
tree9a95099ddf19af2ad57b6b0864e85bacf025aa74 /tests
parent986dd8aacc9a00ceedf61f63cbe641786f540611 (diff)
Retire .write/.read file operations
The .write/.read file operations callbacks can be retired since support for .read_iter/.write_iter and .aio_read/.aio_write has been added. The vfs_write()/vfs_read() entry functions will select the correct interface for the kernel. This is desirable because all VFS write/read operations now rely on common code. This change also add the generic write checks to make sure that ulimits are enforced correctly on write. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Closes #5587 Closes #5673
Diffstat (limited to 'tests')
-rw-r--r--tests/runfiles/linux.run5
-rw-r--r--tests/zfs-tests/tests/functional/large_files/Makefile.am3
-rwxr-xr-xtests/zfs-tests/tests/functional/large_files/large_files_002_pos.ksh55
3 files changed, 60 insertions, 3 deletions
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
index f09001d24..0a8198236 100644
--- a/tests/runfiles/linux.run
+++ b/tests/runfiles/linux.run
@@ -458,8 +458,9 @@ tests = ['inuse_004_pos']
post =
# DISABLED: needs investigation
-#[tests/functional/large_files]
-#tests = ['large_files_001_pos']
+# large_files_001_pos
+[tests/functional/large_files]
+tests = ['large_files_002_pos']
# DISABLED: needs investigation
#[tests/functional/largest_pool]
diff --git a/tests/zfs-tests/tests/functional/large_files/Makefile.am b/tests/zfs-tests/tests/functional/large_files/Makefile.am
index d78ea4722..0e4715330 100644
--- a/tests/zfs-tests/tests/functional/large_files/Makefile.am
+++ b/tests/zfs-tests/tests/functional/large_files/Makefile.am
@@ -2,4 +2,5 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/large_files
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
- large_files_001_pos.ksh
+ large_files_001_pos.ksh \
+ large_files_002_pos.ksh
diff --git a/tests/zfs-tests/tests/functional/large_files/large_files_002_pos.ksh b/tests/zfs-tests/tests/functional/large_files/large_files_002_pos.ksh
new file mode 100755
index 000000000..152fe2e08
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/large_files/large_files_002_pos.ksh
@@ -0,0 +1,55 @@
+#!/bin/ksh -p
+#
+# 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
+# or http://www.opensolaris.org/os/licensing.
+# 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 (c) 2015 by Lawrence Livermore National Security, LLC.
+# All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# DESCRIPTION:
+# Verify 'ulimit -f' file size restrictions are enforced.
+#
+# STRATEGY:
+# 1. Set ulimit file size to unlimited, verify files can be created.
+# 2. Reduce ulimit file size, verify the expected error is returned.
+#
+
+verify_runnable "both"
+
+log_assert "Verify 'ulimit -f' maximum file size is enforced"
+
+# Verify 'ulimit -f unlimited' works
+log_must ulimit -f unlimited
+log_must sh -c 'dd if=/dev/zero of=$TESTDIR/ulimit_write_file bs=1M count=2'
+log_must sh -c '$TRUNCATE -s2M $TESTDIR/ulimit_trunc_file'
+log_must $RM $TESTDIR/ulimit_write_file $TESTDIR/ulimit_trunc_file
+
+# Verify 'ulimit -f <size>' works
+log_must ulimit -f 1024
+log_mustnot sh -c 'dd if=/dev/zero of=$TESTDIR/ulimit_write_file bs=1M count=2'
+log_mustnot sh -c '$TRUNCATE -s2M $TESTDIR/ulimit_trunc_file'
+log_must $RM $TESTDIR/ulimit_write_file $TESTDIR/ulimit_trunc_file
+
+log_pass "Successfully enforced 'ulimit -f' maximum file size"