summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2017-09-18 11:32:34 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2017-09-18 11:32:34 +0000
commit18dd2b9673f53eb496b30698f998b87209d6e45f (patch)
treeadd9e7a6b7d5cf373718b4e8def087f8464e4a8a
parent09443b7960ae0f0a3ddcf56d1879e006c2790316 (diff)
parented992b0aac4e5b70dc1273b1d055c0d471fbb4b1 (diff)
downloadillumos-joyent-18dd2b9673f53eb496b30698f998b87209d6e45f.tar.gz
[illumos-gate merge]
commit ed992b0aac4e5b70dc1273b1d055c0d471fbb4b1 8604 Avoid unnecessary work search in VFS when unmounting snapshots commit 5f39f884e2035d671ec02148fc4d8420c670bcb4 8605 zfs channel programs: zfs.exists undocumented and non-working commit 2bcb5458541cc6e8bf7dc541303da29297b82e8b 8602 remove unused "dp_early_sync_tasks" field from "dsl_pool" structure commit c861bfbd77c4ae780a0341e9cb6926d8b74341cf 8567 Inconsistent return value in zpool_read_label commit a141dbd6230b88bf7da3b673ca0f9b46918d5684 8655 remove more gender specific language commit 30acb30daf662150e9e016113303bd74f2379dfc 8626 make pcplusmp and apix warning-free Conflicts: usr/src/uts/i86pc/io/pcplusmp/apic_introp.c usr/src/uts/i86pc/io/mp_platform_misc.c
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/pppd/ipv6cp.c2
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ipseckey.c2
-rw-r--r--usr/src/cmd/format/main.c2
-rw-r--r--usr/src/cmd/fs.d/zfs/fstyp/fstyp.c3
-rw-r--r--usr/src/cmd/tar/tar.c4
-rw-r--r--usr/src/cmd/vi/port/ex_cmdsub.c2
-rw-r--r--usr/src/cmd/zpool/zpool_main.c2
-rw-r--r--usr/src/head/arpa/telnet.h4
-rw-r--r--usr/src/lib/libbc/libc/gen/common/ndbm.c5
-rw-r--r--usr/src/lib/libc/port/threads/thr.c2
-rw-r--r--usr/src/lib/libzfs/common/libzfs_import.c9
-rw-r--r--usr/src/man/man1m/zfs-program.1m12
-rw-r--r--usr/src/pkg/manifests/system-test-zfstest.mf5
-rw-r--r--usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh45
-rw-r--r--usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.zcp26
-rw-r--r--usr/src/uts/common/fs/zfs/dsl_destroy.c18
-rw-r--r--usr/src/uts/common/fs/zfs/sys/dsl_pool.h1
-rw-r--r--usr/src/uts/common/fs/zfs/sys/zfs_ioctl.h5
-rw-r--r--usr/src/uts/common/fs/zfs/zcp.c2
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_ioctl.c67
-rw-r--r--usr/src/uts/i86pc/io/mp_platform_common.c1
-rw-r--r--usr/src/uts/i86pc/io/mp_platform_misc.c5
-rw-r--r--usr/src/uts/i86pc/io/pcplusmp/apic_introp.c2
23 files changed, 150 insertions, 76 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.bin/pppd/ipv6cp.c b/usr/src/cmd/cmd-inet/usr.bin/pppd/ipv6cp.c
index 122f805147..71651dbdba 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/pppd/ipv6cp.c
+++ b/usr/src/cmd/cmd-inet/usr.bin/pppd/ipv6cp.c
@@ -885,7 +885,7 @@ ipv6cp_reqci(f, p, lenp, dont_nak)
/*
* If it has no interface identifier, or if we both
* have same identifier then NAK it with new idea. In
- * particular, if we don't know his identifier, but it
+ * particular, if we don't know its identifier, but it
* does, then accept that identifier.
*/
eui64_get(ifaceid, p);
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ipseckey.c b/usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ipseckey.c
index 2b5a8e61fe..14cb3eb28d 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ipseckey.c
+++ b/usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ipseckey.c
@@ -1728,7 +1728,7 @@ doaddup(int cmd, int satype, char *argv[], char *ebuf)
switch (token) {
case TOK_SPI:
/*
- * If some cretin types in "spi 0" then they
+ * If they type in "spi 0" then they
* can type in another SPI.
*/
if (assoc->sadb_sa_spi != 0) {
diff --git a/usr/src/cmd/format/main.c b/usr/src/cmd/format/main.c
index 4cc1105e0e..489b1b88e5 100644
--- a/usr/src/cmd/format/main.c
+++ b/usr/src/cmd/format/main.c
@@ -492,7 +492,7 @@ init_globals(disk)
fmt_print("]");
/*
* Drive wasn't formatted. Tell the user in case they
- * disagrees.
+ * disagree.
*/
} else if (EMBEDDED_SCSI) {
fmt_print("[disk unformatted]");
diff --git a/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c b/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c
index 53bfda70c5..30f86375e7 100644
--- a/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c
+++ b/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c
@@ -89,8 +89,7 @@ fstyp_mod_ident(fstyp_mod_handle_t handle)
uint64_t u64;
char buf[64];
- if (zpool_read_label(h->fd, &h->config) != 0 ||
- h->config == NULL) {
+ if (zpool_read_label(h->fd, &h->config) != 0) {
return (FSTYP_ERR_NO_MATCH);
}
diff --git a/usr/src/cmd/tar/tar.c b/usr/src/cmd/tar/tar.c
index 7b15c3c2b2..7aca75a35f 100644
--- a/usr/src/cmd/tar/tar.c
+++ b/usr/src/cmd/tar/tar.c
@@ -1465,8 +1465,8 @@ dorep(char *argv[])
* endtape checks the entry in dblock.dbuf to see if its the
* special EOT entry. Endtape is usually called after getdir().
*
- * endtape used to call backtape; it no longer does, it who
- * wants it backed up must call backtape himself
+ * endtape used to call backtape; it no longer does. If the caller
+ * wants the tape backed up, it must call backtape itself
* RETURNS: 0 if not EOT, tape position unaffected
* 1 if EOT, tape position unaffected
*/
diff --git a/usr/src/cmd/vi/port/ex_cmdsub.c b/usr/src/cmd/vi/port/ex_cmdsub.c
index 1f1889fa70..1b3e9d5d87 100644
--- a/usr/src/cmd/vi/port/ex_cmdsub.c
+++ b/usr/src/cmd/vi/port/ex_cmdsub.c
@@ -1621,7 +1621,7 @@ addmac(unsigned char *src, unsigned char *dest, unsigned char *dname,
if (src[1] == 0 && src[0] == dest[strlen(dest)-1])
error(gettext("No tail recursion"));
/*
- * We don't let the user rob himself of ":", and making
+ * We don't let the user rob themself of ":", and making
* multi char words is a bad idea so we don't allow it.
* Note that if user sets mapinput and maps all of return,
* linefeed, and escape, they can hurt themself. This is
diff --git a/usr/src/cmd/zpool/zpool_main.c b/usr/src/cmd/zpool/zpool_main.c
index 8064a0dbf8..5f89a12aba 100644
--- a/usr/src/cmd/zpool/zpool_main.c
+++ b/usr/src/cmd/zpool/zpool_main.c
@@ -709,7 +709,7 @@ zpool_do_labelclear(int argc, char **argv)
return (1);
}
- if (zpool_read_label(fd, &config) != 0 || config == NULL) {
+ if (zpool_read_label(fd, &config) != 0) {
(void) fprintf(stderr,
gettext("failed to read label from %s\n"), vdev);
return (1);
diff --git a/usr/src/head/arpa/telnet.h b/usr/src/head/arpa/telnet.h
index 41ec9cbdde..71b374c5e2 100644
--- a/usr/src/head/arpa/telnet.h
+++ b/usr/src/head/arpa/telnet.h
@@ -245,8 +245,8 @@ extern char *slc_names[];
*/
#define AUTH_REJECT 0 /* Rejected */
#define AUTH_UNKNOWN 1 /* We don't know who it is, but it's okay */
-#define AUTH_OTHER 2 /* We know it, but not it's name */
-#define AUTH_USER 3 /* We know it's name */
+#define AUTH_OTHER 2 /* We know it, but not its name */
+#define AUTH_USER 3 /* We know its name */
#define AUTH_VALID 4 /* We know it, and it needs no password */
/*
diff --git a/usr/src/lib/libbc/libc/gen/common/ndbm.c b/usr/src/lib/libbc/libc/gen/common/ndbm.c
index b8315bdc7a..78676d16eb 100644
--- a/usr/src/lib/libbc/libc/gen/common/ndbm.c
+++ b/usr/src/lib/libbc/libc/gen/common/ndbm.c
@@ -495,10 +495,9 @@ dbm_do_nextkey(DBM *db, datum inkey)
else key=nullkey;
/* the keyptr pagbuf have failed us, the user must
- be an extra clever moron who depends on
- these variables and their former meaning.
+ depend on these variables and their former meaning.
If we set the variables this would have got
- us the key for sure! So give him the old algorithm.*/
+ us the key for sure! So give the user the old algorithm.*/
if (key.dptr == NULL) return (dbm_slow_nextkey(db));
}
diff --git a/usr/src/lib/libc/port/threads/thr.c b/usr/src/lib/libc/port/threads/thr.c
index 747e789442..b6580b3e3a 100644
--- a/usr/src/lib/libc/port/threads/thr.c
+++ b/usr/src/lib/libc/port/threads/thr.c
@@ -1827,7 +1827,7 @@ force_continue(ulwp_t *ulwp)
if (error != 0 && error != EINTR)
break;
error = 0;
- if (ulwp->ul_stopping) { /* it is stopping itsself */
+ if (ulwp->ul_stopping) { /* it is stopping itself */
ts.tv_sec = 0; /* give it a chance to run */
ts.tv_nsec = 100000; /* 100 usecs or clock tick */
(void) __nanosleep(&ts, NULL);
diff --git a/usr/src/lib/libzfs/common/libzfs_import.c b/usr/src/lib/libzfs/common/libzfs_import.c
index 496ba2c321..7fbd9faf0b 100644
--- a/usr/src/lib/libzfs/common/libzfs_import.c
+++ b/usr/src/lib/libzfs/common/libzfs_import.c
@@ -841,6 +841,7 @@ label_offset(uint64_t size, int l)
/*
* Given a file descriptor, read the label information and return an nvlist
* describing the configuration, if there is one.
+ * Return 0 on success, or -1 on failure
*/
int
zpool_read_label(int fd, nvlist_t **config)
@@ -853,7 +854,7 @@ zpool_read_label(int fd, nvlist_t **config)
*config = NULL;
if (fstat64(fd, &statbuf) == -1)
- return (0);
+ return (-1);
size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t);
if ((label = malloc(sizeof (vdev_label_t))) == NULL)
@@ -887,7 +888,7 @@ zpool_read_label(int fd, nvlist_t **config)
free(label);
*config = NULL;
- return (0);
+ return (-1);
}
typedef struct rdsk_node {
@@ -1052,7 +1053,7 @@ zpool_open_func(void *arg)
check_slices(rn->rn_avl, fd, rn->rn_name);
}
- if ((zpool_read_label(fd, &config)) != 0) {
+ if ((zpool_read_label(fd, &config)) != 0 && errno == ENOMEM) {
(void) close(fd);
(void) no_memory(rn->rn_hdl);
return;
@@ -1517,7 +1518,7 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
*inuse = B_FALSE;
- if (zpool_read_label(fd, &config) != 0) {
+ if (zpool_read_label(fd, &config) != 0 && errno == ENOMEM) {
(void) no_memory(hdl);
return (-1);
}
diff --git a/usr/src/man/man1m/zfs-program.1m b/usr/src/man/man1m/zfs-program.1m
index f6562c652b..d8acd4972a 100644
--- a/usr/src/man/man1m/zfs-program.1m
+++ b/usr/src/man/man1m/zfs-program.1m
@@ -289,6 +289,18 @@ msg (string)
.Bd -ragged -compact -offset "xxxx"
Debug message to be printed.
.Ed
+.It Em zfs.exists(dataset)
+Returns true if the given dataset exists, or false if it doesn't.
+A fatal error will be thrown if the dataset is not in the target pool.
+That is, in a channel program running on rpool,
+zfs.exists("rpool/nonexistent_fs") returns false, but
+zfs.exists("somepool/fs_that_may_exist") will error.
+.Pp
+dataset (string)
+.Bd -ragged -compact -offset "xxxx"
+Dataset to check for existence.
+Must be in the target pool.
+.Ed
.It Em zfs.get_prop(dataset, property)
Returns two values.
First, a string, number or table containing the property value for the given
diff --git a/usr/src/pkg/manifests/system-test-zfstest.mf b/usr/src/pkg/manifests/system-test-zfstest.mf
index 0be29e52ae..f1b43d56bc 100644
--- a/usr/src/pkg/manifests/system-test-zfstest.mf
+++ b/usr/src/pkg/manifests/system-test-zfstest.mf
@@ -403,6 +403,11 @@ file \
file \
path=opt/zfs-tests/tests/functional/channel_program/lua_core/tst.divide_by_zero.zcp \
mode=0444
+file path=opt/zfs-tests/tests/functional/channel_program/lua_core/tst.exists \
+ mode=0555
+file \
+ path=opt/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.zcp \
+ mode=0444
file \
path=opt/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal \
mode=0555
diff --git a/usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh b/usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh
new file mode 100644
index 0000000000..e46fe21315
--- /dev/null
+++ b/usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh
@@ -0,0 +1,45 @@
+#!/bin/ksh -p
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2017 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib
+
+#
+# DESCRIPTION:
+# zfs.exists should accurately report whether a dataset exists, and
+# report an error if a dataset is in another pool.
+
+verify_runnable "global"
+
+# create $TESTSNAP and $TESTCLONE
+create_snapshot
+create_clone
+
+function cleanup
+{
+ datasetexists $TESTPOOL/$TESTFS@$TESTSNAP && \
+ log_must zfs destroy -R $TESTPOOL/$TESTFS@$TESTSNAP
+}
+
+log_must_program $TESTPOOL $ZCP_ROOT/lua_core/tst.exists.zcp \
+ $TESTPOOL $TESTPOOL/$TESTFS $TESTPOOL/$TESTFS@$TESTSNAP \
+ $TESTPOOL/$TESTCLONE
+
+log_mustnot_checkerr_program "not in the target pool" \
+ $TESTPOOL - <<-EOF
+ return zfs.exists('rpool')
+EOF
+
+log_pass "zfs.exists() gives correct results"
diff --git a/usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.zcp b/usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.zcp
new file mode 100644
index 0000000000..e44cf45605
--- /dev/null
+++ b/usr/src/test/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.zcp
@@ -0,0 +1,26 @@
+--
+-- This file and its contents are supplied under the terms of the
+-- Common Development and Distribution License ("CDDL"), version 1.0.
+-- You may only use this file in accordance with the terms of version
+-- 1.0 of the CDDL.
+--
+-- A full copy of the text of the CDDL should have accompanied this
+-- source. A copy of the CDDL is also available via the Internet at
+-- http://www.illumos.org/license/CDDL.
+--
+
+--
+-- Copyright (c) 2017 by Delphix. All rights reserved.
+--
+
+-- ensure zfs.exists works as expected.
+
+args = ...
+argv = args['argv']
+pool = argv[1]
+
+for i = 1,4 do
+ assert(zfs.exists(argv[i]))
+end
+
+assert(not zfs.exists(pool .. '/notadataset'))
diff --git a/usr/src/uts/common/fs/zfs/dsl_destroy.c b/usr/src/uts/common/fs/zfs/dsl_destroy.c
index 133b47108c..d11d8c5f72 100644
--- a/usr/src/uts/common/fs/zfs/dsl_destroy.c
+++ b/usr/src/uts/common/fs/zfs/dsl_destroy.c
@@ -488,23 +488,29 @@ dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t defer,
if (nvlist_next_nvpair(snaps, NULL) == NULL)
return (0);
- nvlist_t *arg = fnvlist_alloc();
- nvlist_t *snaps_normalized = fnvlist_alloc();
/*
* lzc_destroy_snaps() is documented to take an nvlist whose
- * values "don't matter". We need to convert that nvlist to one
- * that we know can be converted to LUA.
+ * values "don't matter". We need to convert that nvlist to
+ * one that we know can be converted to LUA. We also don't
+ * care about any duplicate entries because the nvlist will
+ * be converted to a LUA table which should take care of this.
*/
+ nvlist_t *snaps_normalized;
+ VERIFY0(nvlist_alloc(&snaps_normalized, 0, KM_SLEEP));
for (nvpair_t *pair = nvlist_next_nvpair(snaps, NULL);
pair != NULL; pair = nvlist_next_nvpair(snaps, pair)) {
fnvlist_add_boolean_value(snaps_normalized,
nvpair_name(pair), B_TRUE);
}
+
+ nvlist_t *arg;
+ VERIFY0(nvlist_alloc(&arg, 0, KM_SLEEP));
fnvlist_add_nvlist(arg, "snaps", snaps_normalized);
fnvlist_free(snaps_normalized);
fnvlist_add_boolean_value(arg, "defer", defer);
- nvlist_t *wrapper = fnvlist_alloc();
+ nvlist_t *wrapper;
+ VERIFY0(nvlist_alloc(&wrapper, 0, KM_SLEEP));
fnvlist_add_nvlist(wrapper, ZCP_ARG_ARGLIST, arg);
fnvlist_free(arg);
@@ -538,7 +544,7 @@ dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t defer,
program,
0,
zfs_lua_max_memlimit,
- fnvlist_lookup_nvpair(wrapper, ZCP_ARG_ARGLIST), result);
+ nvlist_next_nvpair(wrapper, NULL), result);
if (error != 0) {
char *errorstr = NULL;
(void) nvlist_lookup_string(result, ZCP_RET_ERROR, &errorstr);
diff --git a/usr/src/uts/common/fs/zfs/sys/dsl_pool.h b/usr/src/uts/common/fs/zfs/sys/dsl_pool.h
index 4ed37b8469..b6c51cb3cd 100644
--- a/usr/src/uts/common/fs/zfs/sys/dsl_pool.h
+++ b/usr/src/uts/common/fs/zfs/sys/dsl_pool.h
@@ -123,7 +123,6 @@ typedef struct dsl_pool {
txg_list_t dp_sync_tasks;
taskq_t *dp_sync_taskq;
taskq_t *dp_zil_clean_taskq;
- txg_list_t dp_early_sync_tasks;
/*
* Protects administrative changes (properties, namespace)
diff --git a/usr/src/uts/common/fs/zfs/sys/zfs_ioctl.h b/usr/src/uts/common/fs/zfs/sys/zfs_ioctl.h
index 0657a12efa..03f62c0f09 100644
--- a/usr/src/uts/common/fs/zfs/sys/zfs_ioctl.h
+++ b/usr/src/uts/common/fs/zfs/sys/zfs_ioctl.h
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011-2012 Pawel Jakub Dawidek. All rights reserved.
- * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
* Copyright 2016 RackTop Systems.
* Copyright (c) 2014 Integros [integros.com]
*/
@@ -428,9 +428,10 @@ extern int zfs_secpolicy_snapshot_perms(const char *, cred_t *);
extern int zfs_secpolicy_rename_perms(const char *, const char *, cred_t *);
extern int zfs_secpolicy_destroy_perms(const char *, cred_t *);
extern int zfs_busy(void);
-extern int zfs_unmount_snap(const char *);
+extern void zfs_unmount_snap(const char *);
extern void zfs_destroy_unmount_origin(const char *);
extern int getzfsvfs_impl(struct objset *, struct zfsvfs **);
+extern int getzfsvfs(const char *, struct zfsvfs **);
/*
* ZFS minor numbers can refer to either a control device instance or
diff --git a/usr/src/uts/common/fs/zfs/zcp.c b/usr/src/uts/common/fs/zfs/zcp.c
index 8dbde05262..7736deddef 100644
--- a/usr/src/uts/common/fs/zfs/zcp.c
+++ b/usr/src/uts/common/fs/zfs/zcp.c
@@ -710,7 +710,7 @@ zcp_exists(lua_State *state)
return (luaL_error(state, "unexpected error %d", error));
}
- return (0);
+ return (1);
}
/*
diff --git a/usr/src/uts/common/fs/zfs/zfs_ioctl.c b/usr/src/uts/common/fs/zfs/zfs_ioctl.c
index 61a930a100..d8ac6d0867 100644
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c
+++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c
@@ -1421,7 +1421,7 @@ getzfsvfs_impl(objset_t *os, zfsvfs_t **zfvp)
return (error);
}
-static int
+int
getzfsvfs(const char *dsname, zfsvfs_t **zfvp)
{
objset_t *os;
@@ -3022,31 +3022,6 @@ zfs_ioc_get_fsacl(zfs_cmd_t *zc)
return (error);
}
-/*
- * Search the vfs list for a specified resource. Returns a pointer to it
- * or NULL if no suitable entry is found. The caller of this routine
- * is responsible for releasing the returned vfs pointer.
- */
-static vfs_t *
-zfs_get_vfs(const char *resource)
-{
- struct vfs *vfsp;
- struct vfs *vfs_found = NULL;
-
- vfs_list_read_lock();
- vfsp = rootvfs;
- do {
- if (strcmp(refstr_value(vfsp->vfs_resource), resource) == 0) {
- VFS_HOLD(vfsp);
- vfs_found = vfsp;
- break;
- }
- vfsp = vfsp->vfs_next;
- } while (vfsp != rootvfs);
- vfs_list_unlock();
- return (vfs_found);
-}
-
/* ARGSUSED */
static void
zfs_create_cb(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx)
@@ -3477,40 +3452,41 @@ zfs_ioc_log_history(const char *unused, nvlist_t *innvl, nvlist_t *outnvl)
* Returns 0 if the argument is not a snapshot, or it is not currently a
* filesystem, or we were able to unmount it. Returns error code otherwise.
*/
-int
+void
zfs_unmount_snap(const char *snapname)
{
- vfs_t *vfsp;
- zfsvfs_t *zfsvfs;
- int err;
+ vfs_t *vfsp = NULL;
+ zfsvfs_t *zfsvfs = NULL;
if (strchr(snapname, '@') == NULL)
- return (0);
+ return;
- vfsp = zfs_get_vfs(snapname);
- if (vfsp == NULL)
- return (0);
+ int err = getzfsvfs(snapname, &zfsvfs);
+ if (err != 0) {
+ ASSERT3P(zfsvfs, ==, NULL);
+ return;
+ }
+ vfsp = zfsvfs->z_vfs;
- zfsvfs = vfsp->vfs_data;
ASSERT(!dsl_pool_config_held(dmu_objset_pool(zfsvfs->z_os)));
err = vn_vfswlock(vfsp->vfs_vnodecovered);
VFS_RELE(vfsp);
if (err != 0)
- return (SET_ERROR(err));
+ return;
/*
* Always force the unmount for snapshots.
*/
(void) dounmount(vfsp, MS_FORCE, kcred);
- return (0);
}
/* ARGSUSED */
static int
zfs_unmount_snap_cb(const char *snapname, void *arg)
{
- return (zfs_unmount_snap(snapname));
+ zfs_unmount_snap(snapname);
+ return (0);
}
/*
@@ -3533,7 +3509,7 @@ zfs_destroy_unmount_origin(const char *fsname)
char originname[ZFS_MAX_DATASET_NAME_LEN];
dsl_dataset_name(ds->ds_prev, originname);
dmu_objset_rele(os, FTAG);
- (void) zfs_unmount_snap(originname);
+ zfs_unmount_snap(originname);
} else {
dmu_objset_rele(os, FTAG);
}
@@ -3562,7 +3538,7 @@ zfs_ioc_destroy_snaps(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl)
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
pair = nvlist_next_nvpair(snaps, pair)) {
- (void) zfs_unmount_snap(nvpair_name(pair));
+ zfs_unmount_snap(nvpair_name(pair));
}
return (dsl_destroy_snapshots_nvl(snaps, defer, outnvl));
@@ -3705,11 +3681,8 @@ zfs_ioc_destroy(zfs_cmd_t *zc)
{
int err;
- if (zc->zc_objset_type == DMU_OST_ZFS) {
- err = zfs_unmount_snap(zc->zc_name);
- if (err != 0)
- return (err);
- }
+ if (zc->zc_objset_type == DMU_OST_ZFS)
+ zfs_unmount_snap(zc->zc_name);
if (strchr(zc->zc_name, '@'))
err = dsl_destroy_snapshot(zc->zc_name, zc->zc_defer_destroy);
@@ -3773,7 +3746,9 @@ recursive_unmount(const char *fsname, void *arg)
char fullname[ZFS_MAX_DATASET_NAME_LEN];
(void) snprintf(fullname, sizeof (fullname), "%s@%s", fsname, snapname);
- return (zfs_unmount_snap(fullname));
+ zfs_unmount_snap(fullname);
+
+ return (0);
}
/*
diff --git a/usr/src/uts/i86pc/io/mp_platform_common.c b/usr/src/uts/i86pc/io/mp_platform_common.c
index 2e37895ebb..7f06c46eaa 100644
--- a/usr/src/uts/i86pc/io/mp_platform_common.c
+++ b/usr/src/uts/i86pc/io/mp_platform_common.c
@@ -23,6 +23,7 @@
* Copyright 2016 Nexenta Systems, Inc.
* Copyright 2017 Joyent, Inc.
* Copyright (c) 2017 by Delphix. All rights reserved.
+ * Copyright 2017 Joyent, Inc.
*/
/*
* Copyright (c) 2010, Intel Corporation.
diff --git a/usr/src/uts/i86pc/io/mp_platform_misc.c b/usr/src/uts/i86pc/io/mp_platform_misc.c
index 5126c52c30..b232bd5eb8 100644
--- a/usr/src/uts/i86pc/io/mp_platform_misc.c
+++ b/usr/src/uts/i86pc/io/mp_platform_misc.c
@@ -1229,6 +1229,11 @@ apic_bind_intr(dev_info_t *dip, int irq, uchar_t ioapicid, uchar_t intin)
if (apic_nproc == 1)
return (0);
+ /*
+ * dip may be NULL for interrupts not associated with a device driver,
+ * such as the ACPI SCI or HPET interrupts. In that case just use the
+ * next CPU and return.
+ */
if (dip == NULL) {
iflag = intr_clear();
lock_set(&apic_ioapic_lock);
diff --git a/usr/src/uts/i86pc/io/pcplusmp/apic_introp.c b/usr/src/uts/i86pc/io/pcplusmp/apic_introp.c
index bb4e67076a..a44b6fd3e3 100644
--- a/usr/src/uts/i86pc/io/pcplusmp/apic_introp.c
+++ b/usr/src/uts/i86pc/io/pcplusmp/apic_introp.c
@@ -646,7 +646,7 @@ apic_get_vector_intr_info(int vecirq, apic_get_intr_t *intr_params_p)
{
struct autovec *av_dev;
uchar_t irqno;
- uint i;
+ uint_t i;
apic_irq_t *irq_p;
/* Sanity check the vector/irq argument. */