comparison usr/src/test/zfs-tests/tests/functional/persist_l2arc/persist_l2arc_003_neg.ksh @ 25465:2c417db70a87

3525 Persistent L2ARC Portions contributed by: Saso Kiselkov <skiselkov@gmail.com> Portions contributed by: Jorgen Lundman <lundman@lundman.net> Portions contributed by: Brian Behlendorf <behlendorf1@llnl.gov> Portions contributed by: Alexander Motin <mav@FreeBSD.org> Portions contributed by: Jason King <jason.king@joyent.com> Reviewed by: C Fraire <cfraire@me.com> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Dan McDonald <danmcd@joyent.com>
author George Amanakis <gamanakis@gmail.com>
date Thu, 30 Jul 2020 18:40:44 -0500
parents
children
comparison
equal deleted inserted replaced
25464:5cc24028580a 25465:2c417db70a87
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) 2020, George Amanakis. All rights reserved.
19 #
20
21 . $STF_SUITE/include/libtest.shlib
22 . $STF_SUITE/tests/functional/persist_l2arc/persist_l2arc.cfg
23
24 #
25 # DESCRIPTION:
26 # Persistent L2ARC fails as expected when l2arc_rebuild_enabled = 0
27 #
28 # STRATEGY:
29 # 1. Set l2arc_rebuild_enabled = 0
30 # 2. Create pool with a cache device.
31 # 3. Create a random file in that pool and random read for 30 sec.
32 # 4. Export pool.
33 # 5. Import pool.
34 # 6. Check in zpool iostat if the cache device has space allocated.
35 # 7. Read the file written in (2) and check if l2_hits in
36 # /proc/spl/kstat/zfs/arcstats increased.
37 #
38
39 verify_runnable "global"
40
41 log_assert "Persistent L2ARC fails as expected when l2arc_rebuild_enabled = 0."
42
43 function cleanup
44 {
45 if poolexists $TESTPOOL ; then
46 destroy_pool $TESTPOOL
47 fi
48
49 log_must set_tunable32 l2arc_rebuild_enabled $rebuild_enabled
50 log_must set_tunable32 l2arc_noprefetch $noprefetch
51 }
52 log_onexit cleanup
53
54 # l2arc_noprefetch is set to 0 to let L2ARC handle prefetches
55 typeset noprefetch=$(get_tunable l2arc_noprefetch)
56 log_must set_tunable32 l2arc_noprefetch 0
57
58 # disable L2ARC rebuild
59 typeset rebuild_enabled=$(get_tunable l2arc_rebuild_enabled)
60 log_must set_tunable32 l2arc_rebuild_enabled 0
61
62 typeset fill_mb=800
63 typeset cache_sz=$(( 2 * $fill_mb ))
64 export FILE_SIZE=$(( floor($fill_mb / $NUMJOBS) ))M
65
66 log_must truncate -s ${cache_sz}M $VDEV_CACHE
67
68 log_must zpool create -f $TESTPOOL $VDEV cache $VDEV_CACHE
69
70 log_must fio $FIO_SCRIPTS/mkfiles.fio
71 log_must fio $FIO_SCRIPTS/random_reads.fio
72
73 log_must zpool export $TESTPOOL
74
75 typeset l2_success_start=$(get_arcstat l2_rebuild_success)
76
77 log_must zpool import -d $VDIR $TESTPOOL
78 log_mustnot test "$(zpool iostat -Hpv $TESTPOOL $VDEV_CACHE | awk '{print $2}')" -gt 80000000
79
80 typeset l2_success_end=$(get_arcstat l2_rebuild_success)
81
82 log_mustnot test $l2_success_end -gt $l2_success_start
83
84 log_must zpool destroy -f $TESTPOOL
85 log_must set_tunable32 l2arc_rebuild_enabled $rebuild_enabled
86
87 log_pass "Persistent L2ARC fails as expected when l2arc_rebuild_enabled = 0."