Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jul 2016 09:58:10 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r303083 - in vendor/illumos/dist: cmd/zdb man/man1m
Message-ID:  <201607200958.u6K9wABC053686@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Wed Jul 20 09:58:10 2016
New Revision: 303083
URL: https://svnweb.freebsd.org/changeset/base/303083

Log:
  7164 zdb should be able to open the root dataset
  
  illumos/illumos-gate@b702644a6eb66615d67b492fd73ecd9efa11fc7d
  https://github.com/illumos/illumos-gate/commit/b702644a6eb66615d67b492fd73ecd9efa11fc7d
  
  https://www.illumos.org/issues/7164
    If the pool/dataset command-line argument is specified with a trailing
    slash, for example, "tank/", we should interpret it as the topmost
    dataset (rather than the whole pool)
  
  Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
  Reviewed by: Matthew Ahrens <mahrens@delphix.com>
  Approved by: Robert Mustacchi <rm@joyent.com>
  Author: Tim Chase <tim@chase2k.com>

Modified:
  vendor/illumos/dist/cmd/zdb/zdb.c
  vendor/illumos/dist/man/man1m/zdb.1m

Modified: vendor/illumos/dist/cmd/zdb/zdb.c
==============================================================================
--- vendor/illumos/dist/cmd/zdb/zdb.c	Wed Jul 20 09:57:16 2016	(r303082)
+++ vendor/illumos/dist/cmd/zdb/zdb.c	Wed Jul 20 09:58:10 2016	(r303083)
@@ -3530,6 +3530,7 @@ main(int argc, char **argv)
 	uint64_t max_txg = UINT64_MAX;
 	int rewind = ZPOOL_NEVER_REWIND;
 	char *spa_config_path_env;
+	boolean_t target_is_spa = B_TRUE;
 
 	(void) setrlimit(RLIMIT_NOFILE, &rl);
 	(void) enable_extended_FILE_stdio(-1, -1);
@@ -3708,8 +3709,23 @@ main(int argc, char **argv)
 		}
 	}
 
+	if (strpbrk(target, "/@") != NULL) {
+		size_t targetlen;
+
+		target_is_spa = B_FALSE;
+		/*
+		 * Remove any trailing slash.  Later code would get confused
+		 * by it, but we want to allow it so that "pool/" can
+		 * indicate that we want to dump the topmost filesystem,
+		 * rather than the whole pool.
+		 */
+		targetlen = strlen(target);
+		if (targetlen != 0 && target[targetlen - 1] == '/')
+			target[targetlen - 1] = '\0';
+	}
+
 	if (error == 0) {
-		if (strpbrk(target, "/@") == NULL || dump_opt['R']) {
+		if (target_is_spa || dump_opt['R']) {
 			error = spa_open_rewind(target, &spa, FTAG, policy,
 			    NULL);
 			if (error) {

Modified: vendor/illumos/dist/man/man1m/zdb.1m
==============================================================================
--- vendor/illumos/dist/man/man1m/zdb.1m	Wed Jul 20 09:57:16 2016	(r303082)
+++ vendor/illumos/dist/man/man1m/zdb.1m	Wed Jul 20 09:58:10 2016	(r303083)
@@ -56,6 +56,11 @@ pool, and is inherently unstable. The pr
 not documented, a knowledge of ZFS internals is assumed.
 
 .P
+If the \fIdataset\fR argument does not contain any \fB/\fR or \fB@\fR
+characters, it is interpreted as a pool name.  The root dataset can be
+specified as \fIpool\fB/\fR (pool name followed by a slash).
+
+.P
 When operating on an imported and active pool it is possible, though unlikely,
 that zdb may interpret inconsistent pool data and behave erratically.
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607200958.u6K9wABC053686>