From e102363a663802082775edf2460d4af7e7fd6e47 Mon Sep 17 00:00:00 2001 From: Don Brady Date: Mon, 24 Apr 2017 11:31:45 -0600 Subject: Fixed zdb -e regression for active cacheless pools 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 Reviewed-by: Brian Behlendorf Signed-off-by: Don Brady Closes #6059 --- lib/libzfs/libzfs_import.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/libzfs/libzfs_import.c') diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c index ce6584090..40798f42b 100644 --- a/lib/libzfs/libzfs_import.c +++ b/lib/libzfs/libzfs_import.c @@ -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); -- cgit v1.2.3