summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2019-03-27 11:48:13 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2019-03-27 11:48:13 +0000
commite741beb43b44dc9de3b96bc2e4a00502c0f11c76 (patch)
tree6e7d9e0946ce33d61678ee054cb43262b3ac5260
parentdc238736b55afd3a593354a3a7233204ca25b27c (diff)
parent619a0f6c7269dc1950adc2e401a36d843dd9fa02 (diff)
downloadillumos-joyent-e741beb43b44dc9de3b96bc2e4a00502c0f11c76.tar.gz
[illumos-gate merge]
commit 619a0f6c7269dc1950adc2e401a36d843dd9fa02 10512 Add manual for ztest(1) commit 3df5395b5f23c9954f48ad824db4d3d3570e3d50 10107 librpcsvc needs smatch fixes commit f7e4f33f27df122daef98e5b4b537dc159597da5 10580 pnglite: unchecked function return
-rw-r--r--manifest1
-rw-r--r--usr/src/common/pnglite/pnglite.c24
-rw-r--r--usr/src/lib/librpcsvc/common/rusers_simple.c13
-rw-r--r--usr/src/man/man1m/Makefile3
-rwxr-xr-xusr/src/man/man1m/ztest.1m169
-rw-r--r--usr/src/pkg/manifests/system-file-system-zfs.mf1
-rwxr-xr-xusr/src/tools/quick/make-zfs6
7 files changed, 199 insertions, 18 deletions
diff --git a/manifest b/manifest
index ed0403fca8..d3ccdf7f67 100644
--- a/manifest
+++ b/manifest
@@ -12451,6 +12451,7 @@ f usr/share/man/man1m/zoneadmd.1m 0444 root bin
f usr/share/man/man1m/zonecfg.1m 0444 root bin
f usr/share/man/man1m/zpool.1m 0444 root bin
f usr/share/man/man1m/zstreamdump.1m 0444 root bin
+f usr/share/man/man1m/ztest.1m 0444 root bin
d usr/share/man/man2 0755 root bin
f usr/share/man/man2/Intro.2 0444 root bin
s usr/share/man/man2/_Exit.2=exit.2
diff --git a/usr/src/common/pnglite/pnglite.c b/usr/src/common/pnglite/pnglite.c
index 7ea32c002d..5d8b41f9e9 100644
--- a/usr/src/common/pnglite/pnglite.c
+++ b/usr/src/common/pnglite/pnglite.c
@@ -100,12 +100,13 @@ png_get_bpp(png_t *png)
static int
png_read_ihdr(png_t *png)
{
- unsigned length;
+ unsigned length = 0;
unsigned orig_crc;
unsigned calc_crc;
uint8_t ihdr[13+4]; /* length should be 13, make room for type (IHDR) */
- file_read_ul(png, &length);
+ if (file_read_ul(png, &length) != PNG_NO_ERROR)
+ return (PNG_FILE_ERROR);
if (length != 13)
return (PNG_CRC_ERROR);
@@ -113,7 +114,8 @@ png_read_ihdr(png_t *png)
if (file_read(png, ihdr, 1, 13+4) != 13+4)
return (PNG_EOF_ERROR);
- file_read_ul(png, &orig_crc);
+ if (file_read_ul(png, &orig_crc) != PNG_NO_ERROR)
+ return (PNG_FILE_ERROR);
calc_crc = crc32(0L, Z_NULL, 0);
calc_crc = crc32(calc_crc, ihdr, 13+4);
@@ -220,7 +222,7 @@ done:
if (result != PNG_NO_ERROR) {
free(png->image);
- close(png->fd);
+ (void) close(png->fd);
png->fd = -1;
return (result);
}
@@ -231,7 +233,7 @@ done:
int
png_close(png_t *png)
{
- close(png->fd);
+ (void) close(png->fd);
png->fd = -1;
free(png->image);
png->image = NULL;
@@ -329,7 +331,8 @@ png_read_idat(png_t *png, unsigned length)
calc_crc = crc32(calc_crc, (uint8_t *)"IDAT", 4);
calc_crc = crc32(calc_crc, (uint8_t *)png->readbuf, length);
- file_read_ul(png, &orig_crc);
+ if (file_read_ul(png, &orig_crc) != PNG_NO_ERROR)
+ return (PNG_FILE_ERROR);
if (orig_crc != calc_crc)
return (PNG_CRC_ERROR);
@@ -344,9 +347,10 @@ png_process_chunk(png_t *png)
unsigned type;
unsigned length;
- file_read_ul(png, &length);
+ if (file_read_ul(png, &length) != PNG_NO_ERROR)
+ return (PNG_FILE_ERROR);
- if (file_read_ul(png, &type))
+ if (file_read_ul(png, &type) != PNG_NO_ERROR)
return (PNG_FILE_ERROR);
/*
@@ -373,7 +377,7 @@ png_process_chunk(png_t *png)
} else if (type == png_IEND)
return (PNG_DONE);
else
- file_read(png, 0, 1, length + 4); /* unknown chunk */
+ (void) file_read(png, 0, 1, length + 4); /* unknown chunk */
return (result);
}
@@ -571,7 +575,7 @@ png_get_data(png_t *png, uint8_t *data)
png->readbuflen = 0;
}
if (png->zs)
- png_end_inflate(png);
+ (void) png_end_inflate(png);
if (result != PNG_DONE) {
free(png->png_data);
diff --git a/usr/src/lib/librpcsvc/common/rusers_simple.c b/usr/src/lib/librpcsvc/common/rusers_simple.c
index 3cccb42e78..1902fbfa5d 100644
--- a/usr/src/lib/librpcsvc/common/rusers_simple.c
+++ b/usr/src/lib/librpcsvc/common/rusers_simple.c
@@ -19,7 +19,6 @@
*
* CDDL HEADER END
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*
* rusers_simple.c
@@ -29,6 +28,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2018, Joyent, Inc.
+ */
+
#include <string.h>
#include <rpc/rpc.h>
#include <rpcsvc/rusers.h>
@@ -85,13 +88,13 @@ rusers3(host, uap)
xdr_free(xdr_utmpidlearr, (char *)&up);
return (-1);
}
- strncpy(rutp->ut_line,
+ (void) strncpy(rutp->ut_line,
up.uia_arr[i]->ui_utmp.ut_line,
sizeof (forsize.ut_line)+1);
- strncpy(rutp->ut_user,
+ (void) strncpy(rutp->ut_user,
up.uia_arr[i]->ui_utmp.ut_name,
sizeof (forsize.ut_name)+1);
- strncpy(rutp->ut_host,
+ (void) strncpy(rutp->ut_host,
up.uia_arr[i]->ui_utmp.ut_host,
sizeof (forsize.ut_host)+1);
rutp->ut_idle = up.uia_arr[i]->ui_idle;
@@ -117,7 +120,7 @@ rnusers(host)
if (rpc_call(host, RUSERSPROG, RUSERSVERS_IDLE, RUSERSPROC_NUM,
xdr_void, (char *) NULL,
xdr_u_int, (char *) &nusers, (char *) NULL) != 0)
- return (-1);
+ return (-1);
}
return (nusers);
}
diff --git a/usr/src/man/man1m/Makefile b/usr/src/man/man1m/Makefile
index 66926a9e08..68b68b8d00 100644
--- a/usr/src/man/man1m/Makefile
+++ b/usr/src/man/man1m/Makefile
@@ -538,7 +538,8 @@ _MANFILES= 6to4relay.1m \
zoneadmd.1m \
zonecfg.1m \
zpool.1m \
- zstreamdump.1m
+ zstreamdump.1m \
+ ztest.1m
i386_MANFILES= \
acpidump.1m \
diff --git a/usr/src/man/man1m/ztest.1m b/usr/src/man/man1m/ztest.1m
new file mode 100755
index 0000000000..065f88e52c
--- /dev/null
+++ b/usr/src/man/man1m/ztest.1m
@@ -0,0 +1,169 @@
+.\" $NetBSD: ztest.1,v 1.4 2018/12/10 03:58:30 sevan Exp $
+.\"
+.\" Copyright (c) 2018 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Sevan Janiyan <sevan@NetBSD.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"/
+.Dd December 10, 2018
+.Dt ZTEST 1M
+.Os
+.Sh NAME
+.Nm ztest
+.Nd ZFS stress test utility
+.Sh SYNOPSIS
+.Nm
+.Op Fl EhV
+.Op Fl a Ar shift
+.Op Fl B Ar path
+.Op Fl d Ar datasets
+.Op Fl F Ar loops
+.Op Fl f Ar path
+.Op Fl g Ar threshold
+.Op Fl i Ar count
+.Op Fl k Ar percent
+.Op Fl m Ar copies
+.Op Fl P Ar passtime
+.Op Fl p Ar name
+.Op Fl R Ar parity
+.Op Fl r Ar disks
+.Op Fl s Ar size
+.Op Fl T Ar time
+.Op Fl t Ar threads
+.Op Fl v Ar vdevs
+.Sh DESCRIPTION
+The
+.Nm
+utility stress tests the DMU, ZAP, SPA components of ZFS from user space.
+.Pp
+.Nm
+provides a simple routine to test the functionality of a component task.
+These simple routines can then be used to stress test through parallel
+execution.
+Tests are run as child processes of the main process.
+.Pp
+The checksum and compression functions are changed each time a dataset is
+opened to introduce varying combinations of checksum and compression from block
+to block among objects.
+.Pp
+While tests are running, faults are injected into the pool to verify
+self-healing ability.
+.Pp
+To verify that the on-disk consistency is never lost after a crash, child
+processes are killed at random with a SIGKILL signal, after which the parent
+process invokes a new child to run the test again on the same storage pool.
+.Pp
+Many of the tests record the transaction group number as part of their data.
+When reading old data, tests verify that the transaction group number is less
+than the current, open state, transaction group to ensure the consistency of
+tests and detect unaccounted changes.
+It is advised that any new tests added to
+.Nm
+should also perform the same check with transaction group numbers, if
+applicable.
+.Pp
+The main
+.Nm
+process uses an
+.Xr mmap 2
+temporary file to pass information to child processes which allows shared
+memory to survive
+.Xr exec 3
+syscall.
+A copy of the
+.Vt ztest_shared_hdr_t
+struct containing information on the size and number of shared
+structures in the file is always stored at offset 0 of the file.
+.Pp
+For backwards compatibility testing
+.Nm
+can invoke an alternative version of
+.Nm
+after a
+.Dv SIGKILL
+signal using the
+.Fl B
+flag.
+.Pp
+The following options are available:
+.Bl -tag -width 5n
+.It Fl a Ar shift
+alignment shift (default: 9) use 0 for random
+.It Fl B Ar path
+alt ztest (default: <none>) alternate ztest path
+.It Fl d Ar datasets
+datasets (default: 7)
+.It Fl E
+use existing pool instead of creating new one
+.It Fl F Ar loops
+freezeloops (default: 50) max loops in
+.Fn spa_freeze
+.It Fl f Ar path
+dir (default:
+.Pa /tmp )
+file directory for vdev files
+.It Fl g Ar threshold
+gang block threshold (default: 32K)
+.It Fl h
+print help
+.It Fl i Ar count
+init count (default: 1) initialize pool
+.Ar count
+times
+.It Fl k Ar percent
+kill percentage (default: 70%)
+.It Fl m Ar copies
+mirror copies (default: 2)
+.It Fl P Ar passtime
+passtime (default: 60 sec) time per pass
+.It Fl p Ar name
+pool name (default: ztest)
+.It Fl R Ar parity
+raidz parity (default: 1)
+.It Fl r Ar disks
+raidz disks (default: 4)
+.It Fl s Ar size
+size of each vdev (default: 256M)
+.It Fl T Ar time
+time (default: 300 sec) total run time
+.It Fl t Ar threads
+threads (default: 23)
+.It Fl V
+verbose (use multiple times to increase verbosity)
+.It Fl v Ar vdevs
+number of vdevs (default: 5)
+.El
+.Sh AUTHORS
+This man page was written by
+.An Sevan Janiyan
+.Aq Mt sevan@NetBSD.org .
+.Sh CAVEATS
+To allow for backward compatibility testing using older versions of
+.Nm
+the information stored in the
+.Xr mmap 2
+temporary file passed from parent process to child must
+remain compatible with older versions of
+.Nm .
diff --git a/usr/src/pkg/manifests/system-file-system-zfs.mf b/usr/src/pkg/manifests/system-file-system-zfs.mf
index 6032e99675..3fa15b19f6 100644
--- a/usr/src/pkg/manifests/system-file-system-zfs.mf
+++ b/usr/src/pkg/manifests/system-file-system-zfs.mf
@@ -103,6 +103,7 @@ file path=usr/share/man/man1m/zfs-program.1m
file path=usr/share/man/man1m/zfs.1m
file path=usr/share/man/man1m/zpool.1m
file path=usr/share/man/man1m/zstreamdump.1m
+file path=usr/share/man/man1m/ztest.1m
file path=usr/share/man/man5/zpool-features.5
hardlink path=kernel/fs/$(ARCH64)/zfs target=../../../kernel/drv/$(ARCH64)/zfs
hardlink path=usr/lib/fs/zfs/fstyp target=../../../sbin/fstyp
diff --git a/usr/src/tools/quick/make-zfs b/usr/src/tools/quick/make-zfs
index f88deeff35..987b5627d2 100755
--- a/usr/src/tools/quick/make-zfs
+++ b/usr/src/tools/quick/make-zfs
@@ -266,13 +266,14 @@ do_mans() {
$ROOT/usr/share/man/man1m/zdb.1m \
$ROOT/usr/share/man/man1m/zfs.1m \
$ROOT/usr/share/man/man1m/zfs-program.1m \
- $ROOT/usr/share/man/man1m/zpool.1m )
+ $ROOT/usr/share/man/man1m/zpool.1m \
+ $ROOT/usr/share/man/man1m/ztest.1m )
(cd $SRC/man/man5 && make \
$ROOT/usr/share/man/man5/zpool-features.5 )
;;
lint)
(cd $SRC/man/man1m && make zdb.1m.check zfs.1m.check zfs-program.1m.check \
- zpool.1m.check)
+ zpool.1m.check ztest.1m.check)
(cd $SRC/man/man5 && make zpool-features.5.check)
;;
*)
@@ -348,6 +349,7 @@ usr/share/man/man1m/zdb.1m
usr/share/man/man1m/zfs.1m
usr/share/man/man1m/zfs-program.1m
usr/share/man/man1m/zpool.1m
+usr/share/man/man1m/ztest.1m
usr/share/man/man5/zpool-features.5
"
(cd $ROOT && tar cfj ../../zfs-${git_rev}.tar.bz2 $files)