aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkash B <akash-b@hpe.com>2023-11-27 21:41:58 +0000
committerGitHub <noreply@github.com>2023-11-27 21:41:58 +0000
commitc1a47de86fd5edde091e68e8e91840d3cb9c55b0 (patch)
tree5efb3566b0db88ced00a1c9556e342e32a69fb12
parent213d6829673ce28095f7c15b8fb65e1ade91d20a (diff)
downloadsrc-c1a47de86fd5edde091e68e8e91840d3cb9c55b0.tar.gz
src-c1a47de86fd5edde091e68e8e91840d3cb9c55b0.zip
-rw-r--r--cmd/zdb/zdb.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index e8726915cc8f..486bec9910a4 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -9179,22 +9179,6 @@ main(int argc, char **argv)
if (dump_opt['l'])
return (dump_label(argv[0]));
- if (dump_opt['O']) {
- if (argc != 2)
- usage();
- dump_opt['v'] = verbose + 3;
- return (dump_path(argv[0], argv[1], NULL));
- }
- if (dump_opt['r']) {
- target_is_spa = B_FALSE;
- if (argc != 3)
- usage();
- dump_opt['v'] = verbose;
- error = dump_path(argv[0], argv[1], &object);
- if (error != 0)
- fatal("internal error: %s", strerror(error));
- }
-
if (dump_opt['X'] || dump_opt['F'])
rewind = ZPOOL_DO_REWIND |
(dump_opt['X'] ? ZPOOL_EXTREME_REWIND : 0);
@@ -9296,6 +9280,29 @@ main(int argc, char **argv)
}
/*
+ * We need to make sure to process -O option or call
+ * dump_path after the -e option has been processed,
+ * which imports the pool to the namespace if it's
+ * not in the cachefile.
+ */
+ if (dump_opt['O']) {
+ if (argc != 2)
+ usage();
+ dump_opt['v'] = verbose + 3;
+ return (dump_path(argv[0], argv[1], NULL));
+ }
+
+ if (dump_opt['r']) {
+ target_is_spa = B_FALSE;
+ if (argc != 3)
+ usage();
+ dump_opt['v'] = verbose;
+ error = dump_path(argv[0], argv[1], &object);
+ if (error != 0)
+ fatal("internal error: %s", strerror(error));
+ }
+
+ /*
* import_checkpointed_state makes the assumption that the
* target pool that we pass it is already part of the spa
* namespace. Because of that we need to make sure to call