diff options
author | Don Brady <[email protected]> | 2017-04-24 11:31:45 -0600 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-04-24 10:31:45 -0700 |
commit | e102363a663802082775edf2460d4af7e7fd6e47 (patch) | |
tree | c85b74b3df8fb71539639cd31ec03fb23166cb17 /lib/libzfs | |
parent | 6e03ec4fa26110dcdf817401a375399f3432ae21 (diff) |
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 <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Don Brady <[email protected]>
Closes #6059
Diffstat (limited to 'lib/libzfs')
-rw-r--r-- | lib/libzfs/libzfs_import.c | 9 |
1 files changed, 7 insertions, 2 deletions
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); |