Meta: 1
Name: zfs
Branch: 1.0
-Version: 0.7.5
+Version: 0.7.6
Release: 1
Release-Tags: relext
License: CDDL
cppcheck:
@if type cppcheck > /dev/null 2>&1; then \
- cppcheck --quiet --force --error-exitcode=2 \
+ cppcheck --quiet --force --error-exitcode=2 --inline-suppr \
--suppressions-list=.github/suppressions.txt \
- -UHAVE_SSE2 -UHAVE_AVX512F \
- ${top_srcdir}; \
+ -UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \
+ -UHAVE_DNLC ${top_srcdir}; \
fi
paxcheck:
name=${PACKAGE}; \
version=${VERSION}-${RELEASE}; \
arch=`$(RPM) -qp $${name}-kmod-$${version}.src.rpm --qf %{arch} | tail -1`; \
+ debarch=`$(DPKG) --print-architecture`; \
pkg1=kmod-$${name}*$${version}.$${arch}.rpm; \
- fakeroot $(ALIEN) --bump=0 --scripts --to-deb $$pkg1; \
+ fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1; \
$(RM) $$pkg1
deb-dkms: deb-local rpm-dkms
name=${PACKAGE}; \
version=${VERSION}-${RELEASE}; \
arch=`$(RPM) -qp $${name}-dkms-$${version}.src.rpm --qf %{arch} | tail -1`; \
+ debarch=`$(DPKG) --print-architecture`; \
pkg1=$${name}-dkms-$${version}.$${arch}.rpm; \
- fakeroot $(ALIEN) --bump=0 --scripts --to-deb $$pkg1; \
+ fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1; \
$(RM) $$pkg1
deb-utils: deb-local rpm-utils
name=${PACKAGE}; \
version=${VERSION}-${RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
+ debarch=`$(DPKG) --print-architecture`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
pkg2=libnvpair1-$${version}.$${arch}.rpm; \
pkg3=libuutil1-$${version}.$${arch}.rpm; \
>> $${path_prepend}/dh_shlibdeps; \
chmod +x $${path_prepend}/dh_shlibdeps; \
env PATH=$${path_prepend}:$${PATH} \
- fakeroot $(ALIEN) --bump=0 --scripts --to-deb \
+ fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch \
$$pkg1 $$pkg2 $$pkg3 $$pkg4 $$pkg5 $$pkg6 $$pkg7 \
$$pkg8 $$pkg9; \
$(RM) $${path_prepend}/dh_shlibdeps; \
cppcheck:
@if type cppcheck > /dev/null 2>&1; then \
- cppcheck --quiet --force --error-exitcode=2 \
+ cppcheck --quiet --force --error-exitcode=2 --inline-suppr \
--suppressions-list=.github/suppressions.txt \
- -UHAVE_SSE2 -UHAVE_AVX512F \
- ${top_srcdir}; \
+ -UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \
+ -UHAVE_DNLC ${top_srcdir}; \
fi
paxcheck:
# If you are having troubles when using this script from cron(8) please try
# adjusting your PATH before reporting problems.
#
-# /usr/bin & /sbin
-#
-# Binaries used are:
-#
-# dc(1), kldstat(8), sed(1), sysctl(8) & vmstat(8)
-#
-# Binaries that I am working on phasing out are:
-#
-# dc(1) & sed(1)
+# Note some of this code uses older code (eg getopt instead of argparse,
+# subprocess.Popen() instead of subprocess.run()) because we need to support
+# some very old versions of Python.
+"""Print statistics on the ZFS Adjustable Replacement Cache (ARC)
+Provides basic information on the ARC, its efficiency, the L2ARC (if present),
+the Data Management Unit (DMU), Virtual Devices (VDEVs), and tunables. See the
+in-source documentation and code at
+https://github.com/zfsonlinux/zfs/blob/master/module/zfs/arc.c for details.
+"""
+
+import getopt
+import os
import sys
import time
-import getopt
-import re
-from os import listdir
+import errno
+
from subprocess import Popen, PIPE
from decimal import Decimal as D
-
-usetunable = True
show_tunable_descriptions = False
alternate_tunable_layout = False
-kstat_pobj = re.compile("^([^:]+):\s+(.+)\s*$", flags=re.M)
+
+
+def handle_Exception(ex_cls, ex, tb):
+ if ex is IOError:
+ if ex.errno == errno.EPIPE:
+ sys.exit()
+
+ if ex is KeyboardInterrupt:
+ sys.exit()
+
+
+sys.excepthook = handle_Exception
def get_Kstat():
+ """Collect information on the ZFS subsystem from the /proc virtual
+ file system. The name "kstat" is a holdover from the Solaris utility
+ of the same name.
+ """
+
def load_proc_kstats(fn, namespace):
+ """Collect information on a specific subsystem of the ARC"""
+
kstats = [line.strip() for line in open(fn)]
del kstats[0:2]
for kstat in kstats:
kstat = kstat.strip()
- name, unused, value = kstat.split()
+ name, _, value = kstat.split()
Kstat[namespace + name] = D(value)
Kstat = {}
return Kstat
-def div1():
- sys.stdout.write("\n")
- for i in range(18):
- sys.stdout.write("%s" % "----")
- sys.stdout.write("\n")
+def fBytes(b=0):
+ """Return human-readable representation of a byte value in
+ powers of 2 (eg "KiB" for "kibibytes", etc) to two decimal
+ points. Values smaller than one KiB are returned without
+ decimal points.
+ """
+ prefixes = [
+ [2**80, "YiB"], # yobibytes (yotta)
+ [2**70, "ZiB"], # zebibytes (zetta)
+ [2**60, "EiB"], # exbibytes (exa)
+ [2**50, "PiB"], # pebibytes (peta)
+ [2**40, "TiB"], # tebibytes (tera)
+ [2**30, "GiB"], # gibibytes (giga)
+ [2**20, "MiB"], # mebibytes (mega)
+ [2**10, "KiB"]] # kibibytes (kilo)
-def div2():
- sys.stdout.write("\n")
+ if b >= 2**10:
+
+ for limit, unit in prefixes:
+ if b >= limit:
+ value = b / limit
+ break
+
+ result = "%0.2f\t%s" % (value, unit)
-def fBytes(Bytes=0, Decimal=2):
- kbytes = (2 ** 10)
- mbytes = (2 ** 20)
- gbytes = (2 ** 30)
- tbytes = (2 ** 40)
- pbytes = (2 ** 50)
- ebytes = (2 ** 60)
- zbytes = (2 ** 70)
- ybytes = (2 ** 80)
-
- if Bytes >= ybytes:
- return str("%0." + str(Decimal) + "f") % (Bytes / ybytes) + "\tYiB"
- elif Bytes >= zbytes:
- return str("%0." + str(Decimal) + "f") % (Bytes / zbytes) + "\tZiB"
- elif Bytes >= ebytes:
- return str("%0." + str(Decimal) + "f") % (Bytes / ebytes) + "\tEiB"
- elif Bytes >= pbytes:
- return str("%0." + str(Decimal) + "f") % (Bytes / pbytes) + "\tPiB"
- elif Bytes >= tbytes:
- return str("%0." + str(Decimal) + "f") % (Bytes / tbytes) + "\tTiB"
- elif Bytes >= gbytes:
- return str("%0." + str(Decimal) + "f") % (Bytes / gbytes) + "\tGiB"
- elif Bytes >= mbytes:
- return str("%0." + str(Decimal) + "f") % (Bytes / mbytes) + "\tMiB"
- elif Bytes >= kbytes:
- return str("%0." + str(Decimal) + "f") % (Bytes / kbytes) + "\tKiB"
- elif Bytes == 0:
- return str("%d" % 0) + "\tBytes"
else:
- return str("%d" % Bytes) + "\tBytes"
-
-
-def fHits(Hits=0, Decimal=2):
- khits = (10 ** 3)
- mhits = (10 ** 6)
- bhits = (10 ** 9)
- thits = (10 ** 12)
- qhits = (10 ** 15)
- Qhits = (10 ** 18)
- shits = (10 ** 21)
- Shits = (10 ** 24)
-
- if Hits >= Shits:
- return str("%0." + str(Decimal) + "f") % (Hits / Shits) + "S"
- elif Hits >= shits:
- return str("%0." + str(Decimal) + "f") % (Hits / shits) + "s"
- elif Hits >= Qhits:
- return str("%0." + str(Decimal) + "f") % (Hits / Qhits) + "Q"
- elif Hits >= qhits:
- return str("%0." + str(Decimal) + "f") % (Hits / qhits) + "q"
- elif Hits >= thits:
- return str("%0." + str(Decimal) + "f") % (Hits / thits) + "t"
- elif Hits >= bhits:
- return str("%0." + str(Decimal) + "f") % (Hits / bhits) + "b"
- elif Hits >= mhits:
- return str("%0." + str(Decimal) + "f") % (Hits / mhits) + "m"
- elif Hits >= khits:
- return str("%0." + str(Decimal) + "f") % (Hits / khits) + "k"
- elif Hits == 0:
- return str("%d" % 0)
+
+ result = "%d\tBytes" % b
+
+ return result
+
+
+def fHits(hits=0):
+ """Create a human-readable representation of the number of hits.
+ The single-letter symbols used are SI to avoid the confusion caused
+ by the different "short scale" and "long scale" representations in
+ English, which use the same words for different values. See
+ https://en.wikipedia.org/wiki/Names_of_large_numbers and
+ https://physics.nist.gov/cuu/Units/prefixes.html
+ """
+
+ numbers = [
+ [10**24, 'Y'], # yotta (septillion)
+ [10**21, 'Z'], # zetta (sextillion)
+ [10**18, 'E'], # exa (quintrillion)
+ [10**15, 'P'], # peta (quadrillion)
+ [10**12, 'T'], # tera (trillion)
+ [10**9, 'G'], # giga (billion)
+ [10**6, 'M'], # mega (million)
+ [10**3, 'k']] # kilo (thousand)
+
+ if hits >= 1000:
+
+ for limit, symbol in numbers:
+
+ if hits >= limit:
+ value = hits/limit
+ break
+
+ result = "%0.2f%s" % (value, symbol)
+
else:
- return str("%d" % Hits)
+
+ result = "%d" % hits
+
+ return result
def fPerc(lVal=0, rVal=0, Decimal=2):
+ """Calculate percentage value and return in human-readable format"""
+
if rVal > 0:
return str("%0." + str(Decimal) + "f") % (100 * (lVal / rVal)) + "%"
else:
def get_arc_summary(Kstat):
+ """Collect general data on the ARC"""
output = {}
memory_throttle_count = Kstat[
# ARC Misc.
deleted = Kstat["kstat.zfs.misc.arcstats.deleted"]
mutex_miss = Kstat["kstat.zfs.misc.arcstats.mutex_miss"]
+ evict_skip = Kstat["kstat.zfs.misc.arcstats.evict_skip"]
# ARC Misc.
output["arc_misc"] = {}
output["arc_misc"]["deleted"] = fHits(deleted)
output["arc_misc"]['mutex_miss'] = fHits(mutex_miss)
- output["arc_misc"]['evict_skips'] = fHits(mutex_miss)
+ output["arc_misc"]['evict_skips'] = fHits(evict_skip)
# ARC Sizing
arc_size = Kstat["kstat.zfs.misc.arcstats.size"]
def _arc_summary(Kstat):
+ """Print information on the ARC"""
+
# ARC Sizing
arc = get_arc_summary(Kstat)
sys.stdout.write("\tMutex Misses:\t\t\t\t%s\n" %
arc['arc_misc']['mutex_miss'])
sys.stdout.write("\tEvict Skips:\t\t\t\t%s\n" %
- arc['arc_misc']['mutex_miss'])
+ arc['arc_misc']['evict_skips'])
sys.stdout.write("\n")
# ARC Sizing
def get_arc_efficiency(Kstat):
+ """Collect information on the efficiency of the ARC"""
+
output = {}
arc_hits = Kstat["kstat.zfs.misc.arcstats.hits"]
def _arc_efficiency(Kstat):
+ """Print information on the efficiency of the ARC"""
+
arc = get_arc_efficiency(Kstat)
sys.stdout.write("ARC Total accesses:\t\t\t\t\t%s\n" %
def get_l2arc_summary(Kstat):
+ """Collection information on the L2ARC"""
+
output = {}
l2_abort_lowmem = Kstat["kstat.zfs.misc.arcstats.l2_abort_lowmem"]
def _l2arc_summary(Kstat):
+ """Print information on the L2ARC"""
arc = get_l2arc_summary(Kstat)
def get_dmu_summary(Kstat):
+ """Collect information on the DMU"""
+
output = {}
zfetch_hits = Kstat["kstat.zfs.misc.zfetchstats.hits"]
def _dmu_summary(Kstat):
+ """Print information on the DMU"""
arc = get_dmu_summary(Kstat)
def get_vdev_summary(Kstat):
+ """Collect information on the VDEVs"""
+
output = {}
vdev_cache_delegations = \
def _vdev_summary(Kstat):
+ """Print information on the VDEVs"""
+
arc = get_vdev_summary(Kstat)
if arc['vdev_cache_total'] > 0:
def _tunable_summary(Kstat):
+ """Print information on tunables, including descriptions if requested"""
+
global show_tunable_descriptions
global alternate_tunable_layout
- names = listdir("/sys/module/zfs/parameters/")
+ names = os.listdir("/sys/module/zfs/parameters/")
values = {}
for name in names:
descriptions = {}
if show_tunable_descriptions:
+
+ command = ["/sbin/modinfo", "zfs", "-0"]
+
try:
- command = ["/sbin/modinfo", "zfs", "-0"]
p = Popen(command, stdin=PIPE, stdout=PIPE,
stderr=PIPE, shell=False, close_fds=True)
p.wait()
- description_list = p.communicate()[0].strip().split('\0')
+ # By default, Python 2 returns a string as the first element of the
+ # tuple from p.communicate(), while Python 3 returns bytes which
+ # must be decoded first. The better way to do this would be with
+ # subprocess.run() or at least .check_output(), but this fails on
+ # CentOS 6 because of its old version of Python 2
+ desc = bytes.decode(p.communicate()[0])
+ description_list = desc.strip().split('\0')
if p.returncode == 0:
for tunable in description_list:
(sys.argv[0], command[0], e.strerror))
sys.stderr.write("Tunable descriptions will be disabled.\n")
- sys.stdout.write("ZFS Tunable:\n")
+ sys.stdout.write("ZFS Tunables:\n")
+ names.sort()
+
+ if alternate_tunable_layout:
+ fmt = "\t%s=%s\n"
+ else:
+ fmt = "\t%-50s%s\n"
+
for name in names:
+
if not name:
continue
- format = "\t%-50s%s\n"
- if alternate_tunable_layout:
- format = "\t%s=%s\n"
-
if show_tunable_descriptions and name in descriptions:
sys.stdout.write("\t# %s\n" % descriptions[name])
- sys.stdout.write(format % (name, values[name]))
+ sys.stdout.write(fmt % (name, values[name]))
unSub = [
def zfs_header():
- daydate = time.strftime("%a %b %d %H:%M:%S %Y")
+ """Print title string with date"""
+
+ daydate = time.strftime('%a %b %d %H:%M:%S %Y')
- div1()
- sys.stdout.write("ZFS Subsystem Report\t\t\t\t%s" % daydate)
- div2()
+ sys.stdout.write('\n'+'-'*72+'\n')
+ sys.stdout.write('ZFS Subsystem Report\t\t\t\t%s' % daydate)
+ sys.stdout.write('\n')
def usage():
+ """Print usage information"""
+
sys.stdout.write("Usage: arc_summary.py [-h] [-a] [-d] [-p PAGE]\n\n")
sys.stdout.write("\t -h, --help : "
"Print this help message and exit\n")
def main():
+ """Main function"""
+
global show_tunable_descriptions
global alternate_tunable_layout
- opts, args = getopt.getopt(
- sys.argv[1:], "adp:h", ["alternate", "description", "page=", "help"]
- )
+ try:
+ opts, args = getopt.getopt(
+ sys.argv[1:],
+ "adp:h", ["alternate", "description", "page=", "help"]
+ )
+ except getopt.error as e:
+ sys.stderr.write("Error: %s\n" % e.msg)
+ usage()
+ sys.exit(1)
args = {}
for opt, arg in opts:
args['p'] = arg
if opt in ('-h', '--help'):
usage()
- sys.exit()
+ sys.exit(0)
Kstat = get_Kstat()
except IndexError:
sys.stderr.write('the argument to -p must be between 1 and ' +
str(len(unSub)) + '\n')
- sys.exit()
+ sys.exit(1)
else:
pages = unSub
zfs_header()
for page in pages:
page(Kstat)
- div2()
+ sys.stdout.write("\n")
if __name__ == '__main__':
zed_lock "${lockfile}" "${lockfile_fd}"
time_now="$(date +%s)"
- time_prev="$(egrep "^[0-9]+;${tag}\$" "${statefile}" 2>/dev/null \
+ time_prev="$(grep -E "^[0-9]+;${tag}\$" "${statefile}" 2>/dev/null \
| tail -1 | cut -d\; -f1)"
if [ -n "${time_prev}" ] \
else
umask_bak="$(umask)"
umask 077
- egrep -v "^[0-9]+;${tag}\$" "${statefile}" 2>/dev/null \
+ grep -E -v "^[0-9]+;${tag}\$" "${statefile}" 2>/dev/null \
> "${statefile}.$$"
echo "${time_now};${tag}" >> "${statefile}.$$"
mv -f "${statefile}.$$" "${statefile}"
static void
zhack_do_feature_enable(int argc, char **argv)
{
- char c;
+ int c;
char *desc, *target;
spa_t *spa;
objset_t *mos;
static void
zhack_do_feature_ref(int argc, char **argv)
{
- char c;
+ int c;
char *target;
boolean_t decr = B_FALSE;
spa_t *spa;
char *path[MAX_NUM_PATHS];
const char *subcommand;
int rv = 0;
- char c;
+ int c;
g_importargs.path = path;
/*
* If this is a replacing or spare vdev, then
- * get the real first child of the vdev.
+ * get the real first child of the vdev: do this
+ * in a loop because replacing and spare vdevs
+ * can be nested.
*/
- if (strcmp(childtype,
+ while (strcmp(childtype,
VDEV_TYPE_REPLACING) == 0 ||
strcmp(childtype, VDEV_TYPE_SPARE) == 0) {
nvlist_t **rchild;
name=${PACKAGE}; \
version=${VERSION}-${RELEASE}; \
arch=`$(RPM) -qp $${name}-kmod-$${version}.src.rpm --qf %{arch} | tail -1`; \
+ debarch=`$(DPKG) --print-architecture`; \
pkg1=kmod-$${name}*$${version}.$${arch}.rpm; \
- fakeroot $(ALIEN) --bump=0 --scripts --to-deb $$pkg1; \
+ fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1; \
$(RM) $$pkg1
name=${PACKAGE}; \
version=${VERSION}-${RELEASE}; \
arch=`$(RPM) -qp $${name}-dkms-$${version}.src.rpm --qf %{arch} | tail -1`; \
+ debarch=`$(DPKG) --print-architecture`; \
pkg1=$${name}-dkms-$${version}.$${arch}.rpm; \
- fakeroot $(ALIEN) --bump=0 --scripts --to-deb $$pkg1; \
+ fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1; \
$(RM) $$pkg1
deb-utils: deb-local rpm-utils
name=${PACKAGE}; \
version=${VERSION}-${RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
+ debarch=`$(DPKG) --print-architecture`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
pkg2=libnvpair1-$${version}.$${arch}.rpm; \
pkg3=libuutil1-$${version}.$${arch}.rpm; \
## which should NOT be mixed with the alien-generated debs created here
chmod +x $${path_prepend}/dh_shlibdeps; \
env PATH=$${path_prepend}:$${PATH} \
- fakeroot $(ALIEN) --bump=0 --scripts --to-deb \
+ fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch \
$$pkg1 $$pkg2 $$pkg3 $$pkg4 $$pkg5 $$pkg6 $$pkg7 \
$$pkg8 $$pkg9; \
$(RM) $${path_prepend}/dh_shlibdeps; \
dnl # Linux 4.1 API
dnl #
AC_DEFUN([ZFS_AC_KERNEL_NEW_SYNC_READ],
- [AC_MSG_CHECKING([whether new_sync_read() is available])
+ [AC_MSG_CHECKING([whether new_sync_read/write() are available])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
- new_sync_read(NULL, NULL, 0, NULL);
+ ssize_t ret __attribute__ ((unused));
+ struct file *filp = NULL;
+ char __user *rbuf = NULL;
+ const char __user *wbuf = NULL;
+ size_t len = 0;
+ loff_t ppos;
+
+ ret = new_sync_read(filp, rbuf, len, &ppos);
+ ret = new_sync_write(filp, wbuf, len, &ppos);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_NEW_SYNC_READ, 1,
- [new_sync_read() is available])
+ [new_sync_read()/new_sync_write() are available])
],[
AC_MSG_RESULT(no)
])
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for zfs 0.7.5.
+# Generated by GNU Autoconf 2.63 for zfs 0.7.6.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# Identity of this package.
PACKAGE_NAME='zfs'
PACKAGE_TARNAME='zfs'
-PACKAGE_VERSION='0.7.5'
-PACKAGE_STRING='zfs 0.7.5'
+PACKAGE_VERSION='0.7.6'
+PACKAGE_STRING='zfs 0.7.6'
PACKAGE_BUGREPORT=''
# Factoring default headers for most tests.
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures zfs 0.7.5 to adapt to many kinds of systems.
+\`configure' configures zfs 0.7.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of zfs 0.7.5:";;
+ short | recursive ) echo "Configuration of zfs 0.7.6:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-zfs configure 0.7.5
+zfs configure 0.7.6
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by zfs $as_me 0.7.5, which was
+It was created by zfs $as_me 0.7.6, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
# Define the identity of the package.
PACKAGE='zfs'
- VERSION='0.7.5'
+ VERSION='0.7.6'
cat >>confdefs.h <<_ACEOF
_ACEOF
- { $as_echo "$as_me:$LINENO: checking whether new_sync_read() is available" >&5
-$as_echo_n "checking whether new_sync_read() is available... " >&6; }
+ { $as_echo "$as_me:$LINENO: checking whether new_sync_read/write() are available" >&5
+$as_echo_n "checking whether new_sync_read/write() are available... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.c
main (void)
{
- new_sync_read(NULL, NULL, 0, NULL);
+ ssize_t ret __attribute__ ((unused));
+ struct file *filp = NULL;
+ char __user *rbuf = NULL;
+ const char __user *wbuf = NULL;
+ size_t len = 0;
+ loff_t ppos;
+
+ ret = new_sync_read(filp, rbuf, len, &ppos);
+ ret = new_sync_write(filp, wbuf, len, &ppos);
;
return 0;
_ACEOF
- { $as_echo "$as_me:$LINENO: checking whether new_sync_read() is available" >&5
-$as_echo_n "checking whether new_sync_read() is available... " >&6; }
+ { $as_echo "$as_me:$LINENO: checking whether new_sync_read/write() are available" >&5
+$as_echo_n "checking whether new_sync_read/write() are available... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.c
main (void)
{
- new_sync_read(NULL, NULL, 0, NULL);
+ ssize_t ret __attribute__ ((unused));
+ struct file *filp = NULL;
+ char __user *rbuf = NULL;
+ const char __user *wbuf = NULL;
+ size_t len = 0;
+ loff_t ppos;
+
+ ret = new_sync_read(filp, rbuf, len, &ppos);
+ ret = new_sync_write(filp, wbuf, len, &ppos);
;
return 0;
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by zfs $as_me 0.7.5, which was
+This file was extended by zfs $as_me 0.7.6, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-zfs config.status 0.7.5
+zfs config.status 0.7.6
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
NFS_SRV=nfs; \
fi; \
if [ -e /sbin/openrc-run ]; then \
- SHELL=/sbin/runscript; \
+ SHELL=/sbin/openrc-run; \
else \
SHELL=/bin/sh; \
fi; \
NFS_SRV=nfs; \
fi; \
if [ -e /sbin/openrc-run ]; then \
- SHELL=/sbin/runscript; \
+ SHELL=/sbin/openrc-run; \
else \
SHELL=/bin/sh; \
fi; \
void arc_buf_info(arc_buf_t *buf, arc_buf_info_t *abi, int state_index);
uint64_t arc_buf_size(arc_buf_t *buf);
uint64_t arc_buf_lsize(arc_buf_t *buf);
+void arc_buf_access(arc_buf_t *buf);
void arc_release(arc_buf_t *buf, void *tag);
int arc_released(arc_buf_t *buf);
void arc_buf_sigsegv(int sig, siginfo_t *si, void *unused);
* to stable storage and will also be called if the dmu_tx is aborted.
* If there is any error which prevents the transaction from being committed to
* disk, the callback will be called with a value of error != 0.
+ *
+ * When multiple callbacks are registered to the transaction, the callbacks
+ * will be called in reverse order to let Lustre, the only user of commit
+ * callback currently, take the fast path of its commit callback handling.
*/
typedef void dmu_tx_callback_func_t(void *dcb_data, int error);
void dmu_tx_callback_register(dmu_tx_t *tx, dmu_tx_callback_func_t *dcb_func,
void *dcb_data);
+void dmu_tx_do_callbacks(list_t *cb_list, int error);
/*
* Free up the data blocks for a defined range of a file. If size is
struct dsl_pool *dmu_tx_pool(dmu_tx_t *tx);
void dmu_tx_wait(dmu_tx_t *tx);
-void dmu_tx_callback_register(dmu_tx_t *tx, dmu_tx_callback_func_t *dcb_func,
- void *dcb_data);
-void dmu_tx_do_callbacks(list_t *cb_list, int error);
-
/*
* These routines are defined in dmu_spa.h, and are called by the SPA.
*/
extern void vdev_queue_io_done(zio_t *zio);
extern int vdev_queue_length(vdev_t *vd);
-extern uint64_t vdev_queue_lastoffset(vdev_t *vd);
-extern void vdev_queue_register_lastoffset(vdev_t *vd, zio_t *zio);
+extern uint64_t vdev_queue_last_offset(vdev_t *vd);
extern void vdev_config_dirty(vdev_t *vd);
extern void vdev_config_clean(vdev_t *vd);
hrtime_t vq_io_delta_ts;
zio_t vq_io_search; /* used as local for stack reduction */
kmutex_t vq_lock;
- uint64_t vq_lastoffset;
};
/*
} raidz_impl_ops_t;
typedef struct raidz_col {
- size_t rc_devidx; /* child device index for I/O */
- size_t rc_offset; /* device offset */
- size_t rc_size; /* I/O size */
+ uint64_t rc_devidx; /* child device index for I/O */
+ uint64_t rc_offset; /* device offset */
+ uint64_t rc_size; /* I/O size */
abd_t *rc_abd; /* I/O data */
void *rc_gdata; /* used to store the "good" version */
int rc_error; /* I/O error for this device */
- unsigned int rc_tried; /* Did we attempt this I/O column? */
- unsigned int rc_skipped; /* Did we skip this I/O column? */
+ uint8_t rc_tried; /* Did we attempt this I/O column? */
+ uint8_t rc_skipped; /* Did we skip this I/O column? */
} raidz_col_t;
typedef struct raidz_map {
- size_t rm_cols; /* Regular column count */
- size_t rm_scols; /* Count including skipped columns */
- size_t rm_bigcols; /* Number of oversized columns */
- size_t rm_asize; /* Actual total I/O size */
- size_t rm_missingdata; /* Count of missing data devices */
- size_t rm_missingparity; /* Count of missing parity devices */
- size_t rm_firstdatacol; /* First data column/parity count */
- size_t rm_nskip; /* Skipped sectors for padding */
- size_t rm_skipstart; /* Column index of padding start */
+ uint64_t rm_cols; /* Regular column count */
+ uint64_t rm_scols; /* Count including skipped columns */
+ uint64_t rm_bigcols; /* Number of oversized columns */
+ uint64_t rm_asize; /* Actual total I/O size */
+ uint64_t rm_missingdata; /* Count of missing data devices */
+ uint64_t rm_missingparity; /* Count of missing parity devices */
+ uint64_t rm_firstdatacol; /* First data column/parity count */
+ uint64_t rm_nskip; /* Skipped sectors for padding */
+ uint64_t rm_skipstart; /* Column index of padding start */
abd_t *rm_abd_copy; /* rm_asize-buffer of copied data */
- size_t rm_reports; /* # of referencing checksum reports */
- unsigned int rm_freed; /* map no longer has referencing ZIO */
- unsigned int rm_ecksuminjected; /* checksum error was injected */
+ uintptr_t rm_reports; /* # of referencing checksum reports */
+ uint8_t rm_freed; /* map no longer has referencing ZIO */
+ uint8_t rm_ecksuminjected; /* checksum error was injected */
raidz_impl_ops_t *rm_ops; /* RAIDZ math operations */
raidz_col_t rm_col[1]; /* Flexible array of I/O columns */
} raidz_map_t;
sa_enable_share(sa_share_t share, char *protocol)
{
sa_share_impl_t impl_share = (sa_share_impl_t)share;
- int rc, ret;
- boolean_t found_protocol;
+ int rc, ret = SA_OK;
+ boolean_t found_protocol = B_FALSE;
sa_fstype_t *fstype;
-#ifdef DEBUG
- fprintf(stderr, "sa_enable_share: share->sharepath=%s, protocol=%s\n",
- impl_share->sharepath, protocol);
-#endif
-
- assert(impl_share->handle != NULL);
-
- ret = SA_OK;
- found_protocol = B_FALSE;
-
fstype = fstypes;
while (fstype != NULL) {
if (protocol == NULL || strcmp(fstype->name, protocol) == 0) {
sa_disable_share(sa_share_t share, char *protocol)
{
sa_share_impl_t impl_share = (sa_share_impl_t)share;
- int rc, ret;
- boolean_t found_protocol;
+ int rc, ret = SA_OK;
+ boolean_t found_protocol = B_FALSE;
sa_fstype_t *fstype;
-#ifdef DEBUG
- fprintf(stderr, "sa_disable_share: share->sharepath=%s, protocol=%s\n",
- impl_share->sharepath, protocol);
-#endif
-
- ret = SA_OK;
- found_protocol = B_FALSE;
-
fstype = fstypes;
while (fstype != NULL) {
if (protocol == NULL || strcmp(fstype->name, protocol) == 0) {
{
sa_fstype_t *fstype;
-#ifdef DEBUG
- fprintf(stderr, "sa_parse_legacy_options: options=%s, proto=%s\n",
- options, proto);
-#endif
-
fstype = fstypes;
while (fstype != NULL) {
if (strcmp(fstype->name, proto) != 0) {
sa_handle_impl_t impl_handle = (sa_handle_impl_t)handle;
sa_share_impl_t impl_share = (sa_share_impl_t)share;
-#ifdef DEBUG
- fprintf(stderr, "sa_zfs_process_share: mountpoint=%s, proto=%s, "
- "shareopts=%s, sourcestr=%s, dataset=%s\n", mountpoint, proto,
- shareopts, sourcestr, dataset);
-#endif
-
return (process_share(impl_handle, impl_share, mountpoint, NULL,
proto, shareopts, NULL, dataset, B_FALSE));
}
Name: libzfs
Description: LibZFS library
-Version: 0.7.5
+Version: 0.7.6
URL: http://zfsonlinux.org
Requires: libzfs_core
Cflags: -I${includedir}/libzfs -I${includedir}/libspl
Name: libzfs_core
Description: LibZFS core library
-Version: 0.7.5
+Version: 0.7.6
URL: http://zfsonlinux.org
Cflags: -I${includedir}/libzfs -I${includedir}/libspl
Libs: -L${libdir} -lzfs_core
get_source(zfs_handle_t *zhp, zprop_source_t *srctype, char *source,
char *statbuf, size_t statlen)
{
- if (statbuf == NULL || *srctype == ZPROP_SRC_TEMPORARY)
+ if (statbuf == NULL ||
+ srctype == NULL || *srctype == ZPROP_SRC_TEMPORARY) {
return;
+ }
if (source == NULL) {
*srctype = ZPROP_SRC_NONE;
dev = udev_device_new_from_subsystem_sysname(udev,
"block", sysname);
if ((dev != NULL) && udev_device_is_ready(dev)) {
- struct udev_list_entry *links, *link;
+ struct udev_list_entry *links, *link = NULL;
ret = 0;
links = udev_device_get_devlinks_list_entry(dev);
nvlist_t *oxprops = NULL; /* override (-o) and exclude (-x) props */
nvlist_t *origprops = NULL; /* original props (if destination exists) */
zfs_type_t type;
- boolean_t toplevel;
+ boolean_t toplevel = B_FALSE;
boolean_t zoned = B_FALSE;
begin_time = time(NULL);
goto out;
}
- toplevel = chopprefix[0] != '/';
+ if (top_zfs && *top_zfs == NULL)
+ toplevel = B_TRUE;
if (drrb->drr_type == DMU_OST_ZVOL) {
type = ZFS_TYPE_VOLUME;
} else if (drrb->drr_type == DMU_OST_ZFS) {
Default value: \fB200\fR.
.RE
-.sp
-.ne 2
-.na
-\fBl2arc_nocompress\fR (int)
-.ad
-.RS 12n
-Skip compressing L2ARC buffers
-.sp
-Use \fB1\fR for yes and \fB0\fR for no (default).
-.RE
-
.sp
.ne 2
.na
struct list_head pages;
struct sg_table table;
struct scatterlist *sg;
- struct page *page, *tmp_page;
+ struct page *page, *tmp_page = NULL;
gfp_t gfp = __GFP_NOWARN | GFP_NOIO;
gfp_t gfp_comp = (gfp | __GFP_NORETRY | __GFP_COMP) & ~__GFP_RECLAIM;
int max_order = MIN(zfs_abd_scatter_max_order, MAX_ORDER - 1);
static void
abd_alloc_pages(abd_t *abd, size_t size)
{
- struct scatterlist *sg;
+ struct scatterlist *sg = NULL;
struct sg_table table;
struct page *page;
gfp_t gfp = __GFP_NOWARN | GFP_NOIO;
int nr_pages = abd_chunkcnt_for_bytes(size);
- int i;
+ int i = 0;
while (sg_alloc_table(&table, nr_pages, gfp)) {
ABDSTAT_BUMP(abdstat_scatter_sg_table_retry);
static void
abd_free_pages(abd_t *abd)
{
- struct scatterlist *sg;
+ struct scatterlist *sg = NULL;
struct sg_table table;
struct page *page;
int nr_pages = ABD_SCATTER(abd).abd_nents;
- int order, i;
+ int order, i = 0;
if (abd->abd_flags & ABD_FLAG_MULTI_ZONE)
ABDSTAT_BUMPDOWN(abdstat_scatter_page_multi_zone);
ASSERT3P(abd->abd_u.abd_linear.abd_buf, !=, NULL);
} else {
size_t n;
- int i;
- struct scatterlist *sg;
+ int i = 0;
+ struct scatterlist *sg = NULL;
ASSERT3U(ABD_SCATTER(abd).abd_nents, >, 0);
ASSERT3U(ABD_SCATTER(abd).abd_offset, <,
abd->abd_u.abd_linear.abd_buf =
(char *)sabd->abd_u.abd_linear.abd_buf + off;
} else {
- int i;
- struct scatterlist *sg;
+ int i = 0;
+ struct scatterlist *sg = NULL;
size_t new_offset = sabd->abd_u.abd_scatter.abd_offset + off;
abd = abd_alloc_struct();
* by multiple buffers.
*/
kstat_named_t arcstat_mutex_miss;
+ /*
+ * Number of buffers skipped when updating the access state due to the
+ * header having already been released after acquiring the hash lock.
+ */
+ kstat_named_t arcstat_access_skip;
/*
* Number of buffers skipped because they have I/O in progress, are
- * indrect prefetch buffers that have not lived long enough, or are
+ * indirect prefetch buffers that have not lived long enough, or are
* not from the spa we're trying to evict from.
*/
kstat_named_t arcstat_evict_skip;
{ "mfu_ghost_hits", KSTAT_DATA_UINT64 },
{ "deleted", KSTAT_DATA_UINT64 },
{ "mutex_miss", KSTAT_DATA_UINT64 },
+ { "access_skip", KSTAT_DATA_UINT64 },
{ "evict_skip", KSTAT_DATA_UINT64 },
{ "evict_not_enough", KSTAT_DATA_UINT64 },
{ "evict_l2_cached", KSTAT_DATA_UINT64 },
}
}
-/* a generic arc_done_func_t which you can use */
+/*
+ * This routine is called by dbuf_hold() to update the arc_access() state
+ * which otherwise would be skipped for entries in the dbuf cache.
+ */
+void
+arc_buf_access(arc_buf_t *buf)
+{
+ mutex_enter(&buf->b_evict_lock);
+ arc_buf_hdr_t *hdr = buf->b_hdr;
+
+ /*
+ * Avoid taking the hash_lock when possible as an optimization.
+ * The header must be checked again under the hash_lock in order
+ * to handle the case where it is concurrently being released.
+ */
+ if (hdr->b_l1hdr.b_state == arc_anon || HDR_EMPTY(hdr)) {
+ mutex_exit(&buf->b_evict_lock);
+ return;
+ }
+
+ kmutex_t *hash_lock = HDR_LOCK(hdr);
+ mutex_enter(hash_lock);
+
+ if (hdr->b_l1hdr.b_state == arc_anon || HDR_EMPTY(hdr)) {
+ mutex_exit(hash_lock);
+ mutex_exit(&buf->b_evict_lock);
+ ARCSTAT_BUMP(arcstat_access_skip);
+ return;
+ }
+
+ mutex_exit(&buf->b_evict_lock);
+
+ ASSERT(hdr->b_l1hdr.b_state == arc_mru ||
+ hdr->b_l1hdr.b_state == arc_mfu);
+
+ DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr);
+ arc_access(hdr, hash_lock);
+ mutex_exit(hash_lock);
+
+ ARCSTAT_BUMP(arcstat_hits);
+ ARCSTAT_CONDSTAT(!HDR_PREFETCH(hdr), demand, prefetch,
+ !HDR_ISTYPE_METADATA(hdr), data, metadata, hits);
+}
+
+/* a generic arc_read_done_func_t which you can use */
/* ARGSUSED */
void
arc_bcopy_func(zio_t *zio, arc_buf_t *buf, void *arg)
return (SET_ERROR(ENOENT));
}
- if (dh->dh_db->db_buf != NULL)
+ if (dh->dh_db->db_buf != NULL) {
+ arc_buf_access(dh->dh_db->db_buf);
ASSERT3P(dh->dh_db->db.db_data, ==, dh->dh_db->db_buf->b_data);
+ }
ASSERT(dh->dh_db->db_buf == NULL || arc_referenced(dh->dh_db->db_buf));
dmu_tx_hold_bonus(tx, obj);
objerr = dmu_tx_assign(tx, TXG_WAIT);
if (objerr != 0) {
+ dmu_buf_rele(db, FTAG);
dmu_tx_abort(tx);
continue;
}
{
dmu_tx_callback_t *dcb;
- while ((dcb = list_head(cb_list)) != NULL) {
+ while ((dcb = list_tail(cb_list)) != NULL) {
list_remove(cb_list, dcb);
dcb->dcb_func(dcb->dcb_data, error);
kmem_free(dcb, sizeof (dmu_tx_callback_t));
rw_enter(&zf->zf_rwlock, RW_READER);
+ /*
+ * Find matching prefetch stream. Depending on whether the accesses
+ * are block-aligned, first block of the new access may either follow
+ * the last block of the previous access, or be equal to it.
+ */
for (zs = list_head(&zf->zf_stream); zs != NULL;
zs = list_next(&zf->zf_stream, zs)) {
- if (blkid == zs->zs_blkid) {
+ if (blkid == zs->zs_blkid || blkid + 1 == zs->zs_blkid) {
mutex_enter(&zs->zs_lock);
/*
* zs_blkid could have changed before we
* acquired zs_lock; re-check them here.
*/
- if (blkid != zs->zs_blkid) {
- mutex_exit(&zs->zs_lock);
- continue;
+ if (blkid == zs->zs_blkid) {
+ break;
+ } else if (blkid + 1 == zs->zs_blkid) {
+ blkid++;
+ nblks--;
+ if (nblks == 0) {
+ /* Already prefetched this before. */
+ mutex_exit(&zs->zs_lock);
+ rw_exit(&zf->zf_rwlock);
+ return;
+ }
+ break;
}
- break;
+ mutex_exit(&zs->zs_lock);
}
}
static int
vdev_mirror_load(mirror_map_t *mm, vdev_t *vd, uint64_t zio_offset)
{
- uint64_t lastoffset;
+ uint64_t last_offset;
+ int64_t offset_diff;
int load;
/* All DVAs have equal weight at the root. */
* worse overall when resilvering with compared to without.
*/
+ /* Fix zio_offset for leaf vdevs */
+ if (vd->vdev_ops->vdev_op_leaf)
+ zio_offset += VDEV_LABEL_START_SIZE;
+
/* Standard load based on pending queue length. */
load = vdev_queue_length(vd);
- lastoffset = vdev_queue_lastoffset(vd);
+ last_offset = vdev_queue_last_offset(vd);
if (vd->vdev_nonrot) {
/* Non-rotating media. */
- if (lastoffset == zio_offset)
+ if (last_offset == zio_offset)
return (load + zfs_vdev_mirror_non_rotating_inc);
/*
}
/* Rotating media I/O's which directly follow the last I/O. */
- if (lastoffset == zio_offset)
+ if (last_offset == zio_offset)
return (load + zfs_vdev_mirror_rotating_inc);
/*
* Apply half the seek increment to I/O's within seek offset
- * of the last I/O queued to this vdev as they should incur less
+ * of the last I/O issued to this vdev as they should incur less
* of a seek increment.
*/
- if (ABS(lastoffset - zio_offset) <
- zfs_vdev_mirror_rotating_seek_offset)
+ offset_diff = (int64_t)(last_offset - zio_offset);
+ if (ABS(offset_diff) < zfs_vdev_mirror_rotating_seek_offset)
return (load + (zfs_vdev_mirror_rotating_seek_inc / 2));
/* Apply the full seek increment to all other I/O's. */
mm->mm_preferred_cnt++;
}
- if (mm->mm_preferred_cnt == 1) {
- vdev_queue_register_lastoffset(
- mm->mm_child[mm->mm_preferred[0]].mc_vd, zio);
+ if (mm->mm_preferred_cnt == 1)
return (mm->mm_preferred[0]);
- }
- if (mm->mm_preferred_cnt > 1) {
- int c = vdev_mirror_preferred_child_randomize(zio);
- vdev_queue_register_lastoffset(mm->mm_child[c].mc_vd, zio);
- return (c);
- }
+ if (mm->mm_preferred_cnt > 1)
+ return (vdev_mirror_preferred_child_randomize(zio));
/*
* Every device is either missing or has this txg in its DTL.
* Look for any child we haven't already tried before giving up.
*/
for (c = 0; c < mm->mm_children; c++) {
- if (!mm->mm_child[c].mc_tried) {
- vdev_queue_register_lastoffset(mm->mm_child[c].mc_vd,
- zio);
+ if (!mm->mm_child[c].mc_tried)
return (c);
- }
}
/*
sizeof (zio_t), offsetof(struct zio, io_queue_node));
}
- vq->vq_lastoffset = 0;
+ vq->vq_last_offset = 0;
}
void
*/
tree = vdev_queue_class_tree(vq, p);
vq->vq_io_search.io_timestamp = 0;
- vq->vq_io_search.io_offset = vq->vq_last_offset + 1;
- VERIFY3P(avl_find(tree, &vq->vq_io_search,
- &idx), ==, NULL);
+ vq->vq_io_search.io_offset = vq->vq_last_offset - 1;
+ VERIFY3P(avl_find(tree, &vq->vq_io_search, &idx), ==, NULL);
zio = avl_nearest(tree, idx, AVL_AFTER);
if (zio == NULL)
zio = avl_first(tree);
}
vdev_queue_pending_add(vq, zio);
- vq->vq_last_offset = zio->io_offset;
+ vq->vq_last_offset = zio->io_offset + zio->io_size;
return (zio);
}
}
/*
- * As these three methods are only used for load calculations we're not
+ * As these two methods are only used for load calculations we're not
* concerned if we get an incorrect value on 32bit platforms due to lack of
* vq_lock mutex use here, instead we prefer to keep it lock free for
* performance.
}
uint64_t
-vdev_queue_lastoffset(vdev_t *vd)
+vdev_queue_last_offset(vdev_t *vd)
{
- return (vd->vdev_queue.vq_lastoffset);
-}
-
-void
-vdev_queue_register_lastoffset(vdev_t *vd, zio_t *zio)
-{
- vd->vdev_queue.vq_lastoffset = zio->io_offset + zio->io_size;
+ return (vd->vdev_queue.vq_last_offset);
}
#if defined(_KERNEL) && defined(HAVE_SPL)
* Indicate whether the directory is empty. Works with or without z_lock
* held, but can only be consider a hint in the latter case. Returns true
* if only "." and ".." remain and there's no work in progress.
+ *
+ * The internal ZAP size, rather than zp->z_size, needs to be checked since
+ * some consumers (Lustre) do not strictly maintain an accurate SA_ZPL_SIZE.
*/
boolean_t
zfs_dirempty(znode_t *dzp)
{
- return (dzp->z_size == 2 && dzp->z_dirlocks == 0);
+ zfsvfs_t *zfsvfs = ZTOZSB(dzp);
+ uint64_t count;
+ int error;
+
+ if (dzp->z_dirlocks != NULL)
+ return (B_FALSE);
+
+ error = zap_count(zfsvfs->z_os, dzp->z_id, &count);
+ if (error != 0 || count != 0)
+ return (B_FALSE);
+
+ return (B_TRUE);
}
int
zfs_ioc_pool_sync(const char *pool, nvlist_t *innvl, nvlist_t *onvl)
{
int err;
- boolean_t force;
+ boolean_t force = B_FALSE;
spa_t *spa;
if ((err = spa_open(pool, &spa, FTAG)) != 0)
return (err);
- force = fnvlist_lookup_boolean_value(innvl, "force");
+ if (innvl) {
+ if (nvlist_lookup_boolean_value(innvl, "force", &force) != 0) {
+ err = SET_ERROR(EINVAL);
+ goto out;
+ }
+ }
+
if (force) {
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_WRITER);
vdev_config_dirty(spa->spa_root_vdev);
spa_config_exit(spa, SCL_CONFIG, FTAG);
}
txg_wait_synced(spa_get_dsl(spa), 0);
-
+out:
spa_close(spa, FTAG);
return (err);
aiov->iov_base != abuf->b_data)) {
ASSERT(xuio);
dmu_write(zfsvfs->z_os, zp->z_id, woff,
+ /* cppcheck-suppress nullPointer */
aiov->iov_len, aiov->iov_base, tx);
dmu_return_arcbuf(abuf);
xuio_stat_wbuf_copied();
if (error)
return (error);
- if (!size)
+ if (size == 0 || value == NULL)
return (nv_size);
if (size < nv_size)
zvol_find_by_name_hash(const char *name, uint64_t hash, int mode)
{
zvol_state_t *zv;
- struct hlist_node *p;
+ struct hlist_node *p = NULL;
mutex_enter(&zvol_state_lock);
hlist_for_each(p, ZVOL_HT_HEAD(hash)) {
rm -rf $RPM_BUILD_ROOT
%changelog
+* Thu Feb 01 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.6-1
+- Released 0.7.6-1, detailed release notes are available at:
+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.6
* Mon Dec 18 2017 Tony Hutter <hutter2@llnl.gov> - 0.7.5-1
- Released 0.7.5-1, detailed release notes are available at:
- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.5
%endif
%changelog
+* Thu Feb 01 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.6-1
+- Released 0.7.6-1, detailed release notes are available at:
+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.6
* Mon Dec 18 2017 Tony Hutter <hutter2@llnl.gov> - 0.7.5-1
- Released 0.7.5-1, detailed release notes are available at:
- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.5
%endif
%changelog
+* Thu Feb 01 2018 Tony Hutter <hutter2@llnl.gov> - 0.7.6-1
+- Released 0.7.6-1, detailed release notes are available at:
+- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.6
* Mon Dec 18 2017 Tony Hutter <hutter2@llnl.gov> - 0.7.5-1
- Released 0.7.5-1, detailed release notes are available at:
- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.5
# is this the beginning or ending of a function?
# (not if "struct foo\n{\n")
- if (/^{$/ && $prev =~ /\)\s*(const\s*)?(\/\*.*\*\/\s*)?\\?$/) {
+ if (/^\{$/ && $prev =~ /\)\s*(const\s*)?(\/\*.*\*\/\s*)?\\?$/) {
$in_function = 1;
$in_declaration = 1;
$in_function_header = 0;
$prev = $line;
next line;
}
- if (/^}\s*(\/\*.*\*\/\s*)*$/) {
+ if (/^\}\s*(\/\*.*\*\/\s*)*$/) {
if ($prev =~ /^\s*return\s*;/) {
err_prev("unneeded return at end of function");
}
next line;
}
if ($in_function_header && ! /^ (\w|\.)/ ) {
- if (/^{}$/ # empty functions
+ if (/^\{\}$/ # empty functions
|| /;/ #run function with multiline arguments
|| /#/ #preprocessor commands
|| /^[^\s\\]*\(.*\)$/ #functions without ; at the end
$function_header_full_indent = 1;
}
}
- if ($in_function_header && /^{$/) {
+ if ($in_function_header && /^\{$/) {
$in_function_header = 0;
$function_header_full_indent = 0;
$in_function = 1;
$in_function_header = 0;
$function_header_full_indent = 0;
}
- if ($in_function_header && /{$/ ) {
+ if ($in_function_header && /\{$/ ) {
if ($picky) {
err("opening brace on same line as function header");
}
if (/\S\{/ && !/\{\{/) {
err("missing space before left brace");
}
- if ($in_function && /^\s+{/ &&
+ if ($in_function && /^\s+\{/ &&
($prev =~ /\)\s*$/ || $prev =~ /\bstruct\s+\w+$/)) {
err("left brace starting a line");
}
- if (/}(else|while)/) {
+ if (/\}(else|while)/) {
err("missing space after right brace");
}
- if (/}\s\s+(else|while)/) {
+ if (/\}\s\s+(else|while)/) {
err("extra space after right brace");
}
if (/\b_VOID\b|\bVOID\b|\bSTATIC\b/) {
if ($heuristic) {
# cannot check this everywhere due to "struct {\n...\n} foo;"
if ($in_function && !$in_declaration &&
- /}./ && !/}\s+=/ && !/{.*}[;,]$/ && !/}(\s|\ 1)*$/ &&
- !/} (else|while)/ && !/}}/) {
+ /\}./ && !/\}\s+=/ && !/\{.*\}[;,]$/ && !/\}(\s|\ 1)*$/ &&
+ !/\} (else|while)/ && !/\}\}/) {
err("possible bad text following right brace");
}
# cannot check this because sub-blocks in
# the middle of code are ok
- if ($in_function && /^\s+{/) {
+ if ($in_function && /^\s+\{/) {
err("possible left brace starting a line");
}
}
if (/^\s*else\W/) {
- if ($prev =~ /^\s*}$/) {
+ if ($prev =~ /^\s*\}$/) {
err_prefix($prev,
"else and right brace should be on same line");
}
# skip over enumerations, array definitions, initializers, etc.
if ($cont_off <= 0 && !/^\s*$special/ &&
- (/(?:(?:\b(?:enum|struct|union)\s*[^\{]*)|(?:\s+=\s*)){/ ||
- (/^\s*{/ && $prev =~ /=\s*(?:\/\*.*\*\/\s*)*$/))) {
+ (/(?:(?:\b(?:enum|struct|union)\s*[^\{]*)|(?:\s+=\s*))\{/ ||
+ (/^\s*\{/ && $prev =~ /=\s*(?:\/\*.*\*\/\s*)*$/))) {
$cont_in = 0;
$cont_off = tr/{/{/ - tr/}/}/;
return;
return if (/^\s*\}?$/);
return if (/^\s*\}?\s*else\s*\{?$/);
return if (/^\s*do\s*\{?$/);
- return if (/{$/);
- return if (/}[,;]?$/);
+ return if (/\{$/);
+ return if (/\}[,;]?$/);
# Allow macros on their own lines
return if (/^\s*[A-Z_][A-Z_0-9]*$/);
# cases we don't deal with, generally non-kosher
- if (/{/) {
+ if (/\{/) {
err("stuff after {");
return;
}
#
next if (@cont_paren != 0);
if ($cont_special) {
- if ($rest =~ /^\s*{?$/) {
+ if ($rest =~ /^\s*\{?$/) {
$cont_in = 0;
last;
}
" -s Size of vdev devices.\n" \
" -f Specify working directory for ztest vdev files.\n" \
" -c Specify a core dump directory to use.\n" \
+ " -m Max number of core dumps to allow before exiting.\n" \
+ " -l Create 'ztest.core.N' symlink to core directory.\n" \
" -h Print this help message.\n" \
"" >&2
}
# core file helpers
origcorepattern="$(cat /proc/sys/kernel/core_pattern)"
-coreglob="$(egrep -o '^([^|%[:space:]]*)' /proc/sys/kernel/core_pattern)*"
+coreglob="$(grep -E -o '^([^|%[:space:]]*)' /proc/sys/kernel/core_pattern)*"
if [[ $coreglob = "*" ]]; then
echo "Setting core file pattern..."
echo "core" > /proc/sys/kernel/core_pattern
- coreglob="$(egrep -o '^([^|%[:space:]]*)' \
+ coreglob="$(grep -E -o '^([^|%[:space:]]*)' \
/proc/sys/kernel/core_pattern)*"
fi
{
core="$(core_file)"
if [[ $ztrc -ne 0 ]] || [[ -f "$core" ]]; then
+ df -h "$workdir" >>ztest.out
coreid=$(date "+zloop-%y%m%d-%H%M%S")
foundcrashes=$((foundcrashes + 1))
+ # zdb debugging
+ zdbcmd="$ZDB -U "$workdir/zpool.cache" -dddMmDDG ztest"
+ zdbdebug=$($zdbcmd 2>&1)
+ echo -e "$zdbcmd\n" >>ztest.zdb
+ echo "$zdbdebug" >>ztest.zdb
+
dest=$coredir/$coreid
or_die mkdir -p "$dest"
or_die mkdir -p "$dest/vdev"
+ if [[ $symlink -ne 0 ]]; then
+ or_die ln -sf "$dest" ztest.core.$foundcrashes
+ fi
+
echo "*** ztest crash found - moving logs to $dest"
or_die mv ztest.history "$dest/"
- or_die mv ztest.ddt "$dest/"
+ or_die mv ztest.zdb "$dest/"
or_die mv ztest.out "$dest/"
or_die mv "$workdir/ztest*" "$dest/vdev/"
or_die mv "$workdir/zpool.cache" "$dest/vdev/"
# check for core
if [[ -f "$core" ]]; then
coreprog=$(core_prog "$core")
- corestatus=$($GDB --batch --quiet \
+ coredebug=$($GDB --batch --quiet \
-ex "set print thread-events off" \
-ex "printf \"*\n* Backtrace \n*\n\"" \
-ex "bt" \
-ex "thread apply all bt" \
-ex "printf \"*\n* Backtraces (full) \n*\n\"" \
-ex "thread apply all bt full" \
- -ex "quit" "$coreprog" "$core" | grep -v "New LWP")
+ -ex "quit" "$coreprog" "$core" 2>&1 | \
+ grep -v "New LWP")
# Dump core + logs to stored directory
- echo "$corestatus" >>"$dest/status"
+ echo "$coredebug" >>"$dest/ztest.gdb"
or_die mv "$core" "$dest/"
# Record info in cores logfile
echo "*** core @ $coredir/$coreid/$core:" | \
tee -a ztest.cores
- echo "$corestatus" | tee -a ztest.cores
- echo "" | tee -a ztest.cores
fi
- echo "continuing..."
+
+ if [[ $coremax -gt 0 ]] &&
+ [[ $foundcrashes -ge $coremax ]]; then
+ echo "exiting... max $coremax allowed cores"
+ exit 1
+ else
+ echo "continuing..."
+ fi
fi
}
# parse arguments
# expected format: zloop [-t timeout] [-c coredir] [-- extra ztest args]
coredir=$DEFAULTCOREDIR
-workdir=$DEFAULTWORKDIR
+basedir=$DEFAULTWORKDIR
+rundir="zloop-run"
timeout=0
size="512m"
-while getopts ":ht:s:c:f:" opt; do
+coremax=0
+symlink=0
+while getopts ":ht:m:s:c:f:l" opt; do
case $opt in
t ) [[ $OPTARG -gt 0 ]] && timeout=$OPTARG ;;
+ m ) [[ $OPTARG -gt 0 ]] && coremax=$OPTARG ;;
s ) [[ $OPTARG ]] && size=$OPTARG ;;
c ) [[ $OPTARG ]] && coredir=$OPTARG ;;
- f ) [[ $OPTARG ]] && workdir=$(readlink -f "$OPTARG") ;;
+ f ) [[ $OPTARG ]] && basedir=$(readlink -f "$OPTARG") ;;
+ l ) symlink=1 ;;
h ) usage
exit 2
;;
if [[ -f "$(core_file)" ]]; then
echo -n "There's a core dump here you might want to look at first... "
core_file
+ echo
exit 1
fi
fi
or_die rm -f ztest.history
-or_die rm -f ztest.ddt
+or_die rm -f ztest.zdb
or_die rm -f ztest.cores
ztrc=0 # ztest return value
while [[ $timeout -eq 0 ]] || [[ $curtime -le $((starttime + timeout)) ]]; do
zopt="-VVVVV"
+ # start each run with an empty directory
+ workdir="$basedir/$rundir"
+ or_die rm -rf "$workdir"
+ or_die mkdir "$workdir"
+
# switch between common arrangements & fully randomized
if [[ $((RANDOM % 2)) -eq 0 ]]; then
mirrors=2
echo "$desc" >>ztest.out
$cmd >>ztest.out 2>&1
ztrc=$?
- egrep '===|WARNING' ztest.out >>ztest.history
- $ZDB -U "$workdir/zpool.cache" -DD ztest >>ztest.ddt
+ grep -E '===|WARNING' ztest.out >>ztest.history
store_core
'zpool_add_004_pos', 'zpool_add_005_pos', 'zpool_add_006_pos',
'zpool_add_007_neg', 'zpool_add_008_neg', 'zpool_add_009_neg',
'zpool_add_010_pos',
- 'add-o_ashift', 'add_prop_ashift']
+ 'add-o_ashift', 'add_prop_ashift', 'add_nested_replacing_spare']
tags = ['functional', 'cli_root', 'zpool_add']
[tests/functional/cli_root/zpool_attach]
'zpool_offline_001_neg', 'zpool_online_001_neg', 'zpool_remove_001_neg',
'zpool_replace_001_neg', 'zpool_scrub_001_neg', 'zpool_set_001_neg',
'zpool_status_001_neg', 'zpool_upgrade_001_neg', 'arcstat_001_pos',
- 'arc_summary_001_pos', 'dbufstat_001_pos']
+ 'arc_summary_001_pos', 'arc_summary_002_neg', 'dbufstat_001_pos']
user =
tags = ['functional', 'cli_user', 'misc']
EXTRA_DIST=default.cfg.in
distclean-local::
- -$(RM) $(dist_pkgdata_SCRIPTS)
+ -$(RM) default.cfg
distclean-local::
- -$(RM) $(dist_pkgdata_SCRIPTS)
+ -$(RM) default.cfg
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
return 0
}
+#
+# Wait until a hotspare transitions to a given state or times out.
+#
+# Return 0 when pool/disk matches expected state, 1 on timeout.
+#
+function wait_hotspare_state # pool disk state timeout
+{
+ typeset pool=$1
+ typeset disk=${2#$/DEV_DSKDIR/}
+ typeset state=$3
+ typeset timeout=${4:-60}
+ typeset -i i=0
+
+ while [[ $i -lt $timeout ]]; do
+ if check_hotspare_state $pool $disk $state; then
+ return 0
+ fi
+
+ i=$((i+1))
+ sleep 1
+ done
+
+ return 1
+}
+
#
# Verify a given slog disk is inuse or avail
#
return 0
}
+#
+# Wait until a vdev transitions to a given state or times out.
+#
+# Return 0 when pool/disk matches expected state, 1 on timeout.
+#
+function wait_vdev_state # pool disk state timeout
+{
+ typeset pool=$1
+ typeset disk=${2#$/DEV_DSKDIR/}
+ typeset state=$3
+ typeset timeout=${4:-60}
+ typeset -i i=0
+
+ while [[ $i -lt $timeout ]]; do
+ if check_vdev_state $pool $disk $state; then
+ return 0
+ fi
+
+ i=$((i+1))
+ sleep 1
+ done
+
+ return 1
+}
+
#
# Check the output of 'zpool status -v <pool>',
# and to see if the content of <token> contain the <keyword> specified.
if [[ -f ${ZEDLET_DIR}/zed.pid ]]; then
zedpid=$(cat ${ZEDLET_DIR}/zed.pid)
kill $zedpid
- wait $zedpid
+ while ps -p $zedpid > /dev/null; do
+ sleep 1
+ done
rm -f ${ZEDLET_DIR}/zed.pid
fi
-
return 0
}
+#
+# Drain all zevents
+#
+function zed_events_drain
+{
+ while [ $(zpool events -H | wc -l) -ne 0 ]; do
+ sleep 1
+ zpool events -c >/dev/null
+ done
+}
+
#
# Check is provided device is being active used as a swap device.
#
fi
for xattr in `runat $obj ls | \
- /usr/xpg4/bin/egrep -v -e SUNWattr_ro -e SUNWattr_rw` ; do
+ grep -E -v -e SUNWattr_ro -e SUNWattr_rw` ; do
runat $obj sum $xattr
done
}
log_must eval "check_prop_source $dest atime off local"
log_must eval "check_prop_source $destsub type volume -"
log_must eval "check_prop_source $destsub atime - -"
+# Cleanup
+log_must zfs destroy -r -f $orig
+log_must zfs destroy -r -f $dest
+
+#
+# 3.8 Verify 'zfs recv -x|-o' works correctly when used in conjunction with -d
+# and -e options.
+#
+log_must zfs create -p $orig/1/2/3/4
+log_must eval "zfs set copies=2 $orig"
+log_must eval "zfs set atime=on $orig"
+log_must eval "zfs set '$userprop:orig'='oldval' $orig"
+log_must zfs snapshot -r $orig@snap1
+log_must eval "zfs send -R $orig/1/2@snap1 > $streamfile_repl"
+# Verify 'zfs recv -e'
+log_must zfs create $dest
+log_must eval "zfs receive -e -o copies=3 -x atime "\
+ "-o '$userprop:orig'='newval' $dest < $streamfile_repl"
+log_must datasetexists $dest/2/3/4
+log_must eval "check_prop_source $dest/2 copies 3 local"
+log_must eval "check_prop_inherit $dest/2/3/4 copies $dest/2"
+log_must eval "check_prop_source $dest/2/3/4 atime on default"
+log_must eval "check_prop_source $dest/2 '$userprop:orig' 'newval' local"
+log_must eval "check_prop_inherit $dest/2/3/4 '$userprop:orig' $dest/2"
+log_must zfs destroy -r -f $dest
+# Verify 'zfs recv -d'
+log_must zfs create $dest
+typeset fs="$(echo $orig | awk -F'/' '{print $NF}')"
+log_must eval "zfs receive -d -o copies=3 -x atime "\
+ "-o '$userprop:orig'='newval' $dest < $streamfile_repl"
+log_must datasetexists $dest/$fs/1/2/3/4
+log_must eval "check_prop_source $dest/$fs/1/2 copies 3 local"
+log_must eval "check_prop_inherit $dest/$fs/1/2/3/4 copies $dest/$fs/1/2"
+log_must eval "check_prop_source $dest/$fs/1/2/3/4 atime on default"
+log_must eval "check_prop_source $dest/$fs/1/2 '$userprop:orig' 'newval' local"
+log_must eval "check_prop_inherit $dest/$fs/1/2/3/4 '$userprop:orig' $dest/$fs/1/2"
# We don't need to cleanup here
log_pass "ZFS receive property override and exclude options passed."
zpool_add_009_neg.ksh \
zpool_add_010_pos.ksh \
add-o_ashift.ksh \
- add_prop_ashift.ksh
+ add_prop_ashift.ksh \
+ add_nested_replacing_spare.ksh
zpool_add_009_neg.ksh \
zpool_add_010_pos.ksh \
add-o_ashift.ksh \
- add_prop_ashift.ksh
+ add_prop_ashift.ksh \
+ add_nested_replacing_spare.ksh
all: all-am
--- /dev/null
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2017, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
+
+#
+# DESCRIPTION:
+# 'zpool add' works with nested replacing/spare vdevs
+#
+# STRATEGY:
+# 1. Create a redundant pool with a spare device
+# 2. Manually fault a device, wait for the hot-spare and then replace it:
+# this creates a situation where replacing and spare vdevs are nested.
+# 3. Verify 'zpool add' is able to add new devices to the pool.
+#
+
+verify_runnable "global"
+
+function cleanup
+{
+ zed_stop
+ zed_cleanup
+ log_must zinject -c all
+ destroy_pool $TESTPOOL
+ log_must rm -f $DATA_DEVS $SPARE_DEVS
+}
+
+log_assert "'zpool add' works with nested replacing/spare vdevs"
+log_onexit cleanup
+
+FAULT_DEV="$TEST_BASE_DIR/fault-dev"
+SAFE_DEV1="$TEST_BASE_DIR/safe-dev1"
+SAFE_DEV2="$TEST_BASE_DIR/safe-dev2"
+SAFE_DEV3="$TEST_BASE_DIR/safe-dev3"
+SAFE_DEVS="$SAFE_DEV1 $SAFE_DEV2 $SAFE_DEV3"
+REPLACE_DEV="$TEST_BASE_DIR/replace-dev"
+ADD_DEV="$TEST_BASE_DIR/add-dev"
+DATA_DEVS="$FAULT_DEV $SAFE_DEVS $REPLACE_DEV $ADD_DEV"
+SPARE_DEV1="$TEST_BASE_DIR/spare-dev1"
+SPARE_DEV2="$TEST_BASE_DIR/spare-dev2"
+SPARE_DEVS="$SPARE_DEV1 $SPARE_DEV2"
+
+# We need ZED running to work with spares
+zed_setup
+zed_start
+# Clear events from previous runs
+zed_events_drain
+
+for type in "mirror" "raidz1" "raidz2" "raidz3"
+do
+ # 1. Create a redundant pool with a spare device
+ truncate -s $SPA_MINDEVSIZE $DATA_DEVS $SPARE_DEVS
+ log_must zpool create $TESTPOOL $type $FAULT_DEV $SAFE_DEVS
+ log_must zpool add $TESTPOOL spare $SPARE_DEV1
+
+ # 2.1 Fault a device, verify the spare is kicked in
+ log_must zinject -d $FAULT_DEV -e nxio -T all -f 100 $TESTPOOL
+ log_must zpool scrub $TESTPOOL
+ log_must wait_vdev_state $TESTPOOL $FAULT_DEV "UNAVAIL" 60
+ log_must wait_vdev_state $TESTPOOL $SPARE_DEV1 "ONLINE" 60
+ log_must wait_hotspare_state $TESTPOOL $SPARE_DEV1 "INUSE"
+ log_must check_state $TESTPOOL "" "DEGRADED"
+
+ # 2.2 Replace the faulted device: this creates a replacing vdev inside a
+ # spare vdev
+ log_must zpool replace $TESTPOOL $FAULT_DEV $REPLACE_DEV
+ log_must wait_vdev_state $TESTPOOL $REPLACE_DEV "ONLINE" 60
+ zpool status | awk -v poolname="$TESTPOOL" -v type="$type" 'BEGIN {s=""}
+ $1 ~ poolname {c=4}; (c && c--) { s=s$1":" }
+ END { if (s != poolname":"type"-0:spare-0:replacing-0:") exit 1; }'
+ if [[ $? -ne 0 ]]; then
+ log_fail "Pool does not contain nested replacing/spare vdevs"
+ fi
+
+ # 3. Verify 'zpool add' is able to add new devices
+ log_must zpool add $TESTPOOL spare $SPARE_DEV2
+ log_must wait_hotspare_state $TESTPOOL $SPARE_DEV2 "AVAIL"
+ log_must zpool add -f $TESTPOOL $ADD_DEV
+ log_must wait_vdev_state $TESTPOOL $ADD_DEV "ONLINE" 60
+
+ # Cleanup
+ log_must zinject -c all
+ destroy_pool $TESTPOOL
+ log_must rm -f $DATA_DEVS $SPARE_DEVS
+done
+
+log_pass "'zpool add' works with nested replacing/spare vdevs"
zpool_upgrade_001_neg.ksh \
arcstat_001_pos.ksh \
arc_summary_001_pos.ksh \
+ arc_summary_002_neg.ksh \
dbufstat_001_pos.ksh
zpool_upgrade_001_neg.ksh \
arcstat_001_pos.ksh \
arc_summary_001_pos.ksh \
+ arc_summary_002_neg.ksh \
dbufstat_001_pos.ksh
all: all-am
((i = i + 1))
done
+log_must eval "arc_summary.py | head > /dev/null"
+log_must eval "arc_summary.py | head -1 > /dev/null"
+
log_pass "arc_summary.py generates output and doesn't return an error code"
--- /dev/null
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2015 by Lawrence Livermore National Security, LLC.
+# All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+typeset args=("-x" "-r" "-5" "-p 7" "--err" "-@")
+
+log_assert "arc_summary.py generates an error code with invalid options"
+
+for arg in "${args[@]}"; do
+ log_mustnot eval "arc_summary.py $arg > /dev/null"
+done
+
+log_pass "arc_summary.py generates an error code with invalid options"
/* mount_nodev() is available */
#undef HAVE_MOUNT_NODEV
-/* new_sync_read() is available */
+/* new_sync_read()/new_sync_write() are available */
#undef HAVE_NEW_SYNC_READ
/* sops->nr_cached_objects() exists */