]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/procfs/procfs_list_concurrent_readers.ksh
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or https://opensource.org/licenses/CDDL-1.0.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 2018 by Delphix. All rights reserved.
27 .
$STF_SUITE/include
/libtest.shlib
31 # Make sure that interleaving reads from different readers does not affect the
32 # results that are returned.
35 # 1. Make sure a few debug messages have been logged.
36 # 2. Open the procfs file and start reading from it.
37 # 3. Open the file again, and read its entire contents.
38 # 4. Resume reading from the first instance.
39 # 5. Check that the contents read by the two instances are identical.
44 log_must
rm -f $msgs1 $msgs2
45 datasetexists
$FS && destroy_dataset
$FS -r
48 typeset
-r ZFS_DBGMSG
=/proc
/spl
/kstat
/zfs
/dbgmsg
49 typeset
-r FS
=$TESTPOOL/fs
54 # Clear out old messages
55 echo 0 >$ZFS_DBGMSG || log_fail
"failed to write to $ZFS_DBGMSG"
57 # Add some new messages
58 log_must zfs create
$FS
60 log_must zfs snapshot
"$FS@testsnapshot$i"
64 msgs1
=$
(mktemp
) || log_fail
65 msgs2
=$
(mktemp
) || log_fail
68 # Start reading file, pause and read it from another process, and then finish
71 { dd bs
=512 count
=4; cp $ZFS_DBGMSG $msgs1; cat; } <$ZFS_DBGMSG >$msgs2
74 # Truncate the result of the read that completed second in case it picked up an
75 # extra message that was logged after the first read completed.
77 log_must truncate
-s $
(stat_size
$msgs1) $msgs2
79 log_must
diff $msgs1 $msgs2
81 log_pass
"Concurrent readers receive identical results"