]> granicus.if.org Git - zfs/commitdiff
Fixed zdb -e regression for active cacheless pools
authorDon Brady <don.brady@intel.com>
Mon, 24 Apr 2017 17:31:45 +0000 (11:31 -0600)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 24 Apr 2017 17:31:45 +0000 (10:31 -0700)
zdb -e for active cache-less pools fails:

$ sudo zpool create -o cachefile=none basic mirror sdk sdl
$ sudo zdb -e -b basic
zdb: can't open 'basic': No such file or directory

This is a recent regression introduce by commit c30d8de.

Reviewed-by: Richard Yao <ryao@gentoo.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Don Brady <don.brady@intel.com>
Closes #6059

lib/libzfs/libzfs_import.c

index ce65840905b7a8bea1ea5eb975ed98e0114b5012..40798f42b625759407a78470eaefeb95312b4362 100644 (file)
@@ -1938,10 +1938,15 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
                                 * exclusively. This will prune all underlying
                                 * multipath devices which otherwise could
                                 * result in the vdev appearing as UNAVAIL.
+                                *
+                                * Under zdb, this step isn't required and
+                                * would prevent a zdb -e of active pools with
+                                * no cachefile.
                                 */
                                fd = open(slice->rn_name, O_RDONLY | O_EXCL);
-                               if (fd >= 0) {
-                                       close(fd);
+                               if (fd >= 0 || iarg->can_be_active) {
+                                       if (fd >= 0)
+                                               close(fd);
                                        add_config(hdl, &pools,
                                            slice->rn_name, slice->rn_order,
                                            slice->rn_num_labels, config);