summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2017-04-14 11:51:25 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2017-04-14 11:51:25 +0000
commit7d8821ff06ee5e15592eeb9f25cd89d1e07780e3 (patch)
treea8ac31d6f3fe59107286268fe4f1ce95ab3f3cc1 /usr/src/cmd
parent3a0b3ce4b0776b70f28ed47f1b86cbea5d59d864 (diff)
parentc2710388e7f692e90d6699bdef7a3987379dba9d (diff)
downloadillumos-joyent-7d8821ff06ee5e15592eeb9f25cd89d1e07780e3.tar.gz
[illumos-gate merge]
commit c2710388e7f692e90d6699bdef7a3987379dba9d 7574 boot slowness followed by panic while booting on KVM when no cpu tag is specified in virsh XML commit 20ee95858720e9df048b9d31b30aeb303e0685c9 7572 vioif panic: qe->qe_indirect_next < qe->qe_queue->vq_indirect_num commit 8a981c3356b194b3b5c0ae9276a9cc31cd2f93a3 7955 libshare needs to initialize only those datasets being modified by the consumer commit b127fe3c059af7adf772735498680b4f2e1405ef 6101 attempt to lzc_create() a filesystem under a volume results in a panic commit 53d6c69268ad98d311e74fb98d7514711585c1fa 8024 mdb_ctf_vread() needn't be so strict about unions commit 7f0bdb4257bb4f1f76390b72665961e411da24c6 8061 sa_find_idx_tab can be declared more type-safely commit dfd5965f7e43b6a630e5ac86708ae76b4f02cc40 6392 zdb: introduce -V for verbatim import commit e548d2fa41d1baa06662ed9abbb8bcec86e27dd9 7900 zdb shouldn't print the path of a znode at verbosity < 5 commit adc68ba91854584a470224cdb128a8e1ba16b41b 8062 memory leak in smb_unicode_init() commit 6b036259815954b7ad86d651af18efba672cb7a9 8026 retire zfs_throttle_delay and zfs_throttle_resolution
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_ctf.c61
-rw-r--r--usr/src/cmd/zdb/zdb.c46
-rw-r--r--usr/src/cmd/zfs/zfs_main.c10
3 files changed, 74 insertions, 43 deletions
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_ctf.c b/usr/src/cmd/mdb/common/mdb/mdb_ctf.c
index 9b6d54c7b1..af8fc7b0fd 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_ctf.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_ctf.c
@@ -24,7 +24,7 @@
*/
/*
* Copyright (c) 2015, Joyent, Inc. All rights reserved.
- * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2016 by Delphix. All rights reserved.
*/
#include <mdb/mdb_ctf.h>
@@ -1267,7 +1267,7 @@ vread_helper(mdb_ctf_id_t modid, char *modbuf,
mdb_ctf_id_t tgtid, char *tgtbuf, const char *tgtname, uint_t flags)
{
size_t modsz, tgtsz;
- int modkind, tgtkind;
+ int modkind, tgtkind, mod_members;
member_t mbr;
enum_value_t ev;
int ret;
@@ -1470,29 +1470,52 @@ vread_helper(mdb_ctf_id_t modid, char *modbuf,
return (mdb_ctf_member_iter(modid, member_cb, &mbr));
case CTF_K_UNION:
+ mbr.m_modbuf = modbuf;
+ mbr.m_tgtbuf = tgtbuf;
+ mbr.m_tgtid = tgtid;
+ mbr.m_flags = flags;
+ mbr.m_tgtname = typename;
/*
- * Unions are a little tricky. The only time it's truly
- * safe to read in a union is if no part of the union or
- * any of its component types have changed. The correct
- * use of this feature is to read the containing structure,
- * figure out which component of the union is valid, compute
- * the location of that in the target and then read in
- * that part of the structure.
+ * Not all target union members need to be present in the
+ * mdb type. If there is only a single union member in the
+ * mdb type, its actual type does not need to match with
+ * its target's type. On the other hand, if more than one
+ * union members are specified in the mdb type, their types
+ * must match with the types of their relevant union members
+ * of the target union.
*/
+ mod_members = mdb_ctf_num_members(modid);
+ if (mod_members == 1) {
+ return (mdb_ctf_member_iter(modid, member_cb, &mbr));
+ } else if (mod_members > 1) {
+ if (mdb_ctf_member_iter(modid, type_equals_cb,
+ &tgtid)) {
+ mdb_ctf_warn(flags,
+ "inexact match for union %s (%s)\n",
+ typename, tgtname);
+ return (set_errno(EMDB_INCOMPAT));
+ }
- if (!type_equals(modid, tgtid)) {
- mdb_ctf_warn(flags, "inexact match for union %s (%s)\n",
- typename, tgtname);
- return (set_errno(EMDB_INCOMPAT));
+ /*
+ * From the check above we know that the members
+ * which are present in the mdb type are equal to
+ * the types in the target. Thus, the member_cb
+ * callback below will not move anything around and
+ * it is equivalent to:
+ *
+ * bcopy(tgtbuf, modbuf, MAX(module member's sizes))
+ */
+ return (mdb_ctf_member_iter(modid, member_cb, &mbr));
+ } else {
+ /*
+ * We either got 0 or -1. In any case that number
+ * should be returned right away. For the error
+ * case of -1, errno has been set for us.
+ */
+ return (mod_members);
}
- ASSERT(modsz == tgtsz);
-
- bcopy(tgtbuf, modbuf, modsz);
-
- return (0);
-
case CTF_K_ARRAY:
if (mdb_ctf_array_info(tgtid, &tar) != 0) {
mdb_ctf_warn(flags,
diff --git a/usr/src/cmd/zdb/zdb.c b/usr/src/cmd/zdb/zdb.c
index 8337982284..9ddf5e1021 100644
--- a/usr/src/cmd/zdb/zdb.c
+++ b/usr/src/cmd/zdb/zdb.c
@@ -120,20 +120,21 @@ static void
usage(void)
{
(void) fprintf(stderr,
- "Usage:\t%s [-AbcdDFGhiLMPsvX] [-e [-p <path> ...]] "
+ "Usage:\t%s [-AbcdDFGhiLMPsvX] [-e [-V] [-p <path> ...]] "
"[-I <inflight I/Os>]\n"
"\t\t[-o <var>=<value>]... [-t <txg>] [-U <cache>] [-x <dumpdir>]\n"
"\t\t[<poolname> [<object> ...]]\n"
- "\t%s [-AdiPv] [-e [-p <path> ...]] [-U <cache>] <dataset> "
+ "\t%s [-AdiPv] [-e [-V] [-p <path> ...]] [-U <cache>] <dataset> "
"[<object> ...]\n"
"\t%s -C [-A] [-U <cache>]\n"
"\t%s -l [-Aqu] <device>\n"
- "\t%s -m [-AFLPX] [-e [-p <path> ...]] [-t <txg>] [-U <cache>]\n"
- "\t\t<poolname> [<vdev> [<metaslab> ...]]\n"
+ "\t%s -m [-AFLPX] [-e [-V] [-p <path> ...]] [-t <txg>] "
+ "[-U <cache>]\n\t\t<poolname> [<vdev> [<metaslab> ...]]\n"
"\t%s -O <dataset> <path>\n"
- "\t%s -R [-A] [-e [-p <path> ...]] [-U <cache>]\n"
+ "\t%s -R [-A] [-e [-V] [-p <path> ...]] [-U <cache>]\n"
"\t\t<poolname> <vdev>:<offset>:<size>[:<flags>]\n"
- "\t%s -S [-AP] [-e [-p <path> ...]] [-U <cache>] <poolname>\n\n",
+ "\t%s -S [-AP] [-e [-V] [-p <path> ...]] [-U <cache>] "
+ "<poolname>\n\n",
cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname,
cmdname);
@@ -188,6 +189,7 @@ usage(void)
(void) fprintf(stderr, " -u uberblock\n");
(void) fprintf(stderr, " -U <cachefile_path> -- use alternate "
"cachefile\n");
+ (void) fprintf(stderr, " -V do verbatim import\n");
(void) fprintf(stderr, " -x <dumpdir> -- "
"dump all read blocks into specified directory\n");
(void) fprintf(stderr, " -X attempt extreme rewind (does not "
@@ -1737,23 +1739,19 @@ dump_znode(objset_t *os, uint64_t object, void *data, size_t size)
return;
}
- error = zfs_obj_to_path(os, object, path, sizeof (path));
- if (error != 0) {
- (void) snprintf(path, sizeof (path), "\?\?\?<object#%llu>",
- (u_longlong_t)object);
- }
- if (dump_opt['d'] < 3) {
- (void) printf("\t%s\n", path);
- (void) sa_handle_destroy(hdl);
- return;
- }
-
z_crtime = (time_t)crtm[0];
z_atime = (time_t)acctm[0];
z_mtime = (time_t)modtm[0];
z_ctime = (time_t)chgtm[0];
- (void) printf("\tpath %s\n", path);
+ if (dump_opt['d'] > 4) {
+ error = zfs_obj_to_path(os, object, path, sizeof (path));
+ if (error != 0) {
+ (void) snprintf(path, sizeof (path),
+ "\?\?\?<object#%llu>", (u_longlong_t)object);
+ }
+ (void) printf("\tpath %s\n", path);
+ }
dump_uidgid(os, uid, gid);
(void) printf("\tatime %s", ctime(&z_atime));
(void) printf("\tmtime %s", ctime(&z_mtime));
@@ -3714,6 +3712,7 @@ main(int argc, char **argv)
char *target;
nvlist_t *policy = NULL;
uint64_t max_txg = UINT64_MAX;
+ int flags = ZFS_IMPORT_MISSING_LOG;
int rewind = ZPOOL_NEVER_REWIND;
char *spa_config_path_env;
boolean_t target_is_spa = B_TRUE;
@@ -3733,7 +3732,7 @@ main(int argc, char **argv)
spa_config_path = spa_config_path_env;
while ((c = getopt(argc, argv,
- "AbcCdDeFGhiI:lLmMo:Op:PqRsSt:uU:vx:X")) != -1) {
+ "AbcCdDeFGhiI:lLmMo:Op:PqRsSt:uU:vVx:X")) != -1) {
switch (c) {
case 'b':
case 'c':
@@ -3807,6 +3806,9 @@ main(int argc, char **argv)
case 'v':
verbose++;
break;
+ case 'V':
+ flags = ZFS_IMPORT_VERBATIM;
+ break;
case 'x':
vn_dumpdir = optarg;
break;
@@ -3906,11 +3908,7 @@ main(int argc, char **argv)
fatal("can't open '%s': %s",
target, strerror(ENOMEM));
}
- if ((error = spa_import(name, cfg, NULL,
- ZFS_IMPORT_MISSING_LOG)) != 0) {
- error = spa_import(name, cfg, NULL,
- ZFS_IMPORT_VERBATIM);
- }
+ error = spa_import(name, cfg, NULL, flags);
}
}
diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c
index fa66039fba..2a7a9a6ec2 100644
--- a/usr/src/cmd/zfs/zfs_main.c
+++ b/usr/src/cmd/zfs/zfs_main.c
@@ -68,6 +68,7 @@
#include <aclutils.h>
#include <directory.h>
#include <idmap.h>
+#include <libshare.h>
#include "zfs_iter.h"
#include "zfs_util.h"
@@ -6218,6 +6219,15 @@ share_mount(int op, int argc, char **argv)
return (0);
qsort(dslist, count, sizeof (void *), libzfs_dataset_cmp);
+ sa_init_selective_arg_t sharearg;
+ sharearg.zhandle_arr = dslist;
+ sharearg.zhandle_len = count;
+ if ((ret = zfs_init_libshare_arg(zfs_get_handle(dslist[0]),
+ SA_INIT_SHARE_API_SELECTIVE, &sharearg)) != SA_OK) {
+ (void) fprintf(stderr,
+ gettext("Could not initialize libshare, %d"), ret);
+ return (ret);
+ }
for (i = 0; i < count; i++) {
if (verbose)