diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-02-10 12:46:03 +0000 |
|---|---|---|
| committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-02-10 12:46:03 +0000 |
| commit | 78121a0c3d633d344c4092336d357036c0e19f96 (patch) | |
| tree | c6691bd7e380d723ada73f9b61dc4ef7634ee081 /usr/src/cmd | |
| parent | 471ea867225b8c01fb430e738f6cf835294c99fc (diff) | |
| parent | 19ee9cd1f5161e227951200cab5ecbff45fd5d71 (diff) | |
| download | illumos-joyent-78121a0c3d633d344c4092336d357036c0e19f96.tar.gz | |
[illumos-gate merge]
commit 19ee9cd1f5161e227951200cab5ecbff45fd5d71
12277 /proc/<PID>/fdinfo should resolve paths relative to current process
commit 52aec5b9758f6352670ab269980b437a987f4822
12276 smatch-clean sockfs
commit 0dfe541e13279d277d838d6a27e55188b9486cb1
11083 support NFS server in zone
commit d8ab6e129d75d7c3f21a7909bf811a3de65faea8
12235 Add libzutil for libzfs or libzpool consumers
commit fdefee4c75361dc5ea202f7e1f7c49f8a27ea043
12266 loader: rewrite zfs reader zap code to use malloc
commit 8af765f5897d30449b941438e8d833f02dac74f8
12252 remove sunfire-specific code from kstat(1m)
commit 34173ec8d0147391124bee4bbc60ac00807c0377
12284 errors in compress(1) and pack(1) man pages
Conflicts:
usr/src/uts/common/klm/nlm_impl.h
usr/src/uts/common/fs/nfs/nfs_server.c
usr/src/lib/Makefile
usr/src/cmd/fs.d/nfs/svc/nfs-server
Diffstat (limited to 'usr/src/cmd')
32 files changed, 575 insertions, 535 deletions
diff --git a/usr/src/cmd/dfs.cmds/sharemgr/commands.c b/usr/src/cmd/dfs.cmds/sharemgr/commands.c index 79be97f149..06b8fb54f0 100644 --- a/usr/src/cmd/dfs.cmds/sharemgr/commands.c +++ b/usr/src/cmd/dfs.cmds/sharemgr/commands.c @@ -22,7 +22,11 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + */ + +/* * Copyright 2012 Milan Jurik. All rights reserved. + * Copyright 2018 Nexenta Systems, Inc. * Copyright 2019, Joyent, Inc. */ @@ -2167,7 +2171,6 @@ static void show_group(sa_group_t group, int verbose, int properties, char *proto, char *subgroup) { - sa_share_t share; char *groupname; char *zfs = NULL; int iszfs = 0; @@ -2175,6 +2178,8 @@ show_group(sa_group_t group, int verbose, int properties, char *proto, groupname = sa_get_group_attr(group, "name"); if (groupname != NULL) { + sa_share_t share; + if (proto != NULL && !has_protocol(group, proto)) { sa_free_attr_string(groupname); return; @@ -2191,7 +2196,7 @@ show_group(sa_group_t group, int verbose, int properties, char *proto, iszfs = 1; sa_free_attr_string(zfs); } - share = sa_get_share(group, NULL); + if (subgroup == NULL) (void) printf("%s", groupname); else diff --git a/usr/src/cmd/dumpadm/Makefile b/usr/src/cmd/dumpadm/Makefile index 0734535b29..c6b80188fa 100644 --- a/usr/src/cmd/dumpadm/Makefile +++ b/usr/src/cmd/dumpadm/Makefile @@ -20,7 +20,7 @@ # # # Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2019 Joyent, Inc. +# Copyright 2020 Joyent, Inc. # PROG = dumpadm @@ -36,12 +36,13 @@ ROOTETCFILES= $(ETCFILES:%=$(ROOTETC)/%) include ../Makefile.cmd CFLAGS += $(CCVERBOSE) +CFLAGS += -I../../lib/libzutil/common FILEMODE = 0555 ROOTMANIFESTDIR = $(ROOTSVCSYSTEM) -LDLIBS += -ldiskmgt -lzfs -luuid +LDLIBS += -ldiskmgt -lzfs -luuid -lzutil .KEEP_STATE: diff --git a/usr/src/cmd/dumpadm/dconf.c b/usr/src/cmd/dumpadm/dconf.c index 5a1da87148..6e549afaa7 100644 --- a/usr/src/cmd/dumpadm/dconf.c +++ b/usr/src/cmd/dumpadm/dconf.c @@ -21,7 +21,7 @@ /* * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. - * Copyright 2019 Joyent, Inc. + * Copyright 2020 Joyent, Inc. */ #include <sys/types.h> @@ -39,6 +39,7 @@ #include <errno.h> #include <libdiskmgt.h> #include <libzfs.h> +#include <libzutil.h> #include <uuid/uuid.h> #include "dconf.h" diff --git a/usr/src/cmd/fs.d/nfs/Makefile b/usr/src/cmd/fs.d/nfs/Makefile index 7f9ae26ae2..d18ddec4dd 100644 --- a/usr/src/cmd/fs.d/nfs/Makefile +++ b/usr/src/cmd/fs.d/nfs/Makefile @@ -23,6 +23,8 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2018 Nexenta Systems, Inc. All rights reserved. +# # cmd/fs.d/nfs/Makefile # # cmd/fs.d/nfs is the directory of all nfs specific commands @@ -33,7 +35,7 @@ include $(SRC)/Makefile.master SUBDIR1= exportfs nfsd rquotad \ statd nfsstat mountd dfshares \ - nfsfind nfs4cbd share tests + nfsfind nfs4cbd share tests dtrace # These do "make catalog" SUBDIR2= clear_locks lockd umount showmount \ @@ -52,14 +54,13 @@ all:= TARGET= all install:= TARGET= install clean:= TARGET= clean clobber:= TARGET= clobber -lint:= TARGET= lint catalog:= TARGET= catalog .KEEP_STATE: .PARALLEL: $(SUBDIRS) -all install clean clobber lint: $(SUBDIRS) +all install clean clobber: $(SUBDIRS) catalog: $(SUBDIR2) $(RM) $(POFILE) diff --git a/usr/src/cmd/fs.d/nfs/dtrace/Makefile b/usr/src/cmd/fs.d/nfs/dtrace/Makefile new file mode 100644 index 0000000000..0882ae8b9d --- /dev/null +++ b/usr/src/cmd/fs.d/nfs/dtrace/Makefile @@ -0,0 +1,37 @@ +# +# 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 2018 Nexenta Systems, Inc. All rights reserved. +# + +SRCS=nfs-trace.d nfs-time.d + +include $(SRC)/cmd/Makefile.cmd + +ROOTNFSDTRACEDIR = $(ROOTLIB)/nfs/dtrace +ROOTNFSDTRACEFILE = $(SRCS:%=$(ROOTNFSDTRACEDIR)/%) + +$(ROOTNFSDTRACEFILE):= FILEMODE = 0555 + +$(ROOTNFSDTRACEDIR): + $(INS.dir) + +$(ROOTNFSDTRACEDIR)/%: % + $(INS.file) + +all: + +clean: + +include $(SRC)/cmd/Makefile.targ + +install: all $(ROOTNFSDTRACEDIR) .WAIT $(ROOTNFSDTRACEFILE) diff --git a/usr/src/cmd/fs.d/nfs/dtrace/nfs-time.d b/usr/src/cmd/fs.d/nfs/dtrace/nfs-time.d new file mode 100755 index 0000000000..7d7c33d153 --- /dev/null +++ b/usr/src/cmd/fs.d/nfs/dtrace/nfs-time.d @@ -0,0 +1,78 @@ +#!/usr/sbin/dtrace -s + +/* + * 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 2018 Nexenta Systems, Inc. All rights reserved. + */ + +/* + * Quantize the time spent in each NFSv3 andf NFSv4 operation, + * optionally for a specified client, share and zone. + * + * Usage: nfs-time.d [<client ip>|all [<share path>|all] [<zone id>]]] + * + * example: nfs_time.d 192.168.123.1 /mypool/fs1 0 + * + * It is valid to specify <client ip> or <share path> as "all" + * to quantize data for all clients and/or all shares. + * Omitting <zone id> will quantize data for all zones. + */ + +#pragma D option flowindent +#pragma D option defaultargs + +dtrace:::BEGIN +{ + all_clients = (($$1 == NULL) || ($$1 == "all")) ? 1 : 0; + all_shares = (($$2 == NULL) || ($$2 == "all")) ? 1 : 0; + all_zones = ($$3 == NULL) ? 1 : 0; + + client = $$1; + share = $$2; + zoneid = $3; + + printf("%Y - client=%s share=%s zone=%s)\n", walltimestamp, + (all_clients) ? "all" : client, + (all_shares) ? "all" : share, + (all_zones) ? "all" : $$3); +} + +nfsv3:::op-*-start, +nfsv4:::op-*-start +{ + self->ts[probefunc] = timestamp; +} + +nfsv3:::op-*-done, +nfsv4:::op-*-done +/ ((all_clients) || (args[0]->ci_remote == client)) && + ((all_shares) || (args[1]->noi_shrpath == share)) && + ((all_zones) || (args[1]->noi_zoneid == zoneid)) / +{ + elapsed = (timestamp - self->ts[probefunc]); + @q[probefunc]=quantize(elapsed); +} + +tick-5s +{ + printa(@q); + /* + * uncomment "clear" to quantize per 5s interval + * rather than cumulative for duration of script. + * clear(@q); + */ +} + +dtrace:::END +{ +} diff --git a/usr/src/cmd/fs.d/nfs/dtrace/nfs-trace.d b/usr/src/cmd/fs.d/nfs/dtrace/nfs-trace.d new file mode 100755 index 0000000000..a89fed3424 --- /dev/null +++ b/usr/src/cmd/fs.d/nfs/dtrace/nfs-trace.d @@ -0,0 +1,248 @@ +#!/usr/sbin/dtrace -s + +/* + * 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 2018 Nexenta Systems, Inc. All rights reserved. + */ + +/* + * Print input and output values for each NFSv3 andf NFSv4 operation, + * optionally for a specified client, share and zone. + * + * Usage: nfs-trace.d [<client ip>|all [<share path>|all] [<zone id>]]] + * + * example: nfs_trace.d 192.168.123.1 /mypool/fs1 0 + * + * It is valid to specify <client ip> or <share path> as "all" + * to quantize data for all clients and/or all shares. + * Omitting <zone id> will quantize data for all zones. + */ + +/* + * Unfortunately, trying to write this script using wildcards, for example: + * nfsv3:::op-*-start {} + * nfsv3:::op-*-done {} + * prints the operation-specific args[2] structure as the incorrect type. + * Until this is resolved it is necessary to explicitly list each operation. + * + * See nfs-time.d for an example of using the wildcard format when there are + * no operation-specific args (args[2]) being traced. + */ + +#pragma D option flowindent +#pragma D option defaultargs + +dtrace:::BEGIN +{ + all_clients = (($$1 == NULL) || ($$1 == "all")) ? 1 : 0; + all_shares = (($$2 == NULL) || ($$2 == "all")) ? 1 : 0; + all_zones = ($$3 == NULL) ? 1 : 0; + + client = $$1; + share = $$2; + zoneid = $3; + + printf("%Y - client=%s share=%s zone=%s)\n", walltimestamp, + (all_clients) ? "all" : client, + (all_shares) ? "all" : share, + (all_zones) ? "all" : $$3); +} + +nfsv3:::op-getattr-start, +nfsv3:::op-setattr-start, +nfsv3:::op-lookup-start, +nfsv3:::op-access-start, +nfsv3:::op-commit-start, +nfsv3:::op-create-start, +nfsv3:::op-fsinfo-start, +nfsv3:::op-fsstat-start, +nfsv3:::op-link-start, +nfsv3:::op-mkdir-start, +nfsv3:::op-mknod-start, +nfsv3:::op-pathconf-start, +nfsv3:::op-read-start, +nfsv3:::op-readdir-start, +nfsv3:::op-readdirplus-start, +nfsv3:::op-readlink-start, +nfsv3:::op-remove-start, +nfsv3:::op-rename-start, +nfsv3:::op-rmdir-start, +nfsv3:::op-symlink-start, +nfsv3:::op-write-start +/ ((all_clients) || (args[0]->ci_remote == client)) && + ((all_shares) || (args[1]->noi_shrpath == share)) && + ((all_zones) || (args[1]->noi_zoneid == zoneid)) / +{ + printf("\n"); + print(*args[0]); + printf("\n"); + print(*args[1]); + printf("\n"); + print(*args[2]); + printf("\n"); +} + +nfsv3:::op-getattr-done, +nfsv3:::op-setattr-done, +nfsv3:::op-lookup-done, +nfsv3:::op-access-done, +nfsv3:::op-commit-done, +nfsv3:::op-create-done, +nfsv3:::op-fsinfo-done, +nfsv3:::op-fsstat-done, +nfsv3:::op-link-done, +nfsv3:::op-mkdir-done, +nfsv3:::op-mknod-done, +nfsv3:::op-pathconf-done, +nfsv3:::op-read-done, +nfsv3:::op-readdir-done, +nfsv3:::op-readdirplus-done, +nfsv3:::op-readlink-done, +nfsv3:::op-remove-done, +nfsv3:::op-rename-done, +nfsv3:::op-rmdir-done, +nfsv3:::op-symlink-done, +nfsv3:::op-write-done +/ ((all_clients) || (args[0]->ci_remote == client)) && + ((all_shares) || (args[1]->noi_shrpath == share)) && + ((all_zones) || (args[1]->noi_zoneid == zoneid)) / +{ + /* + printf("\n"); + print(*args[0]); + printf("\n"); + print(*args[1]); + */ + printf("\n"); + print(*args[2]); + printf("\n"); +} + +nfsv4:::op-access-start, +nfsv4:::op-close-start, +nfsv4:::op-commit-start, +nfsv4:::op-create-start, +nfsv4:::op-delegpurge-start, +nfsv4:::op-delegreturn-start, +nfsv4:::op-getattr-start, +nfsv4:::op-link-start, +nfsv4:::op-lock-start, +nfsv4:::op-lockt-start, +nfsv4:::op-locku-start, +nfsv4:::op-lookup-start, +nfsv4:::op-nverify-start, +nfsv4:::op-open-start, +nfsv4:::op-open-confirm-start, +nfsv4:::op-open-downgrade-start, +nfsv4:::op-openattr-start, +nfsv4:::op-putfh-start, +nfsv4:::op-read-start, +nfsv4:::op-readdir-start, +nfsv4:::op-release-lockowner-start, +nfsv4:::op-remove-start, +nfsv4:::op-rename-start, +nfsv4:::op-renew-start, +nfsv4:::op-secinfo-start, +nfsv4:::op-setattr-start, +nfsv4:::op-setclientid-start, +nfsv4:::op-setclientid-confirm-start, +nfsv4:::op-verify-start, +nfsv4:::op-write-start +/ ((all_clients) || (args[0]->ci_remote == client)) && + ((all_shares) || (args[1]->noi_shrpath == share)) && + ((all_zones) || (args[1]->noi_zoneid == zoneid)) / +{ + printf("\n"); + print(*args[0]); + printf("\n"); + print(*args[1]); + printf("\n"); + print(*args[2]); + printf("\n"); +} + +/* These operations do not have args[2] */ +nfsv4:::op-getfh-start, +nfsv4:::op-lookupp-start, +nfsv4:::op-putpubfh-start, +nfsv4:::op-putrootfh-start, +nfsv4:::op-readlink-start, +nfsv4:::op-restorefh-start, +nfsv4:::op-savefh-start +/ ((all_clients) || (args[0]->ci_remote == client)) && + ((all_shares) || (args[1]->noi_shrpath == share)) && + ((all_zones) || (args[1]->noi_zoneid == zoneid)) / +{ + printf("\n"); + print(*args[0]); + printf("\n"); + print(*args[1]); + printf("\n"); +} + + +nfsv4:::op-access-done, +nfsv4:::op-close-done, +nfsv4:::op-commit-done, +nfsv4:::op-create-done, +nfsv4:::op-delegpurge-done, +nfsv4:::op-delegreturn-done, +nfsv4:::op-getattr-done, +nfsv4:::op-getfh-done, +nfsv4:::op-link-done, +nfsv4:::op-lock-done, +nfsv4:::op-lockt-done, +nfsv4:::op-locku-done, +nfsv4:::op-lookup-done, +nfsv4:::op-lookupp-done, +nfsv4:::op-nverify-done, +nfsv4:::op-open-done, +nfsv4:::op-open-confirm-done, +nfsv4:::op-open-downgrade-done, +nfsv4:::op-openattr-done, +nfsv4:::op-putfh-done, +nfsv4:::op-putpubfh-done, +nfsv4:::op-putrootfh-done, +nfsv4:::op-read-done, +nfsv4:::op-readdir-done, +nfsv4:::op-readlink-done, +nfsv4:::op-release-lockowner-done, +nfsv4:::op-remove-done, +nfsv4:::op-rename-done, +nfsv4:::op-renew-done, +nfsv4:::op-restorefh-done, +nfsv4:::op-savefh-done, +nfsv4:::op-secinfo-done, +nfsv4:::op-setattr-done, +nfsv4:::op-setclientid-done, +nfsv4:::op-setclientid-confirm-done, +nfsv4:::op-verify-done, +nfsv4:::op-write-done +/ ((all_clients) || (args[0]->ci_remote == client)) && + ((all_shares) || (args[1]->noi_shrpath == share)) && + ((all_zones) || (args[1]->noi_zoneid == zoneid)) / +{ + /* + printf("\n"); + print(*args[0]); + printf("\n"); + print(*args[1]); + */ + printf("\n"); + print(*args[2]); + printf("\n"); +} + +dtrace:::END +{ +} diff --git a/usr/src/cmd/fs.d/nfs/svc/nfs-server b/usr/src/cmd/fs.d/nfs/svc/nfs-server index 5c8c1a67dd..c2cb8069ed 100644 --- a/usr/src/cmd/fs.d/nfs/svc/nfs-server +++ b/usr/src/cmd/fs.d/nfs/svc/nfs-server @@ -22,8 +22,8 @@ # # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2015 Nexenta Systems, Inc. All rights reserved. # Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> +# Copyright 2018 Nexenta Systems, Inc. All rights reserved. # # Start/stop processes required for server NFS @@ -53,8 +53,7 @@ configure_ipfilter() # # Nothing to do if: - # - service's policy is 'use_global' - # - ipfilter isn't online + # - ipfilter isn't online # - global policy is 'custom' # [ "`get_policy $SMF_FMRI`" = "use_global" ] && return 0 @@ -66,14 +65,6 @@ configure_ipfilter() case "$1" in 'start') - # The NFS server is not supported in a local zone - if smf_is_nonglobalzone; then - /usr/sbin/svcadm disable -t svc:/network/nfs/server - echo "The NFS server is not supported in a local zone" - sleep 5 & - exit $SMF_EXIT_OK - fi - # Share all file systems enabled for sharing. sharemgr understands # regular shares and ZFS shares and will handle both. Technically, # the shares would have been started long before getting here since diff --git a/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml b/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml index b5165e7ad5..957ff00856 100644 --- a/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml +++ b/usr/src/cmd/fs.d/nfs/svc/nlockmgr.xml @@ -22,6 +22,8 @@ Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2012, 2015 by Delphix. All rights reserved. + Copyright 2018 Nexenta Systems, Inc. All rights reserved. + Copyright 2019 Nexenta by DDN, Inc. All rights reserved. NOTE: This service manifest is not editable; its contents will be overwritten by package or patch operations, including @@ -65,7 +67,7 @@ grouping='require_all' restart_on='error' type='service'> - <service_fmri value='svc:/system/filesystem/minimal' /> + <service_fmri value='svc:/system/filesystem/minimal' /> </dependency> <exec_method @@ -93,7 +95,7 @@ </property_group> <instance name='default' enabled='false'> <property_group name='nfs-props' type='com.oracle.nfs,props'> - <propval name='grace_period' type='integer' value='90'/> + <propval name='grace_period' type='integer' value='60'/> <propval name='lockd_listen_backlog' type='integer' value='32'/> <propval name='lockd_retransmit_timeout' type='integer' value='5'/> <propval name='lockd_servers' type='integer' value='256'/> diff --git a/usr/src/cmd/fs.d/zfs/fstyp/Makefile b/usr/src/cmd/fs.d/zfs/fstyp/Makefile index ba28b9e39f..dfcdddd812 100644 --- a/usr/src/cmd/fs.d/zfs/fstyp/Makefile +++ b/usr/src/cmd/fs.d/zfs/fstyp/Makefile @@ -22,12 +22,12 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" +# Copyright 2020 Joyent, Inc. # FSTYP_VERS=1 FSTYPE= zfs -LIBPROG= fstyp.so.${FSTYP_VERS} +LIBPROG= fstyp.so.${FSTYP_VERS} include ../../../../lib/Makefile.lib include ../../Makefile.fstype @@ -36,16 +36,17 @@ include ../../Makefile.fstype MAPFILES = CFLAGS += $(C_PICFLAGS) +CFLAGS += -I../../../../lib/libzutil/common DYNLIB= $(LIBPROG) -LDLIBS += -lnvpair -lzfs -lc +LDLIBS += -lnvpair -lc -lzutil LINTFLAGS += -erroff=E_BAD_PTR_CAST_ALIGN -erroff=E_NAME_DEF_NOT_USED2 LINTFLAGS64 += -erroff=E_BAD_PTR_CAST_ALIGN -erroff=E_NAME_DEF_NOT_USED2 SRCS= ${LIBPROG:%.so.$(FSTYP_VERS)=%.c} -CPPFLAGS += -DFSTYP_VERS=${FSTYP_VERS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +CPPFLAGS += -DFSTYP_VERS=${FSTYP_VERS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 # # Override PMAP dependency @@ -76,7 +77,7 @@ lint: lint_SRCS cstyle: $(CSTYLE) $(SRCS) -clean: +clean: ${RM} $(LIBPROG) clobber: clean diff --git a/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c b/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c index 30f86375e7..d49d998404 100644 --- a/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c +++ b/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c @@ -21,10 +21,10 @@ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2020 Joyent, Inc. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * libfstyp module for zfs */ @@ -38,6 +38,7 @@ #include <string.h> #include <libnvpair.h> #include <libzfs.h> +#include <libzutil.h> #include <libfstyp_module.h> #include <errno.h> @@ -89,7 +90,7 @@ fstyp_mod_ident(fstyp_mod_handle_t handle) uint64_t u64; char buf[64]; - if (zpool_read_label(h->fd, &h->config) != 0) { + if (zpool_read_label(h->fd, &h->config, NULL) != 0) { return (FSTYP_ERR_NO_MATCH); } diff --git a/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs b/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs index e93076d9ce..968f0b1e87 100644 --- a/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs +++ b/usr/src/cmd/perl/contrib/Sun/Solaris/Kstat/Kstat.xs @@ -23,6 +23,7 @@ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014 Racktop Systems. * Copyright 2019 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2020 Peter Tribble. */ /* @@ -85,9 +86,6 @@ /* Ultra-specific kstat includes */ #ifdef __sparc #include <vm/hat_sfmmu.h> /* from /usr/platform/sun4u/include */ -#include <sys/simmstat.h> /* from /usr/platform/sun4u/include */ -#include <sys/sysctrl.h> /* from /usr/platform/sun4u/include */ -#include <sys/fhc.h> /* from /usr/include */ #endif /* @@ -548,169 +546,6 @@ save_sfmmu_tsbsize_stat(HV *self, kstat_t *kp, int strip_str) #endif /* - * Definition in /usr/platform/sun4u/include/sys/simmstat.h - */ - -#ifdef __sparc -static void -save_simmstat(HV *self, kstat_t *kp, int strip_str) -{ - uchar_t *simmstatp; - SV *list; - int i; - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - PERL_ASSERT(kp->ks_data_size == sizeof (uchar_t) * SIMM_COUNT); - - list = newSVpv("", 0); - for (i = 0, simmstatp = (uchar_t *)(kp->ks_data); - i < SIMM_COUNT - 1; i++, simmstatp++) { - sv_catpvf(list, "%d,", *simmstatp); - } - sv_catpvf(list, "%d", *simmstatp); - hv_store(self, "status", 6, list, 0); -} -#endif - -/* - * Used by save_temperature to make CSV lists from arrays of - * short temperature values - */ - -#ifdef __sparc -static SV * -short_array_to_SV(short *shortp, int len) -{ - SV *list; - - list = newSVpv("", 0); - for (; len > 1; len--, shortp++) { - sv_catpvf(list, "%d,", *shortp); - } - sv_catpvf(list, "%d", *shortp); - return (list); -} - -/* - * Definition in /usr/platform/sun4u/include/sys/fhc.h - */ - -static void -save_temperature(HV *self, kstat_t *kp, int strip_str) -{ - struct temp_stats *tempsp; - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - PERL_ASSERT(kp->ks_data_size == sizeof (struct temp_stats)); - tempsp = (struct temp_stats *)(kp->ks_data); - - SAVE_UINT32(self, tempsp, index); - hv_store(self, "l1", 2, short_array_to_SV(tempsp->l1, L1_SZ), 0); - hv_store(self, "l2", 2, short_array_to_SV(tempsp->l2, L2_SZ), 0); - hv_store(self, "l3", 2, short_array_to_SV(tempsp->l3, L3_SZ), 0); - hv_store(self, "l4", 2, short_array_to_SV(tempsp->l4, L4_SZ), 0); - hv_store(self, "l5", 2, short_array_to_SV(tempsp->l5, L5_SZ), 0); - SAVE_INT32(self, tempsp, max); - SAVE_INT32(self, tempsp, min); - SAVE_INT32(self, tempsp, state); - SAVE_INT32(self, tempsp, temp_cnt); - SAVE_INT32(self, tempsp, shutdown_cnt); - SAVE_INT32(self, tempsp, version); - SAVE_INT32(self, tempsp, trend); - SAVE_INT32(self, tempsp, override); -} -#endif - -/* - * Not actually defined anywhere - just a short. Yuck. - */ - -#ifdef __sparc -static void -save_temp_over(HV *self, kstat_t *kp, int strip_str) -{ - short *shortp; - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - PERL_ASSERT(kp->ks_data_size == sizeof (short)); - - shortp = (short *)(kp->ks_data); - hv_store(self, "override", 8, newSViv(*shortp), 0); -} -#endif - -/* - * Defined in /usr/platform/sun4u/include/sys/sysctrl.h - * (Well, sort of. Actually there's no structure, just a list of #defines - * enumerating *some* of the array indexes.) - */ - -#ifdef __sparc -static void -save_ps_shadow(HV *self, kstat_t *kp, int strip_str) -{ - uchar_t *ucharp; - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - PERL_ASSERT(kp->ks_data_size == SYS_PS_COUNT); - - ucharp = (uchar_t *)(kp->ks_data); - hv_store(self, "core_0", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_1", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_2", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_3", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_4", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_5", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_6", 6, newSViv(*ucharp++), 0); - hv_store(self, "core_7", 6, newSViv(*ucharp++), 0); - hv_store(self, "pps_0", 5, newSViv(*ucharp++), 0); - hv_store(self, "clk_33", 6, newSViv(*ucharp++), 0); - hv_store(self, "clk_50", 6, newSViv(*ucharp++), 0); - hv_store(self, "v5_p", 4, newSViv(*ucharp++), 0); - hv_store(self, "v12_p", 5, newSViv(*ucharp++), 0); - hv_store(self, "v5_aux", 6, newSViv(*ucharp++), 0); - hv_store(self, "v5_p_pch", 8, newSViv(*ucharp++), 0); - hv_store(self, "v12_p_pch", 9, newSViv(*ucharp++), 0); - hv_store(self, "v3_pch", 6, newSViv(*ucharp++), 0); - hv_store(self, "v5_pch", 6, newSViv(*ucharp++), 0); - hv_store(self, "p_fan", 5, newSViv(*ucharp++), 0); -} -#endif - -/* - * Definition in /usr/platform/sun4u/include/sys/fhc.h - */ - -#ifdef __sparc -static void -save_fault_list(HV *self, kstat_t *kp, int strip_str) -{ - struct ft_list *faultp; - int i; - char name[KSTAT_STRLEN + 7]; /* room for 999999 faults */ - - /* PERL_ASSERT(kp->ks_ndata == 1); */ - /* PERL_ASSERT(kp->ks_data_size == sizeof (struct ft_list)); */ - - for (i = 1, faultp = (struct ft_list *)(kp->ks_data); - i <= 999999 && i <= kp->ks_data_size / sizeof (struct ft_list); - i++, faultp++) { - (void) snprintf(name, sizeof (name), "unit_%d", i); - hv_store(self, name, strlen(name), newSViv(faultp->unit), 0); - (void) snprintf(name, sizeof (name), "type_%d", i); - hv_store(self, name, strlen(name), newSViv(faultp->type), 0); - (void) snprintf(name, sizeof (name), "fclass_%d", i); - hv_store(self, name, strlen(name), newSViv(faultp->fclass), 0); - (void) snprintf(name, sizeof (name), "create_time_%d", i); - hv_store(self, name, strlen(name), - NEW_UV(faultp->create_time), 0); - (void) snprintf(name, sizeof (name), "msg_%d", i); - hv_store(self, name, strlen(name), newSVpv(faultp->msg, 0), 0); - } -} -#endif - -/* * We need to be able to find the function corresponding to a particular raw * kstat. To do this we ignore the instance and glue the module and name * together to form a composite key. We can then use the data in the kstat @@ -721,7 +556,7 @@ save_fault_list(HV *self, kstat_t *kp, int strip_str) * Note that some kstats include the instance number as part of the module * and/or name. This could be construed as a bug. However, to work around this * we omit any digits from the module and name as we build the table in - * build_raw_kstat_loopup(), and we remove any digits from the module and name + * build_raw_kstat_lookup(), and we remove any digits from the module and name * when we look up the functions in lookup_raw_kstat_fn() */ @@ -747,11 +582,6 @@ build_raw_kstat_lookup() "unix:sfmmu_global_stat"); SAVE_FNP(raw_kstat_lookup, save_sfmmu_tsbsize_stat, "unix:sfmmu_tsbsize_stat"); - SAVE_FNP(raw_kstat_lookup, save_simmstat, "unix:simm-status"); - SAVE_FNP(raw_kstat_lookup, save_temperature, "unix:temperature"); - SAVE_FNP(raw_kstat_lookup, save_temp_over, "unix:temperature override"); - SAVE_FNP(raw_kstat_lookup, save_ps_shadow, "unix:ps_shadow"); - SAVE_FNP(raw_kstat_lookup, save_fault_list, "unix:fault_list"); #endif } diff --git a/usr/src/cmd/smbsrv/dtrace/smb-trace.d b/usr/src/cmd/smbsrv/dtrace/smb-trace.d index 32162dca2b..40b3cba219 100644 --- a/usr/src/cmd/smbsrv/dtrace/smb-trace.d +++ b/usr/src/cmd/smbsrv/dtrace/smb-trace.d @@ -1,3 +1,4 @@ +#!/usr/sbin/dtrace -s /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. @@ -10,7 +11,7 @@ */ /* - * Copyright 2017 Nexenta Systems, Inc. All rights reserved. + * Copyright 2018 Nexenta Systems, Inc. All rights reserved. */ /* @@ -24,9 +25,38 @@ * args[2] smb_name_args_t * args[2] smb_open_args_t * args[2] smb_rw_args_t + * + * Usage: smb-trace.d [<client ip>|all [<share path>|all] [<zone id>]]] + * + * example: smb_trace.d 192.168.012.001 mypool_fs1 0 + * + * It is valid to specify <client ip> or <share path> as "all" to + * print data for all clients and/or all shares. + * Omitting <zone id> will print data for all zones. */ +#pragma D option defaultargs + +dtrace:::BEGIN +{ + all_clients = (($$1 == NULL) || ($$1 == "all")) ? 1 : 0; + all_shares = (($$2 == NULL) || ($$2 == "all")) ? 1 : 0; + all_zones = ($$3 == NULL) ? 1 : 0; + + client = $$1; + share = $$2; + zoneid = $3; + + printf("%Y - client=%s share=%s zone=%s)\n", walltimestamp, + (all_clients) ? "all" : client, + (all_shares) ? "all" : share, + (all_zones) ? "all" : $$3); +} + smb:::op-*-start +/ ((all_clients) || (args[0]->ci_remote == client)) && + ((all_shares) || (args[1]->soi_share == share)) && + ((all_zones) || (args[1]->soi_zoneid == zoneid)) / { printf("clnt=%s mid=0x%x uid=0x%x tid=0x%x\n", args[0]->ci_remote, @@ -36,9 +66,16 @@ smb:::op-*-start } smb:::op-*-done +/ ((all_clients) || (args[0]->ci_remote == client)) && + ((all_shares) || (args[1]->soi_share == share)) && + ((all_zones) || (args[1]->soi_zoneid == zoneid)) / { printf("clnt=%s mid=0x%x status=0x%x\n", args[0]->ci_remote, args[1]->soi_mid, args[1]->soi_status); } + +dtrace:::END +{ +} diff --git a/usr/src/cmd/smbsrv/dtrace/smb2-trace.d b/usr/src/cmd/smbsrv/dtrace/smb2-trace.d index 4e83216785..409d878dea 100644 --- a/usr/src/cmd/smbsrv/dtrace/smb2-trace.d +++ b/usr/src/cmd/smbsrv/dtrace/smb2-trace.d @@ -1,3 +1,4 @@ +#!/usr/sbin/dtrace -s /* * This file and its contents are supplied under the terms of the * Common Development and Distribution License ("CDDL"), version 1.0. @@ -10,7 +11,7 @@ */ /* - * Copyright 2017 Nexenta Systems, Inc. All rights reserved. + * Copyright 2018 Nexenta Systems, Inc. All rights reserved. */ /* @@ -23,9 +24,38 @@ * Some also provide one of: (not used here) * args[2] smb_open_args_t * args[2] smb_rw_args_t + * + * Usage: smb2-trace.d [<client ip>|all [<share path>|all] [<zone id>]]] + * + * example: smb2_trace.d 192.168.012.001 mypool_fs1 0 + * + * It is valid to specify <client ip> or <share path> as "all" to + * print data for all clients and/or all shares. + * Omitting <zone id> will print data for all zones. */ +#pragma D option defaultargs + +dtrace:::BEGIN +{ + all_clients = (($$1 == NULL) || ($$1 == "all")) ? 1 : 0; + all_shares = (($$2 == NULL) || ($$2 == "all")) ? 1 : 0; + all_zones = ($$3 == NULL) ? 1 : 0; + + client = $$1; + share = $$2; + zoneid = $3; + + printf("%Y - client=%s share=%s zone=%s)\n", walltimestamp, + (all_clients) ? "all" : client, + (all_shares) ? "all" : share, + (all_zones) ? "all" : $$3); +} + smb2:::op-*-start +/ ((all_clients == 1) || (args[0]->ci_remote == client)) && + ((all_shares == 1) || (args[1]->soi_share == share)) && + ((all_zones == 1) || (args[1]->soi_zoneid == zoneid)) / { printf("clnt=%s mid=0x%x uid=0x%x tid=0x%x\n", args[0]->ci_remote, @@ -35,9 +65,16 @@ smb2:::op-*-start } smb2:::op-*-done +/ ((all_clients == 1) || (args[0]->ci_remote == client)) && + ((all_shares == 1) || (args[1]->soi_share == share)) && + ((all_zones == 1) || (args[1]->soi_zoneid == zoneid)) / { printf("clnt=%s mid=0x%x status=0x%x\n", args[0]->ci_remote, args[1]->soi_mid, args[1]->soi_status); } + +dtrace:::END +{ +} diff --git a/usr/src/cmd/stat/kstat/Makefile b/usr/src/cmd/stat/kstat/Makefile index 668c8ffec8..c315bf7c2c 100644 --- a/usr/src/cmd/stat/kstat/Makefile +++ b/usr/src/cmd/stat/kstat/Makefile @@ -22,6 +22,8 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2020 Peter tribble. +# PROG = kstat OBJS = kstat.o @@ -37,7 +39,6 @@ CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CPPFLAGS_sparc += -I$(SRC)/uts/sfmmu -CPPFLAGS_sparc += -I$(SRC)/uts/sun4u/sunfire CPPFLAGS += $(CPPFLAGS_$(MACH)) FILEMODE= 0555 diff --git a/usr/src/cmd/stat/kstat/kstat.c b/usr/src/cmd/stat/kstat/kstat.c index 236437face..2276b9762a 100644 --- a/usr/src/cmd/stat/kstat/kstat.c +++ b/usr/src/cmd/stat/kstat/kstat.c @@ -24,6 +24,7 @@ * Copyright (c) 2013 David Hoeppner. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright 2016 Joyent, Inc. + * Copyright 2020 Peter Tribble. */ /* @@ -518,7 +519,7 @@ static kstat_raw_reader_t lookup_raw_kstat_fn(char *module, char *name) { char key[KSTAT_STRLEN * 2]; - register char *f, *t; + register char *f, *t; int n = 0; for (f = module, t = key; *f != '\0'; f++, t++) { @@ -1324,171 +1325,6 @@ save_sfmmu_tsbsize_stat(kstat_t *kp, ks_instance_t *ksi) } #endif -#ifdef __sparc -static void -save_simmstat(kstat_t *kp, ks_instance_t *ksi) -{ - uchar_t *simmstat; - char *simm_buf; - char *list = NULL; - int i; - - assert(kp->ks_data_size == sizeof (uchar_t) * SIMM_COUNT); - - for (i = 0, simmstat = (uchar_t *)(kp->ks_data); i < SIMM_COUNT - 1; - i++, simmstat++) { - if (list == NULL) { - (void) asprintf(&simm_buf, "%d,", *simmstat); - } else { - (void) asprintf(&simm_buf, "%s%d,", list, *simmstat); - free(list); - } - list = simm_buf; - } - - (void) asprintf(&simm_buf, "%s%d", list, *simmstat); - SAVE_STRING_X(ksi, "status", simm_buf); - free(list); - free(simm_buf); -} -#endif - -#ifdef __sparc -/* - * Helper function for save_temperature(). - */ -static char * -short_array_to_string(short *shortp, int len) -{ - char *list = NULL; - char *list_buf; - - for (; len > 1; len--, shortp++) { - if (list == NULL) { - (void) asprintf(&list_buf, "%hd,", *shortp); - } else { - (void) asprintf(&list_buf, "%s%hd,", list, *shortp); - free(list); - } - list = list_buf; - } - - (void) asprintf(&list_buf, "%s%hd", list, *shortp); - free(list); - return (list_buf); -} - -static void -save_temperature(kstat_t *kp, ks_instance_t *ksi) -{ - struct temp_stats *temps = (struct temp_stats *)(kp->ks_data); - char *buf; - - assert(kp->ks_data_size == sizeof (struct temp_stats)); - - SAVE_UINT32(ksi, temps, index); - - buf = short_array_to_string(temps->l1, L1_SZ); - SAVE_STRING_X(ksi, "l1", buf); - free(buf); - - buf = short_array_to_string(temps->l2, L2_SZ); - SAVE_STRING_X(ksi, "l2", buf); - free(buf); - - buf = short_array_to_string(temps->l3, L3_SZ); - SAVE_STRING_X(ksi, "l3", buf); - free(buf); - - buf = short_array_to_string(temps->l4, L4_SZ); - SAVE_STRING_X(ksi, "l4", buf); - free(buf); - - buf = short_array_to_string(temps->l5, L5_SZ); - SAVE_STRING_X(ksi, "l5", buf); - free(buf); - - SAVE_INT32(ksi, temps, max); - SAVE_INT32(ksi, temps, min); - SAVE_INT32(ksi, temps, state); - SAVE_INT32(ksi, temps, temp_cnt); - SAVE_INT32(ksi, temps, shutdown_cnt); - SAVE_INT32(ksi, temps, version); - SAVE_INT32(ksi, temps, trend); - SAVE_INT32(ksi, temps, override); -} -#endif - -#ifdef __sparc -static void -save_temp_over(kstat_t *kp, ks_instance_t *ksi) -{ - short *sh = (short *)(kp->ks_data); - char *value; - - assert(kp->ks_data_size == sizeof (short)); - - (void) asprintf(&value, "%hu", *sh); - SAVE_STRING_X(ksi, "override", value); - free(value); -} -#endif - -#ifdef __sparc -static void -save_ps_shadow(kstat_t *kp, ks_instance_t *ksi) -{ - uchar_t *uchar = (uchar_t *)(kp->ks_data); - - assert(kp->ks_data_size == SYS_PS_COUNT); - - SAVE_CHAR_X(ksi, "core_0", *uchar++); - SAVE_CHAR_X(ksi, "core_1", *uchar++); - SAVE_CHAR_X(ksi, "core_2", *uchar++); - SAVE_CHAR_X(ksi, "core_3", *uchar++); - SAVE_CHAR_X(ksi, "core_4", *uchar++); - SAVE_CHAR_X(ksi, "core_5", *uchar++); - SAVE_CHAR_X(ksi, "core_6", *uchar++); - SAVE_CHAR_X(ksi, "core_7", *uchar++); - SAVE_CHAR_X(ksi, "pps_0", *uchar++); - SAVE_CHAR_X(ksi, "clk_33", *uchar++); - SAVE_CHAR_X(ksi, "clk_50", *uchar++); - SAVE_CHAR_X(ksi, "v5_p", *uchar++); - SAVE_CHAR_X(ksi, "v12_p", *uchar++); - SAVE_CHAR_X(ksi, "v5_aux", *uchar++); - SAVE_CHAR_X(ksi, "v5_p_pch", *uchar++); - SAVE_CHAR_X(ksi, "v12_p_pch", *uchar++); - SAVE_CHAR_X(ksi, "v3_pch", *uchar++); - SAVE_CHAR_X(ksi, "v5_pch", *uchar++); - SAVE_CHAR_X(ksi, "p_fan", *uchar++); -} -#endif - -#ifdef __sparc -static void -save_fault_list(kstat_t *kp, ks_instance_t *ksi) -{ - struct ft_list *fault; - char name[KSTAT_STRLEN + 7]; - int i; - - for (i = 1, fault = (struct ft_list *)(kp->ks_data); - i <= 999999 && i <= kp->ks_data_size / sizeof (struct ft_list); - i++, fault++) { - (void) snprintf(name, sizeof (name), "unit_%d", i); - SAVE_INT32_X(ksi, name, fault->unit); - (void) snprintf(name, sizeof (name), "type_%d", i); - SAVE_INT32_X(ksi, name, fault->type); - (void) snprintf(name, sizeof (name), "fclass_%d", i); - SAVE_INT32_X(ksi, name, fault->fclass); - (void) snprintf(name, sizeof (name), "create_time_%d", i); - SAVE_HRTIME_X(ksi, name, fault->create_time); - (void) snprintf(name, sizeof (name), "msg_%d", i); - SAVE_STRING_X(ksi, name, fault->msg); - } -} -#endif - static void save_named(kstat_t *kp, ks_instance_t *ksi) { diff --git a/usr/src/cmd/stat/kstat/kstat.h b/usr/src/cmd/stat/kstat/kstat.h index b59263398c..9fd2077dce 100644 --- a/usr/src/cmd/stat/kstat/kstat.h +++ b/usr/src/cmd/stat/kstat/kstat.h @@ -22,6 +22,7 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Copyright 2013 David Hoeppner. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2020 Peter Tribble. */ #ifndef _STAT_KSTAT_H @@ -41,9 +42,6 @@ #ifdef __sparc #include <vm/hat_sfmmu.h> -#include <sys/simmstat.h> -#include <sys/sysctrl.h> -#include <sys/fhc.h> #endif #define KSTAT_DATA_HRTIME (KSTAT_DATA_STRING + 1) @@ -85,7 +83,7 @@ typedef union ks_value { nvpair_insert(I, #N, &v, KSTAT_DATA_UINT32); \ } -#define SAVE_INT64(I, S, N) \ +#define SAVE_INT64(I, S, N) \ { \ ks_value_t v; \ v.i64 = S->N; \ @@ -167,7 +165,7 @@ typedef struct ks_instance { char ks_name[KSTAT_STRLEN]; char ks_module[KSTAT_STRLEN]; char ks_class[KSTAT_STRLEN]; - int ks_instance; + int ks_instance; uchar_t ks_type; hrtime_t ks_snaptime; list_t ks_nvlist; @@ -214,13 +212,6 @@ static void save_nfs(kstat_t *, ks_instance_t *); #ifdef __sparc static void save_sfmmu_global_stat(kstat_t *, ks_instance_t *); static void save_sfmmu_tsbsize_stat(kstat_t *, ks_instance_t *); -static void save_simmstat(kstat_t *, ks_instance_t *); -/* Helper function for save_temperature() */ -static char *short_array_to_string(short *, int); -static void save_temperature(kstat_t *, ks_instance_t *); -static void save_temp_over(kstat_t *, ks_instance_t *); -static void save_ps_shadow(kstat_t *, ks_instance_t *); -static void save_fault_list(kstat_t *, ks_instance_t *); #endif /* Named kstat readers */ @@ -246,11 +237,6 @@ static struct { #ifdef __sparc {save_sfmmu_global_stat, "unix:sfmmu_global_stat"}, {save_sfmmu_tsbsize_stat, "unix:sfmmu_tsbsize_stat"}, - {save_simmstat, "unix:simm-status"}, - {save_temperature, "unix:temperature"}, - {save_temp_over, "unix:temperature override"}, - {save_ps_shadow, "unix:ps_shadow"}, - {save_fault_list, "unix:fault_list"}, #endif {NULL, NULL}, }; diff --git a/usr/src/cmd/zdb/Makefile.com b/usr/src/cmd/zdb/Makefile.com index 1834e9b2f8..42925319f4 100644 --- a/usr/src/cmd/zdb/Makefile.com +++ b/usr/src/cmd/zdb/Makefile.com @@ -23,7 +23,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # Copyright (c) 2012 by Delphix. All rights reserved. -# Copyright (c) 2018, Joyent, Inc. +# Copyright 2020 Joyent, Inc. # Copyright 2017 RackTop Systems. # @@ -37,8 +37,9 @@ include ../../Makefile.ctf INCS += -I../../../lib/libzpool/common INCS += -I../../../uts/common/fs/zfs INCS += -I../../../common/zfs +INCS += -I../../../lib/libzutil/common -LDLIBS += -lzpool -lumem -lnvpair -lzfs -lavl -lcmdutils -lfakekernel +LDLIBS += -lzpool -lumem -lnvpair -lzutil -lavl -lfakekernel CSTD= $(CSTD_GNU99) C99LMODE= -Xc99=%all diff --git a/usr/src/cmd/zdb/zdb.c b/usr/src/cmd/zdb/zdb.c index 03e78ce4ba..8272bbf64f 100644 --- a/usr/src/cmd/zdb/zdb.c +++ b/usr/src/cmd/zdb/zdb.c @@ -71,6 +71,9 @@ #undef verify #include <libzfs.h> +#include <libnvpair.h> +#include <libzutil.h> + #include "zdb.h" #define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \ @@ -101,7 +104,6 @@ typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size); uint64_t *zopt_object = NULL; static unsigned zopt_objects = 0; -libzfs_handle_t *g_zfs; uint64_t max_inflight = 1000; static int leaked_objects = 0; @@ -5884,8 +5886,6 @@ main(int argc, char **argv) spa_load_verify_dryrun = B_TRUE; kernel_init(FREAD); - g_zfs = libzfs_init(); - ASSERT(g_zfs != NULL); if (dump_all) verbose = MAX(verbose, 1); @@ -5964,7 +5964,8 @@ main(int argc, char **argv) args.path = searchdirs; args.can_be_active = B_TRUE; - error = zpool_tryimport(g_zfs, target_pool, &cfg, &args); + error = zpool_find_config(NULL, target_pool, &cfg, &args, + &libzpool_config_ops); if (error == 0) { @@ -6094,7 +6095,6 @@ main(int argc, char **argv) dump_debug_buffer(); - libzfs_fini(g_zfs); kernel_fini(); return (error); diff --git a/usr/src/cmd/zfs/Makefile b/usr/src/cmd/zfs/Makefile index a65371609c..97642e44f9 100644 --- a/usr/src/cmd/zfs/Makefile +++ b/usr/src/cmd/zfs/Makefile @@ -24,7 +24,7 @@ # Copyright 2010 Nexenta Systems, Inc. All rights reserved. # Copyright (c) 2012, 2015 by Delphix. All rights reserved. # Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>. -# Copyright 2019 Joyent, Inc. +# Copyright 2020 Joyent, Inc. # PROG= zfs @@ -41,12 +41,13 @@ LINKPROGS= mount umount ROOTETCFSTYPE= $(ROOTETC)/fs/$(FSTYPE) USRLIBFSTYPE= $(ROOTLIB)/fs/$(FSTYPE) -LDLIBS += -lzfs_core -lzfs -luutil -lumem -lnvpair -lsec -lidmap +LDLIBS += -lzfs_core -lzfs -luutil -lumem -lnvpair -lsec -lidmap -lzutil # cmdutils has list(9F) functions used by the project code. LDLIBS += -lcmdutils INCS += -I../../common/zfs INCS += -I$(SRC)/uts/common/fs/zfs +INCS += -I../../lib/libzutil/common CSTD= $(CSTD_GNU99) C99LMODE= -Xc99=%all diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c index ef3f9155f3..ecc049c1fc 100644 --- a/usr/src/cmd/zfs/zfs_main.c +++ b/usr/src/cmd/zfs/zfs_main.c @@ -68,6 +68,7 @@ #include <libzfs_core.h> #include <zfs_prop.h> #include <zfs_deleg.h> +#include <libzutil.h> #include <libuutil.h> #include <aclutils.h> #include <directory.h> diff --git a/usr/src/cmd/zhack/Makefile.com b/usr/src/cmd/zhack/Makefile.com index 8a87de4ec9..d45962c16d 100644 --- a/usr/src/cmd/zhack/Makefile.com +++ b/usr/src/cmd/zhack/Makefile.com @@ -27,6 +27,7 @@ # # Copyright (c) 2012, 2016 by Delphix. All rights reserved. # Copyright 2017 RackTop Systems. +# Copyright 2020 Joyent, Inc. # PROG= zhack @@ -40,8 +41,9 @@ INCS += -I../../../lib/libzpool/common INCS += -I../../../uts/common/fs/zfs INCS += -I../../../uts/common/fs/zfs/lua INCS += -I../../../common/zfs +INCS += -I../../../lib/libzutil/common -LDLIBS += -lzpool -lumem -lnvpair -lzfs +LDLIBS += -lzpool -lumem -lnvpair -lzutil CSTD= $(CSTD_GNU99) C99LMODE= -Xc99=%all diff --git a/usr/src/cmd/zhack/zhack.c b/usr/src/cmd/zhack/zhack.c index 1f90f97bdf..235b1fd0ca 100644 --- a/usr/src/cmd/zhack/zhack.c +++ b/usr/src/cmd/zhack/zhack.c @@ -49,12 +49,11 @@ #include <sys/zfeature.h> #include <sys/dmu_tx.h> #undef verify -#include <libzfs.h> +#include <libzutil.h> extern boolean_t zfeature_checks_disable; const char cmdname[] = "zhack"; -libzfs_handle_t *g_zfs; static importargs_t g_importargs; static char *g_pool; static boolean_t g_readonly; @@ -128,20 +127,17 @@ zhack_import(char *target, boolean_t readonly) int error; kernel_init(readonly ? FREAD : (FREAD | FWRITE)); - g_zfs = libzfs_init(); - ASSERT(g_zfs != NULL); dmu_objset_register_type(DMU_OST_ZFS, space_delta_cb); g_readonly = readonly; - g_importargs.unique = B_TRUE; g_importargs.can_be_active = readonly; g_pool = strdup(target); - error = zpool_tryimport(g_zfs, target, &config, &g_importargs); + error = zpool_find_config(NULL, target, &config, &g_importargs, + &libzpool_config_ops); if (error) - fatal(NULL, FTAG, "cannot import '%s': %s", target, - libzfs_error_description(g_zfs)); + fatal(NULL, FTAG, "cannot import '%s'", target); props = NULL; if (readonly) { @@ -528,7 +524,6 @@ main(int argc, char **argv) "changes may not be committed to disk\n"); } - libzfs_fini(g_zfs); kernel_fini(); return (rv); diff --git a/usr/src/cmd/zinject/Makefile.com b/usr/src/cmd/zinject/Makefile.com index 8644e8185d..220c877b42 100644 --- a/usr/src/cmd/zinject/Makefile.com +++ b/usr/src/cmd/zinject/Makefile.com @@ -24,6 +24,7 @@ # # Copyright (c) 2016 by Delphix. All rights reserved. # Copyright 2017 RackTop Systems. +# Copyright 2020 Joyent, Inc. # PROG:sh= cd ..; basename `pwd` @@ -36,7 +37,7 @@ INCS += -I../../../lib/libzpool/common INCS += -I../../../uts/common/fs/zfs INCS += -I../../../uts/common/fs/zfs/lua -LDLIBS += -lzpool -lzfs -lnvpair +LDLIBS += -lzfs -lnvpair CSTD= $(CSTD_GNU99) C99LMODE= -Xc99=%all diff --git a/usr/src/cmd/zinject/translate.c b/usr/src/cmd/zinject/translate.c index 090f2448b0..546009ab88 100644 --- a/usr/src/cmd/zinject/translate.c +++ b/usr/src/cmd/zinject/translate.c @@ -25,8 +25,6 @@ #include <libzfs.h> -#include <sys/zfs_context.h> - #include <errno.h> #include <fcntl.h> #include <stdarg.h> @@ -49,9 +47,6 @@ #include "zinject.h" -extern void kernel_init(int); -extern void kernel_fini(void); - static int debug; static void @@ -157,51 +152,32 @@ parse_pathname(const char *inpath, char *dataset, char *relpath, } /* - * Convert from a (dataset, path) pair into a (objset, object) pair. Note that - * we grab the object number from the inode number, since looking this up via - * libzpool is a real pain. + * Convert from a dataset to a objset id. Note that + * we grab the object number from the inode number. */ -/* ARGSUSED */ static int -object_from_path(const char *dataset, const char *path, struct stat64 *statbuf, - zinject_record_t *record) +object_from_path(const char *dataset, uint64_t object, zinject_record_t *record) { - objset_t *os; - int err; - - /* - * Before doing any libzpool operations, call sync() to ensure that the - * on-disk state is consistent with the in-core state. - */ - sync(); + zfs_handle_t *zhp; - err = dmu_objset_own(dataset, DMU_OST_ZFS, B_TRUE, B_FALSE, FTAG, &os); - if (err != 0) { - (void) fprintf(stderr, "cannot open dataset '%s': %s\n", - dataset, strerror(err)); + if ((zhp = zfs_open(g_zfs, dataset, ZFS_TYPE_DATASET)) == NULL) return (-1); - } - record->zi_objset = dmu_objset_id(os); - record->zi_object = statbuf->st_ino; + record->zi_objset = zfs_prop_get_int(zhp, ZFS_PROP_OBJSETID); + record->zi_object = object; - dmu_objset_disown(os, B_FALSE, FTAG); + zfs_close(zhp); return (0); } /* - * Calculate the real range based on the type, level, and range given. + * Initialize the range based on the type, level, and range given. */ static int -calculate_range(const char *dataset, err_type_t type, int level, char *range, +initialize_range(err_type_t type, int level, char *range, zinject_record_t *record) { - objset_t *os = NULL; - dnode_t *dn = NULL; - int err; - int ret = -1; - /* * Determine the numeric range from the string. */ @@ -229,7 +205,7 @@ calculate_range(const char *dataset, err_type_t type, int level, char *range, (void) fprintf(stderr, "invalid range '%s': must be " "a numeric range of the form 'start[,end]'\n", range); - goto out; + return (-1); } } @@ -247,7 +223,7 @@ calculate_range(const char *dataset, err_type_t type, int level, char *range, if (range != NULL) { (void) fprintf(stderr, "range cannot be specified when " "type is 'dnode'\n"); - goto out; + return (-1); } record->zi_start = record->zi_object * sizeof (dnode_phys_t); @@ -256,76 +232,9 @@ calculate_range(const char *dataset, err_type_t type, int level, char *range, break; } - /* - * Get the dnode associated with object, so we can calculate the block - * size. - */ - if ((err = dmu_objset_own(dataset, DMU_OST_ANY, - B_TRUE, B_FALSE, FTAG, &os)) != 0) { - (void) fprintf(stderr, "cannot open dataset '%s': %s\n", - dataset, strerror(err)); - goto out; - } - - if (record->zi_object == 0) { - dn = DMU_META_DNODE(os); - } else { - err = dnode_hold(os, record->zi_object, FTAG, &dn); - if (err != 0) { - (void) fprintf(stderr, "failed to hold dnode " - "for object %llu\n", - (u_longlong_t)record->zi_object); - goto out; - } - } - - - ziprintf("data shift: %d\n", (int)dn->dn_datablkshift); - ziprintf(" ind shift: %d\n", (int)dn->dn_indblkshift); - - /* - * Translate range into block IDs. - */ - if (record->zi_start != 0 || record->zi_end != -1ULL) { - record->zi_start >>= dn->dn_datablkshift; - record->zi_end >>= dn->dn_datablkshift; - } - - /* - * Check level, and then translate level 0 blkids into ranges - * appropriate for level of indirection. - */ record->zi_level = level; - if (level > 0) { - ziprintf("level 0 blkid range: [%llu, %llu]\n", - record->zi_start, record->zi_end); - - if (level >= dn->dn_nlevels) { - (void) fprintf(stderr, "level %d exceeds max level " - "of object (%d)\n", level, dn->dn_nlevels - 1); - goto out; - } - - if (record->zi_start != 0 || record->zi_end != 0) { - int shift = dn->dn_indblkshift - SPA_BLKPTRSHIFT; - for (; level > 0; level--) { - record->zi_start >>= shift; - record->zi_end >>= shift; - } - } - } - - ret = 0; -out: - if (dn) { - if (dn != DMU_META_DNODE(os)) - dnode_rele(dn, FTAG); - } - if (os) - dmu_objset_disown(os, B_FALSE, FTAG); - - return (ret); + return (0); } int @@ -337,8 +246,6 @@ translate_record(err_type_t type, const char *object, const char *range, struct stat64 statbuf; int ret = -1; - kernel_init(FREAD); - debug = (getenv("ZINJECT_DEBUG") != NULL); ziprintf("translating: %s\n", object); @@ -388,16 +295,16 @@ translate_record(err_type_t type, const char *object, const char *range, /* * Convert (dataset, file) into (objset, object) */ - if (object_from_path(dataset, path, &statbuf, record) != 0) + if (object_from_path(dataset, statbuf.st_ino, record) != 0) goto err; ziprintf("raw objset: %llu\n", record->zi_objset); ziprintf("raw object: %llu\n", record->zi_object); /* - * For the given object, calculate the real (type, level, range) + * For the given object, initialize the range in bytes */ - if (calculate_range(dataset, type, level, (char *)range, record) != 0) + if (initialize_range(type, level, (char *)range, record) != 0) goto err; ziprintf(" objset: %llu\n", record->zi_objset); @@ -419,7 +326,6 @@ translate_record(err_type_t type, const char *object, const char *range, ret = 0; err: - kernel_fini(); return (ret); } diff --git a/usr/src/cmd/zinject/zinject.c b/usr/src/cmd/zinject/zinject.c index fc836f11e5..16e659ca6f 100644 --- a/usr/src/cmd/zinject/zinject.c +++ b/usr/src/cmd/zinject/zinject.c @@ -564,6 +564,7 @@ register_handler(const char *pool, int flags, zinject_record_t *record, if (ioctl(zfs_fd, ZFS_IOC_INJECT_FAULT, &zc) != 0) { (void) fprintf(stderr, "failed to add handler: %s\n", + errno == EDOM ? "block level exceeds max level of object" : strerror(errno)); return (1); } @@ -886,6 +887,7 @@ main(int argc, char **argv) break; case 'r': range = optarg; + flags |= ZINJECT_CALC_RANGE; break; case 's': dur_secs = 1; diff --git a/usr/src/cmd/zpool/Makefile b/usr/src/cmd/zpool/Makefile index b849d9c759..55d8abc80f 100644 --- a/usr/src/cmd/zpool/Makefile +++ b/usr/src/cmd/zpool/Makefile @@ -22,7 +22,7 @@ # Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2016 Igor Kozhukhov <ikozhukhov@gmail.com>. # Copyright (c) 2015 by Delphix. All rights reserved. -# Copyright 2019 Joyent, Inc. +# Copyright 2020 Joyent, Inc. # PROG= zpool @@ -40,9 +40,10 @@ STAT_COMMON_OBJS = timestamp.o STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c) SRCS += $(STAT_COMMON_SRCS) -LDLIBS += -lzfs -lnvpair -ldevid -lefi -ldiskmgt -luutil -lumem +LDLIBS += -lzfs -lnvpair -ldevid -lefi -ldiskmgt -luutil -lumem -lzutil INCS += -I../../common/zfs -I../../uts/common/fs/zfs -I$(STATCOMMONDIR) +INCS += -I../../lib/libzutil/common CSTD= $(CSTD_GNU99) C99LMODE= -Xc99=%all diff --git a/usr/src/cmd/zpool/zpool_iter.c b/usr/src/cmd/zpool/zpool_iter.c index 6e77f85fa3..c05c665ada 100644 --- a/usr/src/cmd/zpool/zpool_iter.c +++ b/usr/src/cmd/zpool/zpool_iter.c @@ -34,6 +34,7 @@ #include <strings.h> #include <libzfs.h> +#include <libzutil.h> #include "zpool_util.h" diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c index 96ee2f0850..93df0e1772 100644 --- a/usr/src/cmd/zpool/zpool_main.c +++ b/usr/src/cmd/zpool/zpool_main.c @@ -59,6 +59,7 @@ #include <sys/debug.h> #include <libzfs.h> +#include <libzutil.h> #include "zpool_util.h" #include "zfs_comutil.h" @@ -914,7 +915,7 @@ zpool_do_labelclear(int argc, char **argv) return (1); } - if (zpool_read_label(fd, &config) != 0) { + if (zpool_read_label(fd, &config, NULL) != 0) { (void) fprintf(stderr, gettext("failed to read label from %s\n"), vdev); return (1); @@ -2535,6 +2536,40 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts, return (ret); } +typedef struct target_exists_args { + const char *poolname; + uint64_t poolguid; +} target_exists_args_t; + +static int +name_or_guid_exists(zpool_handle_t *zhp, void *data) +{ + target_exists_args_t *args = data; + nvlist_t *config = zpool_get_config(zhp, NULL); + int found = 0; + + if (config == NULL) + return (0); + + if (args->poolname != NULL) { + char *pool_name; + + verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, + &pool_name) == 0); + if (strcmp(pool_name, args->poolname) == 0) + found = 1; + } else { + uint64_t pool_guid; + + verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, + &pool_guid) == 0); + if (pool_guid == args->poolguid) + found = 1; + } + zpool_close(zhp); + + return (found); +} /* * zpool checkpoint <pool> * checkpoint --discard <pool> @@ -2687,6 +2722,7 @@ zpool_do_import(int argc, char **argv) boolean_t dryrun = B_FALSE; boolean_t do_rewind = B_FALSE; boolean_t xtreme_rewind = B_FALSE; + boolean_t pool_exists = B_FALSE; uint64_t pool_state, txg = -1ULL; char *cachefile = NULL; importargs_t idata = { 0 }; @@ -2895,10 +2931,10 @@ zpool_do_import(int argc, char **argv) /* * User specified a name or guid. Ensure it's unique. */ - idata.unique = B_TRUE; + target_exists_args_t search = {searchname, searchguid}; + pool_exists = zpool_iter(g_zfs, name_or_guid_exists, &search); } - idata.path = searchdirs; idata.paths = nsearch; idata.poolname = searchname; @@ -2906,9 +2942,9 @@ zpool_do_import(int argc, char **argv) idata.cachefile = cachefile; idata.policy = policy; - pools = zpool_search_import(g_zfs, &idata); + pools = zpool_search_import(g_zfs, &idata, &libzfs_config_ops); - if (pools != NULL && idata.exists && + if (pools != NULL && pool_exists && (argc == 1 || strcmp(argv[0], argv[1]) == 0)) { (void) fprintf(stderr, gettext("cannot import '%s': " "a pool with that name already exists\n"), @@ -2917,7 +2953,7 @@ zpool_do_import(int argc, char **argv) "[-t] <pool | id> <newpool>' to give it a new temporary " "or permanent name\n")); err = 1; - } else if (pools == NULL && idata.exists) { + } else if (pools == NULL && pool_exists) { (void) fprintf(stderr, gettext("cannot import '%s': " "a pool with that name is already created/imported,\n"), argv[0]); @@ -3389,7 +3425,7 @@ get_interval_count(int *argcp, char **argv, unsigned long *iv, /* * Determine if the last argument is an integer or a pool name */ - if (argc > 0 && isdigit(argv[argc - 1][0])) { + if (argc > 0 && zfs_isnumber(argv[argc - 1])) { char *end; errno = 0; @@ -3419,7 +3455,7 @@ get_interval_count(int *argcp, char **argv, unsigned long *iv, * If the last argument is also an integer, then we have both a count * and an interval. */ - if (argc > 0 && isdigit(argv[argc - 1][0])) { + if (argc > 0 && zfs_isnumber(argv[argc - 1])) { char *end; errno = 0; diff --git a/usr/src/cmd/zpool/zpool_vdev.c b/usr/src/cmd/zpool/zpool_vdev.c index 6e6589ab47..652bece3ab 100644 --- a/usr/src/cmd/zpool/zpool_vdev.c +++ b/usr/src/cmd/zpool/zpool_vdev.c @@ -69,6 +69,7 @@ #include <libdiskmgt.h> #include <libintl.h> #include <libnvpair.h> +#include <libzutil.h> #include <limits.h> #include <sys/spa.h> #include <stdio.h> @@ -1124,7 +1125,7 @@ is_spare(nvlist_t *config, const char *path) if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) != 0 || !inuse || state != POOL_STATE_SPARE || - zpool_read_label(fd, &label) != 0) { + zpool_read_label(fd, &label, NULL) != 0) { free(name); (void) close(fd); return (B_FALSE); diff --git a/usr/src/cmd/ztest/Makefile.com b/usr/src/cmd/ztest/Makefile.com index fb32fdd938..0db755a6f7 100644 --- a/usr/src/cmd/ztest/Makefile.com +++ b/usr/src/cmd/ztest/Makefile.com @@ -22,7 +22,7 @@ # Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2016 by Delphix. All rights reserved. # Copyright 2017 RackTop Systems. -# Copyright 2019 Joyent, Inc. +# Copyright 2020 Joyent, Inc. PROG= ztest OBJS= $(PROG).o @@ -35,8 +35,9 @@ INCS += -I../../../lib/libzpool/common INCS += -I../../../uts/common/fs/zfs INCS += -I../../../uts/common/fs/zfs/lua INCS += -I../../../common/zfs +INCS += -I../../../lib/libzutil/common -LDLIBS += -lumem -lzpool -lcmdutils -lm -lnvpair -lfakekernel -lzfs +LDLIBS += -lumem -lzpool -lcmdutils -lm -lnvpair -lfakekernel -lzutil CSTD= $(CSTD_GNU99) C99LMODE= -Xc99=%all diff --git a/usr/src/cmd/ztest/ztest.c b/usr/src/cmd/ztest/ztest.c index 83922cf376..f4f577e4d3 100644 --- a/usr/src/cmd/ztest/ztest.c +++ b/usr/src/cmd/ztest/ztest.c @@ -128,7 +128,7 @@ #include <math.h> #include <sys/fs/zfs.h> #include <libnvpair.h> -#include <libzfs.h> +#include <libzutil.h> #include <libcmdutils.h> static int ztest_fd_data = -1; @@ -6811,7 +6811,6 @@ make_random_props() static void ztest_import(ztest_shared_t *zs) { - libzfs_handle_t *hdl; importargs_t args = { 0 }; spa_t *spa; nvlist_t *cfg = NULL; @@ -6825,14 +6824,14 @@ ztest_import(ztest_shared_t *zs) rw_init(&ztest_name_lock, NULL, USYNC_THREAD, NULL); kernel_init(FREAD | FWRITE); - hdl = libzfs_init(); searchdirs[0] = ztest_opts.zo_dir; args.paths = nsearch; args.path = searchdirs; args.can_be_active = B_FALSE; - error = zpool_tryimport(hdl, name, &cfg, &args); + error = zpool_find_config(NULL, name, &cfg, &args, + &libzpool_config_ops); if (error) (void) fatal(0, "No pools found\n"); @@ -6842,7 +6841,6 @@ ztest_import(ztest_shared_t *zs) 1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift; spa_close(spa, FTAG); - libzfs_fini(hdl); kernel_fini(); if (!ztest_opts.zo_mmp_test) { |
