aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_015_neg.ksh
blob: 04fb225ed4aec632ee8350953c40a240f9d80d24 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/ksh -p
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright (c) 2017 by Delphix. All rights reserved.
#

. $STF_SUITE/tests/functional/slog/slog.kshlib

#
# DESCRIPTION:
#	Concurrent sync writes with log offline/online works.
#
# STRATEGY:
#	1. Configure "zfs_commit_timeout_pct"
#	2. Create pool with a log device.
#	3. Concurrently do the following:
#	   3.1. Perform 8K sync writes
#	   3.2. Perform log offline/online commands
#	4. Loop to test with growing "zfs_commit_timeout_pct" values.
#

verify_runnable "global"

function cleanup
{
	#
	# Wait for any of the writes and/or zpool commands that were
	# kicked off in the background to complete. On failure, we may
	# enter this function without previously waiting for them.
	#
	wait

	set_tunable64 COMMIT_TIMEOUT_PCT $ORIG_TIMEOUT

	poolexists $TESTPOOL && zpool destroy -f $TESTPOOL
}

typeset ORIG_TIMEOUT=$(get_tunable COMMIT_TIMEOUT_PCT)
log_onexit cleanup
log_must setup

for PCT in 0 1 2 4 8 16 32 64 128 256 512 1024; do
	log_must set_tunable64 COMMIT_TIMEOUT_PCT $PCT

	log_must zpool create $TESTPOOL $VDEV log $SDEV

	for i in {1..10}; do
		log_must fio --rw write --sync 1 --directory "/$TESTPOOL" \
		    --bs 8K --size 8K --name slog-test
	done &

	for i in {1..10}; do
		log_must zpool offline $TESTPOOL $SDEV
		log_must verify_slog_device $TESTPOOL $SDEV 'OFFLINE'
		log_must zpool online $TESTPOOL $SDEV
		log_must verify_slog_device $TESTPOOL $SDEV 'ONLINE'
	done &

	wait

	log_must zpool destroy -f $TESTPOOL
done

log_pass "Concurrent writes with slog offline/online works."