summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKody Kantor <kody@kkantor.com>2019-05-30 18:23:04 +0000
committerDan McDonald <danmcd@joyent.com>2019-06-21 14:59:47 -0400
commitc1d5c2a48971d1705730e1ade6a1bc4d56587416 (patch)
tree5752185bccd3f33cd9dc02f1b61dde15030d5e9e
parentba6bf04be4fe9d821c75a16fdebd3af3bffdbf26 (diff)
downloadillumos-joyent-c1d5c2a48971d1705730e1ade6a1bc4d56587416.tar.gz
11084 clean up file-backed l2arc support
Reviewed by: Igor Kozhukhov <igor@dilos.org> Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/lib/libzfs/common/libzfs_pool.c13
-rw-r--r--usr/src/test/zfs-tests/tests/functional/cache/cache.cfg2
-rw-r--r--usr/src/test/zfs-tests/tests/functional/cache/cache_010_neg.ksh20
-rw-r--r--usr/src/test/zfs-tests/tests/functional/cache/setup.ksh3
4 files changed, 16 insertions, 22 deletions
diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c
index b5b80a4b18..1f636dd147 100644
--- a/usr/src/lib/libzfs/common/libzfs_pool.c
+++ b/usr/src/lib/libzfs/common/libzfs_pool.c
@@ -22,7 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2017 by Delphix. All rights reserved.
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
* Copyright 2016 Nexenta Systems, Inc.
* Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>
* Copyright (c) 2017 Datto Inc.
@@ -1277,11 +1277,6 @@ zpool_create(libzfs_handle_t *hdl, const char *pool, nvlist_t *nvroot,
"one or more devices is out of space"));
return (zfs_error(hdl, EZFS_BADDEV, msg));
- case ENOTBLK:
- zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
- "cache device must be a disk or disk slice"));
- return (zfs_error(hdl, EZFS_BADDEV, msg));
-
default:
return (zpool_standard_error(hdl, errno, msg));
}
@@ -1472,12 +1467,6 @@ zpool_add(zpool_handle_t *zhp, nvlist_t *nvroot)
(void) zfs_error(hdl, EZFS_POOL_NOTSUP, msg);
break;
- case ENOTBLK:
- zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
- "cache device must be a disk or disk slice"));
- (void) zfs_error(hdl, EZFS_BADDEV, msg);
- break;
-
default:
(void) zpool_standard_error(hdl, errno, msg);
}
diff --git a/usr/src/test/zfs-tests/tests/functional/cache/cache.cfg b/usr/src/test/zfs-tests/tests/functional/cache/cache.cfg
index b284bd4b23..0a248c8048 100644
--- a/usr/src/test/zfs-tests/tests/functional/cache/cache.cfg
+++ b/usr/src/test/zfs-tests/tests/functional/cache/cache.cfg
@@ -26,6 +26,7 @@
#
# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
+# Copyright 2019 Joyent, Inc.
#
. $STF_SUITE/include/libtest.shlib
@@ -68,3 +69,4 @@ export VDEV="$VDIR/a $VDIR/b $VDIR/c"
export LDEV="$DISK0"
export VDEV2="$VDIR2/a $VDIR2/b $VDIR2/c"
export LDEV2="$DISK1"
+export FILEDEV="$VDIR2/d"
diff --git a/usr/src/test/zfs-tests/tests/functional/cache/cache_010_neg.ksh b/usr/src/test/zfs-tests/tests/functional/cache/cache_010_neg.ksh
index f3dcf6873c..43294220dd 100644
--- a/usr/src/test/zfs-tests/tests/functional/cache/cache_010_neg.ksh
+++ b/usr/src/test/zfs-tests/tests/functional/cache/cache_010_neg.ksh
@@ -27,6 +27,7 @@
#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
+# Copyright 2019 Joyent, Inc.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@@ -34,12 +35,12 @@
#
# DESCRIPTION:
-# Verify cache device must be a block device.
+# Verify cache device must be a block device or plain file.
#
# STRATEGY:
# 1. Create a pool
-# 2. Add different object as cache
-# 3. Verify character devices and files fail
+# 2. Verify that raw disks, loopback files, and zvols can't be used to
+# back cache vdevs
#
verify_runnable "global"
@@ -52,20 +53,18 @@ function cleanup_testenv
fi
}
-log_assert "Cache device can only be block devices."
+log_assert "Cache device can only be block devices or plain files."
log_onexit cleanup_testenv
TESTVOL=testvol1$$
dsk1=${DISKS%% *}
+
log_must zpool create $TESTPOOL ${DISKS#$dsk1}
-# Add nomal /dev/rdsk device
+# Add normal /dev/rdsk device
log_mustnot zpool add $TESTPOOL cache /dev/rdsk/${dsk1}s0
#log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE'
-# Add nomal file
-log_mustnot zpool add $TESTPOOL cache $VDEV2
-
# Add /dev/rlofi device
lofidev=${VDEV2%% *}
log_must lofiadm -a $lofidev
@@ -76,9 +75,12 @@ if [[ -n $lofidev ]]; then
lofidev=""
fi
+# Add normal files
+log_must zpool add $TESTPOOL cache $FILEDEV
+
# Add /dev/zvol/rdsk device
log_must zpool create $TESTPOOL2 $VDEV2
log_must zfs create -V $SIZE $TESTPOOL2/$TESTVOL
log_mustnot zpool add $TESTPOOL cache /dev/zvol/rdsk/$TESTPOOL2/$TESTVOL
-log_pass "Cache device can only be block devices."
+log_pass "Cache device can only be block devices or plain files."
diff --git a/usr/src/test/zfs-tests/tests/functional/cache/setup.ksh b/usr/src/test/zfs-tests/tests/functional/cache/setup.ksh
index aa8d6cd06e..0826a887aa 100644
--- a/usr/src/test/zfs-tests/tests/functional/cache/setup.ksh
+++ b/usr/src/test/zfs-tests/tests/functional/cache/setup.ksh
@@ -27,6 +27,7 @@
#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
+# Copyright 2019 Joyent, Inc.
#
. $STF_SUITE/tests/functional/cache/cache.cfg
@@ -40,6 +41,6 @@ fi
log_must rm -rf $VDIR $VDIR2
log_must mkdir -p $VDIR $VDIR2
-log_must mkfile $SIZE $VDEV $VDEV2
+log_must mkfile $SIZE $VDEV $VDEV2 $FILEDEV
log_pass